diff --git a/sdk/workloads/azure-mgmt-workloads/_meta.json b/sdk/workloads/azure-mgmt-workloads/_meta.json index e2b35cf01fcb..52f284f515da 100644 --- a/sdk/workloads/azure-mgmt-workloads/_meta.json +++ b/sdk/workloads/azure-mgmt-workloads/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.13.0", + "@autorest/python@5.16.0", "@autorest/modelerfour@4.19.3" ], - "commit": "2d6cb29af754f48a08f94cb6113bb1f01a4e0eb9", + "commit": "cf554d7336e16b5daadf010f6dc3fd3da8af8229", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/workloads/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/workloads/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/workloads/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/__init__.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/__init__.py index 8f2b5059c9df..2ebfa2f55a42 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/__init__.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/__init__.py @@ -10,9 +10,14 @@ from ._version import VERSION __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['WorkloadsClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_vendor.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_vendor.py index 138f663c53a4..16abec3a5817 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_vendor.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_vendor.py @@ -5,8 +5,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import WorkloadsClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from msrest import Deserializer, Serializer + + from azure.core import PipelineClient + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -25,3 +36,10 @@ def _format_url_section(template, **kwargs): c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + _client: "PipelineClient" + _config: WorkloadsClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_workloads_client.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_workloads_client.py index 253419521122..55190237707b 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_workloads_client.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_workloads_client.py @@ -73,16 +73,36 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.php_workloads = PhpWorkloadsOperations(self._client, self._config, self._serialize, self._deserialize) - self.wordpress_instances = WordpressInstancesOperations(self._client, self._config, self._serialize, self._deserialize) - self.sap_virtual_instances = SAPVirtualInstancesOperations(self._client, self._config, self._serialize, self._deserialize) - self.sap_central_instances = SAPCentralInstancesOperations(self._client, self._config, self._serialize, self._deserialize) - self.sap_database_instances = SAPDatabaseInstancesOperations(self._client, self._config, self._serialize, self._deserialize) - self.sap_application_server_instances = SAPApplicationServerInstancesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize) - self.provider_instances = ProviderInstancesOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.php_workloads = PhpWorkloadsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.wordpress_instances = WordpressInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sap_virtual_instances = SAPVirtualInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sap_central_instances = SAPCentralInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sap_database_instances = SAPDatabaseInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sap_application_server_instances = SAPApplicationServerInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.monitors = MonitorsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.provider_instances = ProviderInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.skus = SkusOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/__init__.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/__init__.py index 0d869187c5dd..b241d4103ef5 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/__init__.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._workloads_client import WorkloadsClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['WorkloadsClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_vendor.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_vendor.py new file mode 100644 index 000000000000..39f0622ea472 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import WorkloadsClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from msrest import Deserializer, Serializer + + from azure.core import AsyncPipelineClient + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + _client: "AsyncPipelineClient" + _config: WorkloadsClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_workloads_client.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_workloads_client.py index e46fe69426e1..eb9fa3f44ba2 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_workloads_client.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_workloads_client.py @@ -76,16 +76,36 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.php_workloads = PhpWorkloadsOperations(self._client, self._config, self._serialize, self._deserialize) - self.wordpress_instances = WordpressInstancesOperations(self._client, self._config, self._serialize, self._deserialize) - self.sap_virtual_instances = SAPVirtualInstancesOperations(self._client, self._config, self._serialize, self._deserialize) - self.sap_central_instances = SAPCentralInstancesOperations(self._client, self._config, self._serialize, self._deserialize) - self.sap_database_instances = SAPDatabaseInstancesOperations(self._client, self._config, self._serialize, self._deserialize) - self.sap_application_server_instances = SAPApplicationServerInstancesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize) - self.provider_instances = ProviderInstancesOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.php_workloads = PhpWorkloadsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.wordpress_instances = WordpressInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sap_virtual_instances = SAPVirtualInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sap_central_instances = SAPCentralInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sap_database_instances = SAPDatabaseInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sap_application_server_instances = SAPApplicationServerInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.monitors = MonitorsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.provider_instances = ProviderInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.skus = SkusOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/__init__.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/__init__.py index 776a9a684ec2..ce450c03ae12 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/__init__.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/__init__.py @@ -18,6 +18,9 @@ from ._provider_instances_operations import ProviderInstancesOperations from ._skus_operations import SkusOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'PhpWorkloadsOperations', 'WordpressInstancesOperations', @@ -31,3 +34,5 @@ 'ProviderInstancesOperations', 'SkusOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_monitors_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_monitors_operations.py index 7db6cb23ed09..87c0a2057083 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_monitors_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_monitors_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,42 +16,42 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request from ...operations._monitors_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MonitorsOperations: - """MonitorsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.aio.WorkloadsClient`'s + :attr:`monitors` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = 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.MonitorListResult"]: + ) -> AsyncIterable[_models.MonitorListResult]: """Gets a list of SAP monitors in the specified subscription. Gets a list of SAP monitors in the specified subscription. The operations returns various @@ -62,13 +62,16 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.MonitorListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MonitorListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -76,9 +79,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -86,9 +91,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -127,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MonitorListResult"]: + ) -> AsyncIterable[_models.MonitorListResult]: """Gets a list of SAP monitors. Gets a list of SAP monitors in the specified resource group. @@ -139,13 +146,16 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.MonitorListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MonitorListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -154,9 +164,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -165,9 +177,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -207,7 +221,7 @@ async def get( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> "_models.Monitor": + ) -> _models.Monitor: """Gets properties of a SAP monitor. Gets properties of a SAP monitor for the specified subscription, resource group, and resource @@ -222,13 +236,16 @@ async def get( :rtype: ~azure.mgmt.workloads.models.Monitor :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Monitor"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Monitor] request = build_get_request( @@ -237,11 +254,13 @@ async def get( monitor_name=monitor_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -267,17 +286,20 @@ async def _create_initial( self, resource_group_name: str, monitor_name: str, - monitor_parameter: "_models.Monitor", + monitor_parameter: _models.Monitor, **kwargs: Any - ) -> "_models.Monitor": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Monitor"] + ) -> _models.Monitor: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Monitor] _json = self._serialize.body(monitor_parameter, 'Monitor') @@ -289,11 +311,13 @@ async def _create_initial( content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -323,9 +347,9 @@ async def begin_create( self, resource_group_name: str, monitor_name: str, - monitor_parameter: "_models.Monitor", + monitor_parameter: _models.Monitor, **kwargs: Any - ) -> AsyncLROPoller["_models.Monitor"]: + ) -> AsyncLROPoller[_models.Monitor]: """Creates a SAP monitor. Creates a SAP monitor for the specified subscription, resource group, and resource name. @@ -349,37 +373,47 @@ async def begin_create( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.Monitor] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Monitor] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Monitor"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, monitor_name=monitor_name, monitor_parameter=monitor_parameter, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('Monitor', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -397,14 +431,17 @@ async def _delete_initial( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> Optional["_models.OperationStatusResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + ) -> Optional[_models.OperationStatusResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.OperationStatusResult]] request = build_delete_request_initial( @@ -413,11 +450,13 @@ async def _delete_initial( monitor_name=monitor_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -446,7 +485,7 @@ async def begin_delete( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.OperationStatusResult"]: + ) -> AsyncLROPoller[_models.OperationStatusResult]: """Deletes a SAP monitor. Deletes a SAP monitor with the specified subscription, resource group, and SAP monitor name. @@ -468,34 +507,44 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatusResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, monitor_name=monitor_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -513,9 +562,9 @@ async def update( self, resource_group_name: str, monitor_name: str, - body: "_models.UpdateMonitorRequest", + body: _models.UpdateMonitorRequest, **kwargs: Any - ) -> "_models.Monitor": + ) -> _models.Monitor: """Patches the Tags field of a SAP monitor. Patches the Tags field of a SAP monitor for the specified subscription, resource group, and SAP @@ -532,14 +581,17 @@ async def update( :rtype: ~azure.mgmt.workloads.models.Monitor :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Monitor"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Monitor] _json = self._serialize.body(body, 'UpdateMonitorRequest') @@ -551,11 +603,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_operations.py index 762c5bd0ae57..25d098515c49 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_operations.py @@ -14,41 +14,41 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import 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 ..._vendor import _convert_request from ...operations._operations import build_list_request +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.aio.WorkloadsClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = 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.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Lists all the available API operations under this PR. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +57,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_patch.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# 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/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_php_workloads_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_php_workloads_operations.py index 9f6e88ce32a3..0cd6416fb887 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_php_workloads_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_php_workloads_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,42 +16,42 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request from ...operations._php_workloads_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PhpWorkloadsOperations: - """PhpWorkloadsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.aio.WorkloadsClient`'s + :attr:`php_workloads` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = 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_by_subscription( self, **kwargs: Any - ) -> AsyncIterable["_models.PhpWorkloadResourceList"]: + ) -> AsyncIterable[_models.PhpWorkloadResourceList]: """Lists PHP workload resources for a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,13 +61,16 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.PhpWorkloadResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PhpWorkloadResourceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -75,9 +78,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -85,9 +90,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -126,7 +133,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PhpWorkloadResourceList"]: + ) -> AsyncIterable[_models.PhpWorkloadResourceList]: """Lists PHP workload resources in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -138,13 +145,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.PhpWorkloadResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PhpWorkloadResourceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -153,9 +163,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -164,9 +176,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -206,7 +220,7 @@ async def get( resource_group_name: str, php_workload_name: str, **kwargs: Any - ) -> "_models.PhpWorkloadResource": + ) -> _models.PhpWorkloadResource: """Gets the PHP workload resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -218,13 +232,16 @@ async def get( :rtype: ~azure.mgmt.workloads.models.PhpWorkloadResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PhpWorkloadResource] request = build_get_request( @@ -233,11 +250,13 @@ async def get( php_workload_name=php_workload_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -263,17 +282,20 @@ async def _create_or_update_initial( self, resource_group_name: str, php_workload_name: str, - php_workload_resource: "_models.PhpWorkloadResource", + php_workload_resource: _models.PhpWorkloadResource, **kwargs: Any - ) -> "_models.PhpWorkloadResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResource"] + ) -> _models.PhpWorkloadResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PhpWorkloadResource] _json = self._serialize.body(php_workload_resource, 'PhpWorkloadResource') @@ -285,11 +307,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -319,9 +343,9 @@ async def begin_create_or_update( self, resource_group_name: str, php_workload_name: str, - php_workload_resource: "_models.PhpWorkloadResource", + php_workload_resource: _models.PhpWorkloadResource, **kwargs: Any - ) -> AsyncLROPoller["_models.PhpWorkloadResource"]: + ) -> AsyncLROPoller[_models.PhpWorkloadResource]: """Create or updated PHP workload resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -343,37 +367,47 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.PhpWorkloadResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PhpWorkloadResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, php_workload_name=php_workload_name, php_workload_resource=php_workload_resource, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('PhpWorkloadResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -391,9 +425,9 @@ async def update( self, resource_group_name: str, php_workload_name: str, - resource_patch_request_body: "_models.PatchResourceRequestBody", + resource_patch_request_body: _models.PatchResourceRequestBody, **kwargs: Any - ) -> "_models.PhpWorkloadResource": + ) -> _models.PhpWorkloadResource: """Update PHP workload resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -407,14 +441,17 @@ async def update( :rtype: ~azure.mgmt.workloads.models.PhpWorkloadResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PhpWorkloadResource] _json = self._serialize.body(resource_patch_request_body, 'PatchResourceRequestBody') @@ -426,11 +463,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -459,13 +498,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements delete_infra: Optional[str] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -475,11 +517,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version=api_version, delete_infra=delete_infra, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -525,21 +569,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, php_workload_name=php_workload_name, delete_infra=delete_infra, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -549,8 +598,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_provider_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_provider_instances_operations.py index 3840ad9fbc2c..6d61e590f90b 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_provider_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_provider_instances_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,36 +16,36 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request from ...operations._provider_instances_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ProviderInstancesOperations: - """ProviderInstancesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.aio.WorkloadsClient`'s + :attr:`provider_instances` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = 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( @@ -53,7 +53,7 @@ def list( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ProviderInstanceListResult"]: + ) -> AsyncIterable[_models.ProviderInstanceListResult]: """Gets a list of provider instances in the specified SAP monitor. Gets a list of provider instances in the specified SAP monitor. The operations returns various @@ -70,13 +70,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.ProviderInstanceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ProviderInstanceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderInstanceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -86,9 +89,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -98,9 +103,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -141,7 +148,7 @@ async def get( monitor_name: str, provider_instance_name: str, **kwargs: Any - ) -> "_models.ProviderInstance": + ) -> _models.ProviderInstance: """Gets properties of a provider instance. Gets properties of a provider instance for the specified subscription, resource group, SAP @@ -158,13 +165,16 @@ async def get( :rtype: ~azure.mgmt.workloads.models.ProviderInstance :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderInstance"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ProviderInstance] request = build_get_request( @@ -174,11 +184,13 @@ async def get( provider_instance_name=provider_instance_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -205,17 +217,20 @@ async def _create_initial( resource_group_name: str, monitor_name: str, provider_instance_name: str, - provider_instance_parameter: "_models.ProviderInstance", + provider_instance_parameter: _models.ProviderInstance, **kwargs: Any - ) -> "_models.ProviderInstance": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderInstance"] + ) -> _models.ProviderInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ProviderInstance] _json = self._serialize.body(provider_instance_parameter, 'ProviderInstance') @@ -228,11 +243,13 @@ async def _create_initial( content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -263,9 +280,9 @@ async def begin_create( resource_group_name: str, monitor_name: str, provider_instance_name: str, - provider_instance_parameter: "_models.ProviderInstance", + provider_instance_parameter: _models.ProviderInstance, **kwargs: Any - ) -> AsyncLROPoller["_models.ProviderInstance"]: + ) -> AsyncLROPoller[_models.ProviderInstance]: """Creates a provider instance. Creates a provider instance for the specified subscription, resource group, SAP monitor name, @@ -292,17 +309,20 @@ async def begin_create( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.ProviderInstance] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ProviderInstance] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderInstance"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, monitor_name=monitor_name, provider_instance_name=provider_instance_name, @@ -310,20 +330,27 @@ async def begin_create( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ProviderInstance', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -342,14 +369,17 @@ async def _delete_initial( monitor_name: str, provider_instance_name: str, **kwargs: Any - ) -> Optional["_models.OperationStatusResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + ) -> Optional[_models.OperationStatusResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.OperationStatusResult]] request = build_delete_request_initial( @@ -359,11 +389,13 @@ async def _delete_initial( provider_instance_name=provider_instance_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -393,7 +425,7 @@ async def begin_delete( monitor_name: str, provider_instance_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.OperationStatusResult"]: + ) -> AsyncLROPoller[_models.OperationStatusResult]: """Deletes a provider instance. Deletes a provider instance for the specified subscription, resource group, SAP monitor name, @@ -418,35 +450,45 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatusResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, monitor_name=monitor_name, provider_instance_name=provider_instance_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_application_server_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_application_server_instances_operations.py index 043d822c2afc..d6cc2c9d6fce 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_application_server_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_application_server_instances_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,36 +16,36 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request from ...operations._sap_application_server_instances_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SAPApplicationServerInstancesOperations: - """SAPApplicationServerInstancesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.aio.WorkloadsClient`'s + :attr:`sap_application_server_instances` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = 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( @@ -54,7 +54,7 @@ async def get( sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any - ) -> "_models.SAPApplicationServerInstance": + ) -> _models.SAPApplicationServerInstance: """Gets the SAP Application Server Instance. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -68,13 +68,16 @@ async def get( :rtype: ~azure.mgmt.workloads.models.SAPApplicationServerInstance :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPApplicationServerInstance] request = build_get_request( @@ -84,11 +87,13 @@ async def get( application_instance_name=application_instance_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -115,17 +120,20 @@ async def _create_initial( resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, - body: Optional["_models.SAPApplicationServerInstance"] = None, + body: Optional[_models.SAPApplicationServerInstance] = None, **kwargs: Any - ) -> "_models.SAPApplicationServerInstance": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] + ) -> _models.SAPApplicationServerInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPApplicationServerInstance] if body is not None: _json = self._serialize.body(body, 'SAPApplicationServerInstance') @@ -141,11 +149,13 @@ async def _create_initial( content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -176,9 +186,9 @@ async def begin_create( resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, - body: Optional["_models.SAPApplicationServerInstance"] = None, + body: Optional[_models.SAPApplicationServerInstance] = None, **kwargs: Any - ) -> AsyncLROPoller["_models.SAPApplicationServerInstance"]: + ) -> AsyncLROPoller[_models.SAPApplicationServerInstance]: """Puts the SAP Application Server Instance. :code:`
`:code:`
`This will be used by service only. PUT by end user will return a Bad Request error. @@ -204,17 +214,20 @@ async def begin_create( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPApplicationServerInstance] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPApplicationServerInstance] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, application_instance_name=application_instance_name, @@ -222,20 +235,27 @@ async def begin_create( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SAPApplicationServerInstance', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -253,17 +273,20 @@ async def _update_initial( resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, - body: Optional["_models.UpdateSAPApplicationInstanceRequest"] = None, + body: Optional[_models.UpdateSAPApplicationInstanceRequest] = None, **kwargs: Any - ) -> "_models.SAPApplicationServerInstance": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] + ) -> _models.SAPApplicationServerInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPApplicationServerInstance] if body is not None: _json = self._serialize.body(body, 'UpdateSAPApplicationInstanceRequest') @@ -279,11 +302,13 @@ async def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -314,9 +339,9 @@ async def begin_update( resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, - body: Optional["_models.UpdateSAPApplicationInstanceRequest"] = None, + body: Optional[_models.UpdateSAPApplicationInstanceRequest] = None, **kwargs: Any - ) -> AsyncLROPoller["_models.SAPApplicationServerInstance"]: + ) -> AsyncLROPoller[_models.SAPApplicationServerInstance]: """Puts the SAP Application Server Instance. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -341,17 +366,20 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPApplicationServerInstance] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPApplicationServerInstance] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, application_instance_name=application_instance_name, @@ -359,20 +387,27 @@ async def begin_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SAPApplicationServerInstance', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -391,14 +426,17 @@ async def _delete_initial( sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any - ) -> Optional["_models.OperationStatusResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + ) -> Optional[_models.OperationStatusResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.OperationStatusResult]] request = build_delete_request_initial( @@ -408,11 +446,13 @@ async def _delete_initial( application_instance_name=application_instance_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -442,7 +482,7 @@ async def begin_delete( sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.OperationStatusResult"]: + ) -> AsyncLROPoller[_models.OperationStatusResult]: """Deletes the SAP Application Server Instance. :code:`
`:code:`
`This operation will be used by service only. Delete by end user will return a Bad Request error. @@ -465,35 +505,45 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatusResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, application_instance_name=application_instance_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -512,7 +562,7 @@ def list( resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SAPApplicationServerInstanceList"]: + ) -> AsyncIterable[_models.SAPApplicationServerInstanceList]: """Lists the SAP Application server Instances in an SVI. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -526,13 +576,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.SAPApplicationServerInstanceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPApplicationServerInstanceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstanceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -542,9 +595,11 @@ def prepare_request(next_link=None): sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -554,9 +609,11 @@ def prepare_request(next_link=None): sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_central_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_central_instances_operations.py index 8c2fd0f3be64..311994fea0bf 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_central_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_central_instances_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,36 +16,36 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request from ...operations._sap_central_instances_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SAPCentralInstancesOperations: - """SAPCentralInstancesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.aio.WorkloadsClient`'s + :attr:`sap_central_instances` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = 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( @@ -54,7 +54,7 @@ async def get( sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any - ) -> "_models.SAPCentralServerInstance": + ) -> _models.SAPCentralServerInstance: """Gets the SAP Central Instance. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -69,13 +69,16 @@ async def get( :rtype: ~azure.mgmt.workloads.models.SAPCentralServerInstance :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPCentralServerInstance] request = build_get_request( @@ -85,11 +88,13 @@ async def get( central_instance_name=central_instance_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -116,17 +121,20 @@ async def _create_initial( resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, - body: Optional["_models.SAPCentralServerInstance"] = None, + body: Optional[_models.SAPCentralServerInstance] = None, **kwargs: Any - ) -> "_models.SAPCentralServerInstance": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] + ) -> _models.SAPCentralServerInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPCentralServerInstance] if body is not None: _json = self._serialize.body(body, 'SAPCentralServerInstance') @@ -142,11 +150,13 @@ async def _create_initial( content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -177,9 +187,9 @@ async def begin_create( resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, - body: Optional["_models.SAPCentralServerInstance"] = None, + body: Optional[_models.SAPCentralServerInstance] = None, **kwargs: Any - ) -> AsyncLROPoller["_models.SAPCentralServerInstance"]: + ) -> AsyncLROPoller[_models.SAPCentralServerInstance]: """Puts the SAP Central Instance. :code:`
`:code:`
`This will be used by service only. PUT by end user will return a Bad Request error. @@ -206,17 +216,20 @@ async def begin_create( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPCentralServerInstance] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPCentralServerInstance] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, central_instance_name=central_instance_name, @@ -224,20 +237,27 @@ async def begin_create( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SAPCentralServerInstance', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -255,17 +275,20 @@ async def _update_initial( resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, - body: Optional["_models.UpdateSAPCentralInstanceRequest"] = None, + body: Optional[_models.UpdateSAPCentralInstanceRequest] = None, **kwargs: Any - ) -> "_models.SAPCentralServerInstance": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] + ) -> _models.SAPCentralServerInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPCentralServerInstance] if body is not None: _json = self._serialize.body(body, 'UpdateSAPCentralInstanceRequest') @@ -281,11 +304,13 @@ async def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -316,9 +341,9 @@ async def begin_update( resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, - body: Optional["_models.UpdateSAPCentralInstanceRequest"] = None, + body: Optional[_models.UpdateSAPCentralInstanceRequest] = None, **kwargs: Any - ) -> AsyncLROPoller["_models.SAPCentralServerInstance"]: + ) -> AsyncLROPoller[_models.SAPCentralServerInstance]: """Updates the SAP Central Instance. :code:`
`:code:`
`This can be used to update tags. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -344,17 +369,20 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPCentralServerInstance] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPCentralServerInstance] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, central_instance_name=central_instance_name, @@ -362,20 +390,27 @@ async def begin_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SAPCentralServerInstance', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -394,14 +429,17 @@ async def _delete_initial( sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any - ) -> Optional["_models.OperationStatusResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + ) -> Optional[_models.OperationStatusResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.OperationStatusResult]] request = build_delete_request_initial( @@ -411,11 +449,13 @@ async def _delete_initial( central_instance_name=central_instance_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -445,7 +485,7 @@ async def begin_delete( sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.OperationStatusResult"]: + ) -> AsyncLROPoller[_models.OperationStatusResult]: """Deletes the SAP Central Instance. :code:`
`:code:`
`This will be used by service only. Delete by end user will return a Bad Request error. @@ -469,35 +509,45 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatusResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, central_instance_name=central_instance_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -516,7 +566,7 @@ def list( resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SAPCentralInstanceList"]: + ) -> AsyncIterable[_models.SAPCentralInstanceList]: """Lists the SAP Central Instances in an SVI. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -530,13 +580,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.SAPCentralInstanceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPCentralInstanceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralInstanceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -546,9 +599,11 @@ def prepare_request(next_link=None): sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -558,9 +613,11 @@ def prepare_request(next_link=None): sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_database_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_database_instances_operations.py index e13cff2a6c2b..f261c7874e75 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_database_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_database_instances_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,36 +16,36 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request from ...operations._sap_database_instances_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SAPDatabaseInstancesOperations: - """SAPDatabaseInstancesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.aio.WorkloadsClient`'s + :attr:`sap_database_instances` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = 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( @@ -54,7 +54,7 @@ async def get( sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any - ) -> "_models.SAPDatabaseInstance": + ) -> _models.SAPDatabaseInstance: """Gets the SAP Database Instance. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -69,13 +69,16 @@ async def get( :rtype: ~azure.mgmt.workloads.models.SAPDatabaseInstance :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPDatabaseInstance] request = build_get_request( @@ -85,11 +88,13 @@ async def get( database_instance_name=database_instance_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -116,17 +121,20 @@ async def _create_initial( resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, - body: Optional["_models.SAPDatabaseInstance"] = None, + body: Optional[_models.SAPDatabaseInstance] = None, **kwargs: Any - ) -> "_models.SAPDatabaseInstance": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] + ) -> _models.SAPDatabaseInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPDatabaseInstance] if body is not None: _json = self._serialize.body(body, 'SAPDatabaseInstance') @@ -142,11 +150,13 @@ async def _create_initial( content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -177,9 +187,9 @@ async def begin_create( resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, - body: Optional["_models.SAPDatabaseInstance"] = None, + body: Optional[_models.SAPDatabaseInstance] = None, **kwargs: Any - ) -> AsyncLROPoller["_models.SAPDatabaseInstance"]: + ) -> AsyncLROPoller[_models.SAPDatabaseInstance]: """Puts the SAP Database Instance. :code:`
`:code:`
`This will be used by service only. PUT by end user will return a Bad Request error. @@ -205,17 +215,20 @@ async def begin_create( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPDatabaseInstance] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPDatabaseInstance] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, database_instance_name=database_instance_name, @@ -223,20 +236,27 @@ async def begin_create( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SAPDatabaseInstance', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -254,17 +274,20 @@ async def _update_initial( resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, - body: Optional["_models.UpdateSAPDatabaseInstanceRequest"] = None, + body: Optional[_models.UpdateSAPDatabaseInstanceRequest] = None, **kwargs: Any - ) -> "_models.SAPDatabaseInstance": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] + ) -> _models.SAPDatabaseInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPDatabaseInstance] if body is not None: _json = self._serialize.body(body, 'UpdateSAPDatabaseInstanceRequest') @@ -280,11 +303,13 @@ async def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -315,9 +340,9 @@ async def begin_update( resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, - body: Optional["_models.UpdateSAPDatabaseInstanceRequest"] = None, + body: Optional[_models.UpdateSAPDatabaseInstanceRequest] = None, **kwargs: Any - ) -> AsyncLROPoller["_models.SAPDatabaseInstance"]: + ) -> AsyncLROPoller[_models.SAPDatabaseInstance]: """Puts the SAP Database Instance. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -342,17 +367,20 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPDatabaseInstance] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPDatabaseInstance] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, database_instance_name=database_instance_name, @@ -360,20 +388,27 @@ async def begin_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SAPDatabaseInstance', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -392,14 +427,17 @@ async def _delete_initial( sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any - ) -> Optional["_models.OperationStatusResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + ) -> Optional[_models.OperationStatusResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.OperationStatusResult]] request = build_delete_request_initial( @@ -409,11 +447,13 @@ async def _delete_initial( database_instance_name=database_instance_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -443,7 +483,7 @@ async def begin_delete( sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.OperationStatusResult"]: + ) -> AsyncLROPoller[_models.OperationStatusResult]: """Deletes the SAP Database Instance. :code:`
`:code:`
`This will be used by service only. Delete by end user will return a Bad Request error. @@ -467,35 +507,45 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatusResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, database_instance_name=database_instance_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -514,7 +564,7 @@ def list( resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SAPDatabaseInstanceList"]: + ) -> AsyncIterable[_models.SAPDatabaseInstanceList]: """Lists the SAP Database Instances in an SVI. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -528,13 +578,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.SAPDatabaseInstanceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPDatabaseInstanceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstanceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -544,9 +597,11 @@ def prepare_request(next_link=None): sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -556,9 +611,11 @@ def prepare_request(next_link=None): sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_virtual_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_virtual_instances_operations.py index da0c4c108042..becbd2ee8f81 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_virtual_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_virtual_instances_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,52 +16,55 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request from ...operations._sap_virtual_instances_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_start_request_initial, build_stop_request_initial, build_update_request +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SAPVirtualInstancesOperations: - """SAPVirtualInstancesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.aio.WorkloadsClient`'s + :attr:`sap_virtual_instances` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + async def _create_initial( self, resource_group_name: str, sap_virtual_instance_name: str, - body: Optional["_models.SAPVirtualInstance"] = None, + body: Optional[_models.SAPVirtualInstance] = None, **kwargs: Any - ) -> "_models.SAPVirtualInstance": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstance"] + ) -> _models.SAPVirtualInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPVirtualInstance] if body is not None: _json = self._serialize.body(body, 'SAPVirtualInstance') @@ -76,11 +79,13 @@ async def _create_initial( content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -110,9 +115,9 @@ async def begin_create( self, resource_group_name: str, sap_virtual_instance_name: str, - body: Optional["_models.SAPVirtualInstance"] = None, + body: Optional[_models.SAPVirtualInstance] = None, **kwargs: Any - ) -> AsyncLROPoller["_models.SAPVirtualInstance"]: + ) -> AsyncLROPoller[_models.SAPVirtualInstance]: """Creates an Virtual Instance for SAP. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -134,37 +139,47 @@ async def begin_create( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPVirtualInstance] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPVirtualInstance] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstance"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, body=body, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SAPVirtualInstance', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -183,7 +198,7 @@ async def get( resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> "_models.SAPVirtualInstance": + ) -> _models.SAPVirtualInstance: """Gets an Virtual Instance for SAP. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -195,13 +210,16 @@ async def get( :rtype: ~azure.mgmt.workloads.models.SAPVirtualInstance :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstance"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPVirtualInstance] request = build_get_request( @@ -210,11 +228,13 @@ async def get( sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -241,9 +261,9 @@ async def update( self, resource_group_name: str, sap_virtual_instance_name: str, - body: Optional["_models.UpdateSAPVirtualInstanceRequest"] = None, + body: Optional[_models.UpdateSAPVirtualInstanceRequest] = None, **kwargs: Any - ) -> "_models.SAPVirtualInstance": + ) -> _models.SAPVirtualInstance: """Updates an Virtual Instance for SAP. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -257,14 +277,17 @@ async def update( :rtype: ~azure.mgmt.workloads.models.SAPVirtualInstance :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstance"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPVirtualInstance] if body is not None: _json = self._serialize.body(body, 'UpdateSAPVirtualInstanceRequest') @@ -279,11 +302,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -310,14 +335,17 @@ async def _delete_initial( resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> Optional["_models.OperationStatusResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + ) -> Optional[_models.OperationStatusResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.OperationStatusResult]] request = build_delete_request_initial( @@ -326,11 +354,13 @@ async def _delete_initial( sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -359,7 +389,7 @@ async def begin_delete( resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.OperationStatusResult"]: + ) -> AsyncLROPoller[_models.OperationStatusResult]: """Deletes an Virtual Instance for SAP. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -379,34 +409,44 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatusResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -424,7 +464,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SAPVirtualInstanceList"]: + ) -> AsyncIterable[_models.SAPVirtualInstanceList]: """Gets all Virtual Instances for SAP in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -436,13 +476,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.SAPVirtualInstanceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPVirtualInstanceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstanceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -451,9 +494,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -462,9 +507,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -502,7 +549,7 @@ async def get_next(next_link=None): def list_by_subscription( self, **kwargs: Any - ) -> AsyncIterable["_models.SAPVirtualInstanceList"]: + ) -> AsyncIterable[_models.SAPVirtualInstanceList]: """Gets all Virtual Instances for SAP in the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -512,13 +559,16 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.SAPVirtualInstanceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPVirtualInstanceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstanceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -526,9 +576,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -536,9 +588,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -577,14 +631,17 @@ async def _start_initial( resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> Optional["_models.OperationStatusResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + ) -> Optional[_models.OperationStatusResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.OperationStatusResult]] request = build_start_request_initial( @@ -593,11 +650,13 @@ async def _start_initial( sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -626,7 +685,7 @@ async def begin_start( resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.OperationStatusResult"]: + ) -> AsyncLROPoller[_models.OperationStatusResult]: """Starts the SAP System. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -646,34 +705,44 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatusResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -690,17 +759,20 @@ async def _stop_initial( self, resource_group_name: str, sap_virtual_instance_name: str, - body: Optional["_models.StopRequest"] = None, + body: Optional[_models.StopRequest] = None, **kwargs: Any - ) -> Optional["_models.OperationStatusResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + ) -> Optional[_models.OperationStatusResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.OperationStatusResult]] if body is not None: _json = self._serialize.body(body, 'StopRequest') @@ -715,11 +787,13 @@ async def _stop_initial( content_type=content_type, json=_json, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -747,9 +821,9 @@ async def begin_stop( self, resource_group_name: str, sap_virtual_instance_name: str, - body: Optional["_models.StopRequest"] = None, + body: Optional[_models.StopRequest] = None, **kwargs: Any - ) -> AsyncLROPoller["_models.OperationStatusResult"]: + ) -> AsyncLROPoller[_models.OperationStatusResult]: """Stops the SAP System. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -771,37 +845,47 @@ async def begin_stop( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatusResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, body=body, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_skus_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_skus_operations.py index 9096a0722626..391cd20ffb79 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_skus_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_skus_operations.py @@ -14,41 +14,41 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import 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 ..._vendor import _convert_request from ...operations._skus_operations import build_list_request +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SkusOperations: - """SkusOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.aio.WorkloadsClient`'s + :attr:`skus` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = 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.SkusListResult"]: + ) -> AsyncIterable[_models.SkusListResult]: """Lists all the available SKUs under this PR. :keyword callable cls: A custom type or function that will be passed the direct response @@ -56,13 +56,16 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.SkusListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SkusListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SkusListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -70,9 +73,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -80,9 +85,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_wordpress_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_wordpress_instances_operations.py index 1d833807b0f7..09615d0f531b 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_wordpress_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_wordpress_instances_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,36 +16,36 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request from ...operations._wordpress_instances_operations import build_create_or_update_request_initial, build_delete_request, build_get_request, build_list_request +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class WordpressInstancesOperations: - """WordpressInstancesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.aio.WorkloadsClient`'s + :attr:`wordpress_instances` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = 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( @@ -53,7 +53,7 @@ def list( resource_group_name: str, php_workload_name: str, **kwargs: Any - ) -> AsyncIterable["_models.WordpressInstanceResourceList"]: + ) -> AsyncIterable[_models.WordpressInstanceResourceList]: """Lists WordPress instance resources under a phpWorkload resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -67,13 +67,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.WordpressInstanceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.WordpressInstanceResourceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.WordpressInstanceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +86,11 @@ def prepare_request(next_link=None): php_workload_name=php_workload_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +100,11 @@ def prepare_request(next_link=None): php_workload_name=php_workload_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +144,7 @@ async def get( resource_group_name: str, php_workload_name: str, **kwargs: Any - ) -> "_models.WordpressInstanceResource": + ) -> _models.WordpressInstanceResource: """Gets the WordPress instance resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -149,13 +156,16 @@ async def get( :rtype: ~azure.mgmt.workloads.models.WordpressInstanceResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.WordpressInstanceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.WordpressInstanceResource] request = build_get_request( @@ -164,11 +174,13 @@ async def get( php_workload_name=php_workload_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -194,17 +206,20 @@ async def _create_or_update_initial( self, resource_group_name: str, php_workload_name: str, - wordpress_instance_resource: "_models.WordpressInstanceResource", + wordpress_instance_resource: _models.WordpressInstanceResource, **kwargs: Any - ) -> "_models.WordpressInstanceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.WordpressInstanceResource"] + ) -> _models.WordpressInstanceResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.WordpressInstanceResource] _json = self._serialize.body(wordpress_instance_resource, 'WordpressInstanceResource') @@ -216,11 +231,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -250,9 +267,9 @@ async def begin_create_or_update( self, resource_group_name: str, php_workload_name: str, - wordpress_instance_resource: "_models.WordpressInstanceResource", + wordpress_instance_resource: _models.WordpressInstanceResource, **kwargs: Any - ) -> AsyncLROPoller["_models.WordpressInstanceResource"]: + ) -> AsyncLROPoller[_models.WordpressInstanceResource]: """Create or updated WordPress instance resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -275,37 +292,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.WordpressInstanceResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.WordpressInstanceResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.WordpressInstanceResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, php_workload_name=php_workload_name, wordpress_instance_resource=wordpress_instance_resource, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('WordpressInstanceResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -336,13 +363,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -351,11 +381,13 @@ async def delete( # pylint: disable=inconsistent-return-statements php_workload_name=php_workload_name, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_workloads_client_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_workloads_client_operations.py index 205822951ef8..65cbe72f89a7 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_workloads_client_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_workloads_client_operations.py @@ -13,23 +13,25 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._workloads_client_operations import build_sap_availability_zone_details_request, build_sap_disk_configurations_request, build_sap_sizing_recommendations_request, build_sap_supported_sku_request +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class WorkloadsClientOperationsMixin: +class WorkloadsClientOperationsMixin(MixinABC): @distributed_trace_async async def sap_sizing_recommendations( self, location: str, - sap_sizing_recommendation: Optional["_models.SAPSizingRecommendationRequest"] = None, + sap_sizing_recommendation: Optional[_models.SAPSizingRecommendationRequest] = None, **kwargs: Any - ) -> "_models.SAPSizingRecommendationResult": + ) -> _models.SAPSizingRecommendationResult: """Get SAP sizing recommendations. :param location: The name of Azure region. @@ -42,14 +44,17 @@ async def sap_sizing_recommendations( :rtype: ~azure.mgmt.workloads.models.SAPSizingRecommendationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPSizingRecommendationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPSizingRecommendationResult] if sap_sizing_recommendation is not None: _json = self._serialize.body(sap_sizing_recommendation, 'SAPSizingRecommendationRequest') @@ -63,11 +68,13 @@ async def sap_sizing_recommendations( content_type=content_type, json=_json, template_url=self.sap_sizing_recommendations.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -93,9 +100,9 @@ async def sap_sizing_recommendations( async def sap_supported_sku( self, location: str, - sap_supported_sku: Optional["_models.SAPSupportedSkusRequest"] = None, + sap_supported_sku: Optional[_models.SAPSupportedSkusRequest] = None, **kwargs: Any - ) -> "_models.SAPSupportedResourceSkusResult": + ) -> _models.SAPSupportedResourceSkusResult: """Get SAP supported SKUs. :param location: The name of Azure region. @@ -107,14 +114,17 @@ async def sap_supported_sku( :rtype: ~azure.mgmt.workloads.models.SAPSupportedResourceSkusResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPSupportedResourceSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPSupportedResourceSkusResult] if sap_supported_sku is not None: _json = self._serialize.body(sap_supported_sku, 'SAPSupportedSkusRequest') @@ -128,11 +138,13 @@ async def sap_supported_sku( content_type=content_type, json=_json, template_url=self.sap_supported_sku.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -158,9 +170,9 @@ async def sap_supported_sku( async def sap_disk_configurations( self, location: str, - sap_disk_configurations: Optional["_models.SAPDiskConfigurationsRequest"] = None, + sap_disk_configurations: Optional[_models.SAPDiskConfigurationsRequest] = None, **kwargs: Any - ) -> "_models.SAPDiskConfigurationsResult": + ) -> _models.SAPDiskConfigurationsResult: """Get SAP Disk Configurations. :param location: The name of Azure region. @@ -172,14 +184,17 @@ async def sap_disk_configurations( :rtype: ~azure.mgmt.workloads.models.SAPDiskConfigurationsResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDiskConfigurationsResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPDiskConfigurationsResult] if sap_disk_configurations is not None: _json = self._serialize.body(sap_disk_configurations, 'SAPDiskConfigurationsRequest') @@ -193,11 +208,13 @@ async def sap_disk_configurations( content_type=content_type, json=_json, template_url=self.sap_disk_configurations.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -223,9 +240,9 @@ async def sap_disk_configurations( async def sap_availability_zone_details( self, location: str, - sap_availability_zone_details: Optional["_models.SAPAvailabilityZoneDetailsRequest"] = None, + sap_availability_zone_details: Optional[_models.SAPAvailabilityZoneDetailsRequest] = None, **kwargs: Any - ) -> "_models.SAPAvailabilityZoneDetailsResult": + ) -> _models.SAPAvailabilityZoneDetailsResult: """Get SAP Availability Zone Details. :param location: The name of Azure region. @@ -239,14 +256,17 @@ async def sap_availability_zone_details( :rtype: ~azure.mgmt.workloads.models.SAPAvailabilityZoneDetailsResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPAvailabilityZoneDetailsResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPAvailabilityZoneDetailsResult] if sap_availability_zone_details is not None: _json = self._serialize.body(sap_availability_zone_details, 'SAPAvailabilityZoneDetailsRequest') @@ -260,11 +280,13 @@ async def sap_availability_zone_details( content_type=content_type, json=_json, template_url=self.sap_availability_zone_details.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/__init__.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/__init__.py index 232cc6f9e567..373a199523d2 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/__init__.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/__init__.py @@ -186,7 +186,9 @@ WorkloadMonitorActionType, WorkloadMonitorProvisioningState, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'ApplicationServerConfiguration', 'BackupProfile', @@ -365,3 +367,5 @@ 'WorkloadMonitorActionType', 'WorkloadMonitorProvisioningState', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_models_py3.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_models_py3.py index 204f44536439..1ee6e221ab1c 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_models_py3.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_models_py3.py @@ -7,12 +7,14 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._workloads_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class ApplicationServerConfiguration(msrest.serialization.Model): @@ -45,7 +47,7 @@ def __init__( self, *, subnet_id: str, - virtual_machine_configuration: "VirtualMachineConfiguration", + virtual_machine_configuration: "_models.VirtualMachineConfiguration", instance_count: int, **kwargs ): @@ -72,8 +74,8 @@ class BackupProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar backup_enabled: Required. Whether to enable Azure backup for the workload. Possible - values include: "Enabled", "Disabled". + :ivar backup_enabled: Required. Whether to enable Azure backup for the workload. Known values + are: "Enabled", "Disabled". :vartype backup_enabled: str or ~azure.mgmt.workloads.models.EnableBackup :ivar vault_resource_id: Backup vault resource Id. :vartype vault_resource_id: str @@ -92,12 +94,12 @@ class BackupProfile(msrest.serialization.Model): def __init__( self, *, - backup_enabled: Union[str, "EnableBackup"], + backup_enabled: Union[str, "_models.EnableBackup"], **kwargs ): """ - :keyword backup_enabled: Required. Whether to enable Azure backup for the workload. Possible - values include: "Enabled", "Disabled". + :keyword backup_enabled: Required. Whether to enable Azure backup for the workload. Known + values are: "Enabled", "Disabled". :paramtype backup_enabled: str or ~azure.mgmt.workloads.models.EnableBackup """ super(BackupProfile, self).__init__(**kwargs) @@ -116,7 +118,7 @@ class CacheProfile(msrest.serialization.Model): :vartype name: str :ivar sku_name: Required. Cache SKU name. :vartype sku_name: str - :ivar family: Required. Cache family. Possible values include: "C", "P". + :ivar family: Required. Cache family. Known values are: "C", "P". :vartype family: str or ~azure.mgmt.workloads.models.RedisCacheFamily :ivar capacity: Required. Cache capacity. :vartype capacity: long @@ -143,7 +145,7 @@ def __init__( self, *, sku_name: str, - family: Union[str, "RedisCacheFamily"], + family: Union[str, "_models.RedisCacheFamily"], capacity: int, name: Optional[str] = None, **kwargs @@ -153,7 +155,7 @@ def __init__( :paramtype name: str :keyword sku_name: Required. Cache SKU name. :paramtype sku_name: str - :keyword family: Required. Cache family. Possible values include: "C", "P". + :keyword family: Required. Cache family. Known values are: "C", "P". :paramtype family: str or ~azure.mgmt.workloads.models.RedisCacheFamily :keyword capacity: Required. Cache capacity. :paramtype capacity: long @@ -196,7 +198,7 @@ def __init__( self, *, subnet_id: str, - virtual_machine_configuration: "VirtualMachineConfiguration", + virtual_machine_configuration: "_models.VirtualMachineConfiguration", instance_count: int, **kwargs ): @@ -221,8 +223,8 @@ class CentralServerVmDetails(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar type: Defines the type of central server VM. Possible values include: "Primary", - "Secondary", "Unknown", "ASCS", "ERSInactive", "ERS", "Standby". + :ivar type: Defines the type of central server VM. Known values are: "Primary", "Secondary", + "Unknown", "ASCS", "ERSInactive", "ERS", "Standby". :vartype type: str or ~azure.mgmt.workloads.models.CentralServerVirtualMachineType :ivar virtual_machine_id: :vartype virtual_machine_id: str @@ -254,7 +256,7 @@ class DatabaseConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar database_type: The database type. Possible values include: "HANA", "DB2". + :ivar database_type: The database type. Known values are: "HANA", "DB2". :vartype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType :ivar subnet_id: Required. The subnet id. :vartype subnet_id: str @@ -282,13 +284,13 @@ def __init__( self, *, subnet_id: str, - virtual_machine_configuration: "VirtualMachineConfiguration", + virtual_machine_configuration: "_models.VirtualMachineConfiguration", instance_count: int, - database_type: Optional[Union[str, "SAPDatabaseType"]] = None, + database_type: Optional[Union[str, "_models.SAPDatabaseType"]] = None, **kwargs ): """ - :keyword database_type: The database type. Possible values include: "HANA", "DB2". + :keyword database_type: The database type. Known values are: "HANA", "DB2". :paramtype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType :keyword subnet_id: Required. The subnet id. :paramtype subnet_id: str @@ -313,7 +315,7 @@ class DatabaseProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Required. Database type. Possible values include: "MySql". + :ivar type: Required. Database type. Known values are: "MySql". :vartype type: str or ~azure.mgmt.workloads.models.DatabaseType :ivar server_name: Database server name. :vartype server_name: str @@ -321,11 +323,10 @@ class DatabaseProfile(msrest.serialization.Model): :vartype version: str :ivar sku: Required. The name of the server SKU, e.g. Standard_D32s_v4. :vartype sku: str - :ivar tier: Required. Tier of the server SKU. Possible values include: "Burstable", - "GeneralPurpose", "MemoryOptimized". + :ivar tier: Required. Tier of the server SKU. Known values are: "Burstable", "GeneralPurpose", + "MemoryOptimized". :vartype tier: str or ~azure.mgmt.workloads.models.DatabaseTier - :ivar ha_enabled: Whether to enable HA for the server. Possible values include: "Enabled", - "Disabled". + :ivar ha_enabled: Whether to enable HA for the server. Known values are: "Enabled", "Disabled". :vartype ha_enabled: str or ~azure.mgmt.workloads.models.HAEnabled :ivar storage_sku: SKU name for database storage. :vartype storage_sku: str @@ -335,8 +336,8 @@ class DatabaseProfile(msrest.serialization.Model): :vartype storage_iops: long :ivar backup_retention_days: Backup retention days for the server. :vartype backup_retention_days: int - :ivar ssl_enforcement_enabled: Whether to enable SSL enforcement on the database. Possible - values include: "Enabled", "Disabled". + :ivar ssl_enforcement_enabled: Whether to enable SSL enforcement on the database. Known values + are: "Enabled", "Disabled". :vartype ssl_enforcement_enabled: str or ~azure.mgmt.workloads.models.EnableSslEnforcement :ivar server_resource_id: Azure Database Server resource Id. :vartype server_resource_id: str @@ -368,21 +369,21 @@ class DatabaseProfile(msrest.serialization.Model): def __init__( self, *, - type: Union[str, "DatabaseType"], + type: Union[str, "_models.DatabaseType"], sku: str, - tier: Union[str, "DatabaseTier"], + tier: Union[str, "_models.DatabaseTier"], server_name: Optional[str] = None, version: Optional[str] = None, - ha_enabled: Optional[Union[str, "HAEnabled"]] = None, + ha_enabled: Optional[Union[str, "_models.HAEnabled"]] = None, storage_sku: Optional[str] = None, storage_in_gb: Optional[int] = None, storage_iops: Optional[int] = None, backup_retention_days: Optional[int] = None, - ssl_enforcement_enabled: Optional[Union[str, "EnableSslEnforcement"]] = None, + ssl_enforcement_enabled: Optional[Union[str, "_models.EnableSslEnforcement"]] = None, **kwargs ): """ - :keyword type: Required. Database type. Possible values include: "MySql". + :keyword type: Required. Database type. Known values are: "MySql". :paramtype type: str or ~azure.mgmt.workloads.models.DatabaseType :keyword server_name: Database server name. :paramtype server_name: str @@ -390,10 +391,10 @@ def __init__( :paramtype version: str :keyword sku: Required. The name of the server SKU, e.g. Standard_D32s_v4. :paramtype sku: str - :keyword tier: Required. Tier of the server SKU. Possible values include: "Burstable", + :keyword tier: Required. Tier of the server SKU. Known values are: "Burstable", "GeneralPurpose", "MemoryOptimized". :paramtype tier: str or ~azure.mgmt.workloads.models.DatabaseTier - :keyword ha_enabled: Whether to enable HA for the server. Possible values include: "Enabled", + :keyword ha_enabled: Whether to enable HA for the server. Known values are: "Enabled", "Disabled". :paramtype ha_enabled: str or ~azure.mgmt.workloads.models.HAEnabled :keyword storage_sku: SKU name for database storage. @@ -404,8 +405,8 @@ def __init__( :paramtype storage_iops: long :keyword backup_retention_days: Backup retention days for the server. :paramtype backup_retention_days: int - :keyword ssl_enforcement_enabled: Whether to enable SSL enforcement on the database. Possible - values include: "Enabled", "Disabled". + :keyword ssl_enforcement_enabled: Whether to enable SSL enforcement on the database. Known + values are: "Enabled", "Disabled". :paramtype ssl_enforcement_enabled: str or ~azure.mgmt.workloads.models.EnableSslEnforcement """ super(DatabaseProfile, self).__init__(**kwargs) @@ -430,7 +431,7 @@ class DatabaseVmDetails(msrest.serialization.Model): :ivar virtual_machine_id: :vartype virtual_machine_id: str - :ivar status: Defines the SAP Instance status. Possible values include: "Starting", "Running", + :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", "Stopping", "Offline", "PartiallyRunning", "Unavailable". :vartype status: str or ~azure.mgmt.workloads.models.SAPVirtualInstanceStatus """ @@ -609,8 +610,8 @@ class SAPConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar configuration_type: Required. The configuration Type.Constant filled by server. Possible - values include: "Deployment", "Discovery", "DeploymentWithOSConfig". + :ivar configuration_type: Required. The configuration Type.Constant filled by server. Known + values are: "Deployment", "Discovery", "DeploymentWithOSConfig". :vartype configuration_type: str or ~azure.mgmt.workloads.models.SAPConfigurationType """ @@ -641,8 +642,8 @@ class DeploymentConfiguration(SAPConfiguration): All required parameters must be populated in order to send to Azure. - :ivar configuration_type: Required. The configuration Type.Constant filled by server. Possible - values include: "Deployment", "Discovery", "DeploymentWithOSConfig". + :ivar configuration_type: Required. The configuration Type.Constant filled by server. Known + values are: "Deployment", "Discovery", "DeploymentWithOSConfig". :vartype configuration_type: str or ~azure.mgmt.workloads.models.SAPConfigurationType :ivar app_location: The geo-location where the SAP system is to be created. :vartype app_location: str @@ -667,8 +668,8 @@ def __init__( self, *, app_location: Optional[str] = None, - infrastructure_configuration: Optional["InfrastructureConfiguration"] = None, - software_configuration: Optional["SoftwareConfiguration"] = None, + infrastructure_configuration: Optional["_models.InfrastructureConfiguration"] = None, + software_configuration: Optional["_models.SoftwareConfiguration"] = None, **kwargs ): """ @@ -692,8 +693,8 @@ class DeploymentWithOSConfiguration(SAPConfiguration): All required parameters must be populated in order to send to Azure. - :ivar configuration_type: Required. The configuration Type.Constant filled by server. Possible - values include: "Deployment", "Discovery", "DeploymentWithOSConfig". + :ivar configuration_type: Required. The configuration Type.Constant filled by server. Known + values are: "Deployment", "Discovery", "DeploymentWithOSConfig". :vartype configuration_type: str or ~azure.mgmt.workloads.models.SAPConfigurationType :ivar app_location: The geo-location where the SAP system is to be created. :vartype app_location: str @@ -721,9 +722,9 @@ def __init__( self, *, app_location: Optional[str] = None, - infrastructure_configuration: Optional["InfrastructureConfiguration"] = None, - software_configuration: Optional["SoftwareConfiguration"] = None, - os_sap_configuration: Optional["OsSapConfiguration"] = None, + infrastructure_configuration: Optional["_models.InfrastructureConfiguration"] = None, + software_configuration: Optional["_models.SoftwareConfiguration"] = None, + os_sap_configuration: Optional["_models.OsSapConfiguration"] = None, **kwargs ): """ @@ -752,8 +753,8 @@ class DiscoveryConfiguration(SAPConfiguration): All required parameters must be populated in order to send to Azure. - :ivar configuration_type: Required. The configuration Type.Constant filled by server. Possible - values include: "Deployment", "Discovery", "DeploymentWithOSConfig". + :ivar configuration_type: Required. The configuration Type.Constant filled by server. Known + values are: "Deployment", "Discovery", "DeploymentWithOSConfig". :vartype configuration_type: str or ~azure.mgmt.workloads.models.SAPConfigurationType :ivar central_server_vm_id: The virtual machine ID of the Central Server. :vartype central_server_vm_id: str @@ -793,8 +794,8 @@ class DiskInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar storage_type: Required. Storage type. Possible values include: "Premium_LRS", - "Standard_LRS", "StandardSSD_LRS". + :ivar storage_type: Required. Storage type. Known values are: "Premium_LRS", "Standard_LRS", + "StandardSSD_LRS". :vartype storage_type: str or ~azure.mgmt.workloads.models.DiskStorageType :ivar size_in_gb: Disk size in GB. :vartype size_in_gb: long @@ -812,13 +813,13 @@ class DiskInfo(msrest.serialization.Model): def __init__( self, *, - storage_type: Union[str, "DiskStorageType"], + storage_type: Union[str, "_models.DiskStorageType"], size_in_gb: Optional[int] = None, **kwargs ): """ - :keyword storage_type: Required. Storage type. Possible values include: "Premium_LRS", - "Standard_LRS", "StandardSSD_LRS". + :keyword storage_type: Required. Storage type. Known values are: "Premium_LRS", "Standard_LRS", + "StandardSSD_LRS". :paramtype storage_type: str or ~azure.mgmt.workloads.models.DiskStorageType :keyword size_in_gb: Disk size in GB. :paramtype size_in_gb: long @@ -833,7 +834,7 @@ class EnqueueReplicationServerProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar ers_version: Defines the type of Enqueue Replication Server. Possible values include: + :ivar ers_version: Defines the type of Enqueue Replication Server. Known values are: "EnqueueReplicator1", "EnqueueReplicator2". :vartype ers_version: str or ~azure.mgmt.workloads.models.EnqueueReplicationServerType :ivar instance_no: The ERS server instance id. @@ -846,7 +847,7 @@ class EnqueueReplicationServerProperties(msrest.serialization.Model): :vartype kernel_patch: str :ivar ip_address: The ERS server SAP IP Address. :vartype ip_address: str - :ivar health: Defines the SAP Instance health. Possible values include: "Unknown", "Healthy", + :ivar health: Defines the SAP Instance health. Known values are: "Unknown", "Healthy", "Unhealthy", "Degraded". :vartype health: str or ~azure.mgmt.workloads.models.SAPHealthState """ @@ -898,7 +899,7 @@ class EnqueueServerProperties(msrest.serialization.Model): :vartype ip_address: str :ivar port: The enqueue server Port. :vartype port: long - :ivar health: Defines the SAP Instance health. Possible values include: "Unknown", "Healthy", + :ivar health: Defines the SAP Instance health. Known values are: "Unknown", "Healthy", "Unhealthy", "Degraded". :vartype health: str or ~azure.mgmt.workloads.models.SAPHealthState """ @@ -1108,7 +1109,7 @@ class ErrorInnerError(msrest.serialization.Model): def __init__( self, *, - inner_error: Optional["Error"] = None, + inner_error: Optional["_models.Error"] = None, **kwargs ): """ @@ -1133,7 +1134,7 @@ class ErrorResponse(msrest.serialization.Model): def __init__( self, *, - error: Optional["ErrorDetail"] = None, + error: Optional["_models.ErrorDetail"] = None, **kwargs ): """ @@ -1151,10 +1152,9 @@ class FileshareProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar share_type: Required. Share type. Possible values include: "NfsOnController", - "AzureFiles". + :ivar share_type: Required. Share type. Known values are: "NfsOnController", "AzureFiles". :vartype share_type: str or ~azure.mgmt.workloads.models.FileShareType - :ivar storage_type: Required. File share backing storage type. Possible values include: + :ivar storage_type: Required. File share backing storage type. Known values are: "Standard_LRS", "Standard_GRS", "Standard_ZRS", "Premium_LRS". :vartype storage_type: str or ~azure.mgmt.workloads.models.FileShareStorageType :ivar share_size_in_gb: File share size in GB. @@ -1184,16 +1184,15 @@ class FileshareProfile(msrest.serialization.Model): def __init__( self, *, - share_type: Union[str, "FileShareType"], - storage_type: Union[str, "FileShareStorageType"], + share_type: Union[str, "_models.FileShareType"], + storage_type: Union[str, "_models.FileShareStorageType"], share_size_in_gb: Optional[int] = None, **kwargs ): """ - :keyword share_type: Required. Share type. Possible values include: "NfsOnController", - "AzureFiles". + :keyword share_type: Required. Share type. Known values are: "NfsOnController", "AzureFiles". :paramtype share_type: str or ~azure.mgmt.workloads.models.FileShareType - :keyword storage_type: Required. File share backing storage type. Possible values include: + :keyword storage_type: Required. File share backing storage type. Known values are: "Standard_LRS", "Standard_GRS", "Standard_ZRS", "Premium_LRS". :paramtype storage_type: str or ~azure.mgmt.workloads.models.FileShareStorageType :keyword share_size_in_gb: File share size in GB. @@ -1214,7 +1213,7 @@ class GatewayServerProperties(msrest.serialization.Model): :ivar port: The gateway Port. :vartype port: long - :ivar health: Defines the SAP Instance health. Possible values include: "Unknown", "Healthy", + :ivar health: Defines the SAP Instance health. Known values are: "Unknown", "Healthy", "Unhealthy", "Degraded". :vartype health: str or ~azure.mgmt.workloads.models.SAPHealthState """ @@ -1337,7 +1336,7 @@ class HighAvailabilityConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar high_availability_type: Required. The high availability type. Possible values include: + :ivar high_availability_type: Required. The high availability type. Known values are: "AvailabilitySet", "AvailabilityZone". :vartype high_availability_type: str or ~azure.mgmt.workloads.models.SAPHighAvailabilityType """ @@ -1353,11 +1352,11 @@ class HighAvailabilityConfiguration(msrest.serialization.Model): def __init__( self, *, - high_availability_type: Union[str, "SAPHighAvailabilityType"], + high_availability_type: Union[str, "_models.SAPHighAvailabilityType"], **kwargs ): """ - :keyword high_availability_type: Required. The high availability type. Possible values include: + :keyword high_availability_type: Required. The high availability type. Known values are: "AvailabilitySet", "AvailabilityZone". :paramtype high_availability_type: str or ~azure.mgmt.workloads.models.SAPHighAvailabilityType """ @@ -1491,8 +1490,8 @@ class InfrastructureConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar deployment_type: Required. The deployment Type.Constant filled by server. Possible values - include: "SingleServer", "ThreeTier". + :ivar deployment_type: Required. The deployment Type.Constant filled by server. Known values + are: "SingleServer", "ThreeTier". :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType :ivar app_resource_group: Required. The application resource group where SAP system resources will be deployed. @@ -1537,8 +1536,8 @@ class OSConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS Type.Constant filled by server. Possible values include: - "Linux", "Windows". + :ivar os_type: Required. The OS Type.Constant filled by server. Known values are: "Linux", + "Windows". :vartype os_type: str or ~azure.mgmt.workloads.models.OSType """ @@ -1569,8 +1568,8 @@ class LinuxConfiguration(OSConfiguration): All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS Type.Constant filled by server. Possible values include: - "Linux", "Windows". + :ivar os_type: Required. The OS Type.Constant filled by server. Known values are: "Linux", + "Windows". :vartype os_type: str or ~azure.mgmt.workloads.models.OSType :ivar disable_password_authentication: Specifies whether password authentication should be disabled. @@ -1597,8 +1596,8 @@ def __init__( self, *, disable_password_authentication: Optional[bool] = None, - ssh: Optional["SshConfiguration"] = None, - ssh_key_pair: Optional["SshKeyPair"] = None, + ssh: Optional["_models.SshConfiguration"] = None, + ssh_key_pair: Optional["_models.SshKeyPair"] = None, **kwargs ): """ @@ -1660,7 +1659,7 @@ class MessageServerProperties(msrest.serialization.Model): :vartype hostname: str :ivar ip_address: The message server IP Address. :vartype ip_address: str - :ivar health: Defines the SAP Instance health. Possible values include: "Unknown", "Healthy", + :ivar health: Defines the SAP Instance health. Known values are: "Unknown", "Healthy", "Unhealthy", "Degraded". :vartype health: str or ~azure.mgmt.workloads.models.SAPHealthState """ @@ -1829,7 +1828,7 @@ class Monitor(TrackedResource): :vartype location: str :ivar identity: Managed service identity (user assigned identities). :vartype identity: ~azure.mgmt.workloads.models.UserAssignedServiceIdentity - :ivar provisioning_state: State of provisioning of the SAP monitor. Possible values include: + :ivar provisioning_state: State of provisioning of the SAP monitor. Known values are: "Accepted", "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or ~azure.mgmt.workloads.models.WorkloadMonitorProvisioningState @@ -1839,7 +1838,7 @@ class Monitor(TrackedResource): The subnet region should be same as the SAP monitoring region. :vartype app_location: str :ivar routing_preference: Sets the routing preference of the SAP monitor. By default only - RFC1918 traffic is routed to the customer VNET. Possible values include: "Default", "RouteAll". + RFC1918 traffic is routed to the customer VNET. Known values are: "Default", "RouteAll". :vartype routing_preference: str or ~azure.mgmt.workloads.models.RoutingPreference :ivar managed_resource_group_configuration: Managed resource group configuration. :vartype managed_resource_group_configuration: @@ -1887,10 +1886,10 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - identity: Optional["UserAssignedServiceIdentity"] = None, + identity: Optional["_models.UserAssignedServiceIdentity"] = None, app_location: Optional[str] = None, - routing_preference: Optional[Union[str, "RoutingPreference"]] = None, - managed_resource_group_configuration: Optional["ManagedRGConfiguration"] = None, + routing_preference: Optional[Union[str, "_models.RoutingPreference"]] = None, + managed_resource_group_configuration: Optional["_models.ManagedRGConfiguration"] = None, log_analytics_workspace_arm_id: Optional[str] = None, monitor_subnet: Optional[str] = None, **kwargs @@ -1906,7 +1905,7 @@ def __init__( The subnet region should be same as the SAP monitoring region. :paramtype app_location: str :keyword routing_preference: Sets the routing preference of the SAP monitor. By default only - RFC1918 traffic is routed to the customer VNET. Possible values include: "Default", "RouteAll". + RFC1918 traffic is routed to the customer VNET. Known values are: "Default", "RouteAll". :paramtype routing_preference: str or ~azure.mgmt.workloads.models.RoutingPreference :keyword managed_resource_group_configuration: Managed resource group configuration. :paramtype managed_resource_group_configuration: @@ -1946,7 +1945,7 @@ class MonitorListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Monitor"]] = None, + value: Optional[List["_models.Monitor"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -2109,8 +2108,8 @@ class NetworkProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar load_balancer_type: Required. Load balancer type. Possible values include: - "ApplicationGateway", "LoadBalancer". + :ivar load_balancer_type: Required. Load balancer type. Known values are: "ApplicationGateway", + "LoadBalancer". :vartype load_balancer_type: str or ~azure.mgmt.workloads.models.LoadBalancerType :ivar load_balancer_sku: Load balancer SKU. :vartype load_balancer_sku: str @@ -2118,7 +2117,7 @@ class NetworkProfile(msrest.serialization.Model): :vartype load_balancer_tier: str :ivar capacity: Capacity, applicable only for Application Gateway. :vartype capacity: int - :ivar azure_front_door_enabled: Whether to enable Azure front door. Possible values include: + :ivar azure_front_door_enabled: Whether to enable Azure front door. Known values are: "Enabled", "Disabled". :vartype azure_front_door_enabled: str or ~azure.mgmt.workloads.models.AzureFrontDoorEnabled :ivar v_net_resource_id: Virtual network resource Id. @@ -2158,15 +2157,15 @@ class NetworkProfile(msrest.serialization.Model): def __init__( self, *, - load_balancer_type: Union[str, "LoadBalancerType"], + load_balancer_type: Union[str, "_models.LoadBalancerType"], load_balancer_sku: Optional[str] = None, load_balancer_tier: Optional[str] = None, capacity: Optional[int] = None, - azure_front_door_enabled: Optional[Union[str, "AzureFrontDoorEnabled"]] = None, + azure_front_door_enabled: Optional[Union[str, "_models.AzureFrontDoorEnabled"]] = None, **kwargs ): """ - :keyword load_balancer_type: Required. Load balancer type. Possible values include: + :keyword load_balancer_type: Required. Load balancer type. Known values are: "ApplicationGateway", "LoadBalancer". :paramtype load_balancer_type: str or ~azure.mgmt.workloads.models.LoadBalancerType :keyword load_balancer_sku: Load balancer SKU. @@ -2175,7 +2174,7 @@ def __init__( :paramtype load_balancer_tier: str :keyword capacity: Capacity, applicable only for Application Gateway. :paramtype capacity: int - :keyword azure_front_door_enabled: Whether to enable Azure front door. Possible values include: + :keyword azure_front_door_enabled: Whether to enable Azure front door. Known values are: "Enabled", "Disabled". :paramtype azure_front_door_enabled: str or ~azure.mgmt.workloads.models.AzureFrontDoorEnabled """ @@ -2233,10 +2232,10 @@ def __init__( self, *, node_sku: str, - os_image: "OsImageProfile", - os_disk: "DiskInfo", + os_image: "_models.OsImageProfile", + os_disk: "_models.DiskInfo", name: Optional[str] = None, - data_disks: Optional[List["DiskInfo"]] = None, + data_disks: Optional[List["_models.DiskInfo"]] = None, **kwargs ): """ @@ -2274,11 +2273,11 @@ class Operation(msrest.serialization.Model): :ivar display: Localized display information for this particular operation. :vartype display: ~azure.mgmt.workloads.models.OperationDisplay :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", - "system", "user,system". + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + "user,system". :vartype origin: str or ~azure.mgmt.workloads.models.Origin :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Possible values include: "Internal". + internal only APIs. Known values are: "Internal". :vartype action_type: str or ~azure.mgmt.workloads.models.ActionType """ @@ -2300,7 +2299,7 @@ class Operation(msrest.serialization.Model): def __init__( self, *, - display: Optional["OperationDisplay"] = None, + display: Optional["_models.OperationDisplay"] = None, **kwargs ): """ @@ -2413,12 +2412,12 @@ class OperationsContent(Resource): :vartype name_properties_name: str :ivar is_data_action: Indicates whether the operation applies to data-plane. :vartype is_data_action: bool - :ivar origin: Defines the workload operation origin. Possible values include: "NotSpecified", - "User", "System". + :ivar origin: Defines the workload operation origin. Known values are: "NotSpecified", "User", + "System". :vartype origin: str or ~azure.mgmt.workloads.models.OperationProperties :ivar display: Display information of the operation. :vartype display: ~azure.mgmt.workloads.models.OperationsDefinitionDisplay - :ivar action_type: Defines the action type of workload operation. Possible values include: + :ivar action_type: Defines the action type of workload operation. Known values are: "NotSpecified", "Internal". :vartype action_type: str or ~azure.mgmt.workloads.models.WorkloadMonitorActionType :ivar properties: Defines the workload operation properties. @@ -2450,9 +2449,9 @@ def __init__( *, name_properties_name: Optional[str] = None, is_data_action: Optional[bool] = None, - origin: Optional[Union[str, "OperationProperties"]] = None, - display: Optional["OperationsDefinitionDisplay"] = None, - action_type: Optional[Union[str, "WorkloadMonitorActionType"]] = None, + origin: Optional[Union[str, "_models.OperationProperties"]] = None, + display: Optional["_models.OperationsDefinitionDisplay"] = None, + action_type: Optional[Union[str, "_models.WorkloadMonitorActionType"]] = None, properties: Optional[Any] = None, **kwargs ): @@ -2461,12 +2460,12 @@ def __init__( :paramtype name_properties_name: str :keyword is_data_action: Indicates whether the operation applies to data-plane. :paramtype is_data_action: bool - :keyword origin: Defines the workload operation origin. Possible values include: - "NotSpecified", "User", "System". + :keyword origin: Defines the workload operation origin. Known values are: "NotSpecified", + "User", "System". :paramtype origin: str or ~azure.mgmt.workloads.models.OperationProperties :keyword display: Display information of the operation. :paramtype display: ~azure.mgmt.workloads.models.OperationsDefinitionDisplay - :keyword action_type: Defines the action type of workload operation. Possible values include: + :keyword action_type: Defines the action type of workload operation. Known values are: "NotSpecified", "Internal". :paramtype action_type: str or ~azure.mgmt.workloads.models.WorkloadMonitorActionType :keyword properties: Defines the workload operation properties. @@ -2490,12 +2489,12 @@ class OperationsDefinition(msrest.serialization.Model): :vartype name: str :ivar is_data_action: Indicates whether the operation applies to data-plane. :vartype is_data_action: bool - :ivar origin: Defines the workload operation origin. Possible values include: "NotSpecified", - "User", "System". + :ivar origin: Defines the workload operation origin. Known values are: "NotSpecified", "User", + "System". :vartype origin: str or ~azure.mgmt.workloads.models.OperationProperties :ivar display: Required. Display information of the operation. :vartype display: ~azure.mgmt.workloads.models.OperationsDefinitionDisplay - :ivar action_type: Defines the action type of workload operation. Possible values include: + :ivar action_type: Defines the action type of workload operation. Known values are: "NotSpecified", "Internal". :vartype action_type: str or ~azure.mgmt.workloads.models.WorkloadMonitorActionType :ivar properties: Defines the workload operation properties. @@ -2520,10 +2519,10 @@ def __init__( self, *, name: str, - display: "OperationsDefinitionDisplay", + display: "_models.OperationsDefinitionDisplay", is_data_action: Optional[bool] = None, - origin: Optional[Union[str, "OperationProperties"]] = None, - action_type: Optional[Union[str, "WorkloadMonitorActionType"]] = None, + origin: Optional[Union[str, "_models.OperationProperties"]] = None, + action_type: Optional[Union[str, "_models.WorkloadMonitorActionType"]] = None, properties: Optional[Any] = None, **kwargs ): @@ -2532,12 +2531,12 @@ def __init__( :paramtype name: str :keyword is_data_action: Indicates whether the operation applies to data-plane. :paramtype is_data_action: bool - :keyword origin: Defines the workload operation origin. Possible values include: - "NotSpecified", "User", "System". + :keyword origin: Defines the workload operation origin. Known values are: "NotSpecified", + "User", "System". :paramtype origin: str or ~azure.mgmt.workloads.models.OperationProperties :keyword display: Required. Display information of the operation. :paramtype display: ~azure.mgmt.workloads.models.OperationsDefinitionDisplay - :keyword action_type: Defines the action type of workload operation. Possible values include: + :keyword action_type: Defines the action type of workload operation. Known values are: "NotSpecified", "Internal". :paramtype action_type: str or ~azure.mgmt.workloads.models.WorkloadMonitorActionType :keyword properties: Defines the workload operation properties. @@ -2569,7 +2568,7 @@ class OperationsDefinitionArrayResponseWithContinuation(msrest.serialization.Mod def __init__( self, *, - value: Optional[List["OperationsDefinition"]] = None, + value: Optional[List["_models.OperationsDefinition"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -2738,8 +2737,8 @@ def __init__( percent_complete: Optional[float] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, - operations: Optional[List["OperationStatusResult"]] = None, - error: Optional["ErrorDetail"] = None, + operations: Optional[List["_models.OperationStatusResult"]] = None, + error: Optional["_models.ErrorDetail"] = None, **kwargs ): """ @@ -2774,13 +2773,13 @@ def __init__( class OsImageProfile(msrest.serialization.Model): """OS image profile. - :ivar publisher: OS image publisher. Possible values include: "Canonical". + :ivar publisher: OS image publisher. Known values are: "Canonical". :vartype publisher: str or ~azure.mgmt.workloads.models.OSImagePublisher - :ivar offer: OS image offer. Possible values include: "UbuntuServer". + :ivar offer: OS image offer. Known values are: "UbuntuServer". :vartype offer: str or ~azure.mgmt.workloads.models.OSImageOffer - :ivar sku: OS image sku. Possible values include: "18.04-LTS", "16.04-LTS". + :ivar sku: OS image sku. Known values are: "18.04-LTS", "16.04-LTS". :vartype sku: str or ~azure.mgmt.workloads.models.OSImageSku - :ivar version: OS image version. Possible values include: "latest". + :ivar version: OS image version. Known values are: "latest". :vartype version: str or ~azure.mgmt.workloads.models.OSImageVersion """ @@ -2794,20 +2793,20 @@ class OsImageProfile(msrest.serialization.Model): def __init__( self, *, - publisher: Optional[Union[str, "OSImagePublisher"]] = None, - offer: Optional[Union[str, "OSImageOffer"]] = None, - sku: Optional[Union[str, "OSImageSku"]] = None, - version: Optional[Union[str, "OSImageVersion"]] = None, + publisher: Optional[Union[str, "_models.OSImagePublisher"]] = None, + offer: Optional[Union[str, "_models.OSImageOffer"]] = None, + sku: Optional[Union[str, "_models.OSImageSku"]] = None, + version: Optional[Union[str, "_models.OSImageVersion"]] = None, **kwargs ): """ - :keyword publisher: OS image publisher. Possible values include: "Canonical". + :keyword publisher: OS image publisher. Known values are: "Canonical". :paramtype publisher: str or ~azure.mgmt.workloads.models.OSImagePublisher - :keyword offer: OS image offer. Possible values include: "UbuntuServer". + :keyword offer: OS image offer. Known values are: "UbuntuServer". :paramtype offer: str or ~azure.mgmt.workloads.models.OSImageOffer - :keyword sku: OS image sku. Possible values include: "18.04-LTS", "16.04-LTS". + :keyword sku: OS image sku. Known values are: "18.04-LTS", "16.04-LTS". :paramtype sku: str or ~azure.mgmt.workloads.models.OSImageSku - :keyword version: OS image version. Possible values include: "latest". + :keyword version: OS image version. Known values are: "latest". :paramtype version: str or ~azure.mgmt.workloads.models.OSImageVersion """ super(OsImageProfile, self).__init__(**kwargs) @@ -2860,7 +2859,7 @@ def __init__( *, admin_username: Optional[str] = None, admin_password: Optional[str] = None, - os_configuration: Optional["OSConfiguration"] = None, + os_configuration: Optional["_models.OSConfiguration"] = None, **kwargs ): """ @@ -2917,7 +2916,7 @@ class OsSapConfiguration(msrest.serialization.Model): def __init__( self, *, - deployer_vm_packages: Optional["DeployerVmPackages"] = None, + deployer_vm_packages: Optional["_models.DeployerVmPackages"] = None, sap_fqdn: Optional[str] = None, **kwargs ): @@ -2951,7 +2950,7 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - identity: Optional["PatchResourceRequestBodyIdentity"] = None, + identity: Optional["_models.PatchResourceRequestBodyIdentity"] = None, **kwargs ): """ @@ -2970,7 +2969,7 @@ class UserAssignedServiceIdentity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Required. Type of manage identity. Possible values include: "None", "UserAssigned". + :ivar type: Required. Type of manage identity. Known values are: "None", "UserAssigned". :vartype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType :ivar user_assigned_identities: User assigned identities dictionary. :vartype user_assigned_identities: dict[str, ~azure.mgmt.workloads.models.UserAssignedIdentity] @@ -2988,13 +2987,12 @@ class UserAssignedServiceIdentity(msrest.serialization.Model): def __init__( self, *, - type: Union[str, "ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, **kwargs ): """ - :keyword type: Required. Type of manage identity. Possible values include: "None", - "UserAssigned". + :keyword type: Required. Type of manage identity. Known values are: "None", "UserAssigned". :paramtype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType :keyword user_assigned_identities: User assigned identities dictionary. :paramtype user_assigned_identities: dict[str, @@ -3010,7 +3008,7 @@ class PatchResourceRequestBodyIdentity(UserAssignedServiceIdentity): All required parameters must be populated in order to send to Azure. - :ivar type: Required. Type of manage identity. Possible values include: "None", "UserAssigned". + :ivar type: Required. Type of manage identity. Known values are: "None", "UserAssigned". :vartype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType :ivar user_assigned_identities: User assigned identities dictionary. :vartype user_assigned_identities: dict[str, ~azure.mgmt.workloads.models.UserAssignedIdentity] @@ -3028,13 +3026,12 @@ class PatchResourceRequestBodyIdentity(UserAssignedServiceIdentity): def __init__( self, *, - type: Union[str, "ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, **kwargs ): """ - :keyword type: Required. Type of manage identity. Possible values include: "None", - "UserAssigned". + :keyword type: Required. Type of manage identity. Known values are: "None", "UserAssigned". :paramtype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType :keyword user_assigned_identities: User assigned identities dictionary. :paramtype user_assigned_identities: dict[str, @@ -3048,7 +3045,7 @@ class PhpProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar version: Required. PHP version. Possible values include: "7.2", "7.3", "7.4". + :ivar version: Required. PHP version. Known values are: "7.2", "7.3", "7.4". :vartype version: str or ~azure.mgmt.workloads.models.PHPVersion """ @@ -3063,11 +3060,11 @@ class PhpProfile(msrest.serialization.Model): def __init__( self, *, - version: Union[str, "PHPVersion"], + version: Union[str, "_models.PHPVersion"], **kwargs ): """ - :keyword version: Required. PHP version. Possible values include: "7.2", "7.3", "7.4". + :keyword version: Required. PHP version. Known values are: "7.2", "7.3", "7.4". :paramtype version: str or ~azure.mgmt.workloads.models.PHPVersion """ super(PhpProfile, self).__init__(**kwargs) @@ -3097,7 +3094,7 @@ class PhpWorkloadResource(TrackedResource): :ivar location: Required. The geo-location where the resource lives. :vartype location: str :ivar kind: Required. Indicates which kind of php workload this resource represent e.g - WordPress. Possible values include: "WordPress". + WordPress. Known values are: "WordPress". :vartype kind: str or ~azure.mgmt.workloads.models.WorkloadKind :ivar sku: Php workloads SKU. :vartype sku: ~azure.mgmt.workloads.models.Sku @@ -3131,7 +3128,7 @@ class PhpWorkloadResource(TrackedResource): :vartype cache_profile: ~azure.mgmt.workloads.models.CacheProfile :ivar backup_profile: Backup profile. :vartype backup_profile: ~azure.mgmt.workloads.models.BackupProfile - :ivar provisioning_state: Php workload resource provisioning state. Possible values include: + :ivar provisioning_state: Php workload resource provisioning state. Known values are: "NotSpecified", "Accepted", "Created", "Succeeded", "Failed", "Canceled", "Provisioning", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.workloads.models.PhpWorkloadProvisioningState @@ -3177,23 +3174,23 @@ def __init__( self, *, location: str, - kind: Union[str, "WorkloadKind"], + kind: Union[str, "_models.WorkloadKind"], tags: Optional[Dict[str, str]] = None, - sku: Optional["Sku"] = None, - identity: Optional["PhpWorkloadResourceIdentity"] = None, + sku: Optional["_models.Sku"] = None, + identity: Optional["_models.PhpWorkloadResourceIdentity"] = None, app_location: Optional[str] = None, - managed_resource_group_configuration: Optional["ManagedRGConfiguration"] = None, - admin_user_profile: Optional["UserProfile"] = None, - web_nodes_profile: Optional["VmssNodesProfile"] = None, - controller_profile: Optional["NodeProfile"] = None, - network_profile: Optional["NetworkProfile"] = None, - database_profile: Optional["DatabaseProfile"] = None, - site_profile: Optional["SiteProfile"] = None, - fileshare_profile: Optional["FileshareProfile"] = None, - php_profile: Optional["PhpProfile"] = None, - search_profile: Optional["SearchProfile"] = None, - cache_profile: Optional["CacheProfile"] = None, - backup_profile: Optional["BackupProfile"] = None, + managed_resource_group_configuration: Optional["_models.ManagedRGConfiguration"] = None, + admin_user_profile: Optional["_models.UserProfile"] = None, + web_nodes_profile: Optional["_models.VmssNodesProfile"] = None, + controller_profile: Optional["_models.NodeProfile"] = None, + network_profile: Optional["_models.NetworkProfile"] = None, + database_profile: Optional["_models.DatabaseProfile"] = None, + site_profile: Optional["_models.SiteProfile"] = None, + fileshare_profile: Optional["_models.FileshareProfile"] = None, + php_profile: Optional["_models.PhpProfile"] = None, + search_profile: Optional["_models.SearchProfile"] = None, + cache_profile: Optional["_models.CacheProfile"] = None, + backup_profile: Optional["_models.BackupProfile"] = None, **kwargs ): """ @@ -3202,7 +3199,7 @@ def __init__( :keyword location: Required. The geo-location where the resource lives. :paramtype location: str :keyword kind: Required. Indicates which kind of php workload this resource represent e.g - WordPress. Possible values include: "WordPress". + WordPress. Known values are: "WordPress". :paramtype kind: str or ~azure.mgmt.workloads.models.WorkloadKind :keyword sku: Php workloads SKU. :paramtype sku: ~azure.mgmt.workloads.models.Sku @@ -3262,7 +3259,7 @@ class PhpWorkloadResourceIdentity(UserAssignedServiceIdentity): All required parameters must be populated in order to send to Azure. - :ivar type: Required. Type of manage identity. Possible values include: "None", "UserAssigned". + :ivar type: Required. Type of manage identity. Known values are: "None", "UserAssigned". :vartype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType :ivar user_assigned_identities: User assigned identities dictionary. :vartype user_assigned_identities: dict[str, ~azure.mgmt.workloads.models.UserAssignedIdentity] @@ -3280,13 +3277,12 @@ class PhpWorkloadResourceIdentity(UserAssignedServiceIdentity): def __init__( self, *, - type: Union[str, "ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, **kwargs ): """ - :keyword type: Required. Type of manage identity. Possible values include: "None", - "UserAssigned". + :keyword type: Required. Type of manage identity. Known values are: "None", "UserAssigned". :paramtype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType :keyword user_assigned_identities: User assigned identities dictionary. :paramtype user_assigned_identities: dict[str, @@ -3312,7 +3308,7 @@ class PhpWorkloadResourceList(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PhpWorkloadResource"]] = None, + value: Optional[List["_models.PhpWorkloadResource"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -3479,8 +3475,8 @@ class ProviderInstance(ProxyResource): :vartype system_data: ~azure.mgmt.workloads.models.SystemData :ivar identity: Managed service identity (user assigned identities). :vartype identity: ~azure.mgmt.workloads.models.UserAssignedServiceIdentity - :ivar provisioning_state: State of provisioning of the provider instance. Possible values - include: "Accepted", "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". + :ivar provisioning_state: State of provisioning of the provider instance. Known values are: + "Accepted", "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". :vartype provisioning_state: str or ~azure.mgmt.workloads.models.WorkloadMonitorProvisioningState :ivar errors: Defines the provider instance errors. @@ -3512,8 +3508,8 @@ class ProviderInstance(ProxyResource): def __init__( self, *, - identity: Optional["UserAssignedServiceIdentity"] = None, - provider_settings: Optional["ProviderSpecificProperties"] = None, + identity: Optional["_models.UserAssignedServiceIdentity"] = None, + provider_settings: Optional["_models.ProviderSpecificProperties"] = None, **kwargs ): """ @@ -3546,7 +3542,7 @@ class ProviderInstanceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ProviderInstance"]] = None, + value: Optional[List["_models.ProviderInstance"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -3678,14 +3674,14 @@ class SAPApplicationServerInstance(TrackedResource): :vartype icm_https_port: long :ivar virtual_machine_id: The virtual machine. :vartype virtual_machine_id: str - :ivar status: Defines the SAP Instance status. Possible values include: "Starting", "Running", + :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", "Stopping", "Offline", "PartiallyRunning", "Unavailable". :vartype status: str or ~azure.mgmt.workloads.models.SAPVirtualInstanceStatus - :ivar health: Defines the SAP Instance health. Possible values include: "Unknown", "Healthy", + :ivar health: Defines the SAP Instance health. Known values are: "Unknown", "Healthy", "Unhealthy", "Degraded". :vartype health: str or ~azure.mgmt.workloads.models.SAPHealthState - :ivar provisioning_state: Defines the provisioning states. Possible values include: - "Succeeded", "Updating", "Creating", "Failed", "Deleting". + :ivar provisioning_state: Defines the provisioning states. Known values are: "Succeeded", + "Updating", "Creating", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.workloads.models.SapVirtualInstanceProvisioningState :ivar errors: Defines the Application Instance errors. @@ -3784,7 +3780,7 @@ class SAPApplicationServerInstanceList(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["SAPApplicationServerInstance"]] = None, + value: Optional[List["_models.SAPApplicationServerInstance"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -3806,11 +3802,11 @@ class SAPAvailabilityZoneDetailsRequest(msrest.serialization.Model): :ivar app_location: Required. The geo-location where the SAP resources will be created. :vartype app_location: str - :ivar sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", - "S4HANA", "Other". + :ivar sap_product: Required. Defines the SAP Product type. Known values are: "ECC", "S4HANA", + "Other". :vartype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType - :ivar database_type: Required. The database type. Eg: HANA, DB2, etc. Possible values include: - "HANA", "DB2". + :ivar database_type: Required. The database type. Eg: HANA, DB2, etc. Known values are: "HANA", + "DB2". :vartype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType """ @@ -3830,18 +3826,18 @@ def __init__( self, *, app_location: str, - sap_product: Union[str, "SAPProductType"], - database_type: Union[str, "SAPDatabaseType"], + sap_product: Union[str, "_models.SAPProductType"], + database_type: Union[str, "_models.SAPDatabaseType"], **kwargs ): """ :keyword app_location: Required. The geo-location where the SAP resources will be created. :paramtype app_location: str - :keyword sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", + :keyword sap_product: Required. Defines the SAP Product type. Known values are: "ECC", "S4HANA", "Other". :paramtype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType - :keyword database_type: Required. The database type. Eg: HANA, DB2, etc. Possible values - include: "HANA", "DB2". + :keyword database_type: Required. The database type. Eg: HANA, DB2, etc. Known values are: + "HANA", "DB2". :paramtype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType """ super(SAPAvailabilityZoneDetailsRequest, self).__init__(**kwargs) @@ -3864,7 +3860,7 @@ class SAPAvailabilityZoneDetailsResult(msrest.serialization.Model): def __init__( self, *, - availability_zone_pairs: Optional[List["SAPAvailabilityZonePair"]] = None, + availability_zone_pairs: Optional[List["_models.SAPAvailabilityZonePair"]] = None, **kwargs ): """ @@ -3924,7 +3920,7 @@ class SAPCentralInstanceList(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["SAPCentralServerInstance"]] = None, + value: Optional[List["_models.SAPCentralServerInstance"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -3980,14 +3976,14 @@ class SAPCentralServerInstance(TrackedResource): :vartype kernel_patch: str :ivar vm_details: The list of virtual machines. :vartype vm_details: list[~azure.mgmt.workloads.models.CentralServerVmDetails] - :ivar status: Defines the SAP Instance status. Possible values include: "Starting", "Running", + :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", "Stopping", "Offline", "PartiallyRunning", "Unavailable". :vartype status: str or ~azure.mgmt.workloads.models.SAPVirtualInstanceStatus - :ivar health: Defines the SAP Instance health. Possible values include: "Unknown", "Healthy", + :ivar health: Defines the SAP Instance health. Known values are: "Unknown", "Healthy", "Unhealthy", "Degraded". :vartype health: str or ~azure.mgmt.workloads.models.SAPHealthState - :ivar provisioning_state: Defines the provisioning states. Possible values include: - "Succeeded", "Updating", "Creating", "Failed", "Deleting". + :ivar provisioning_state: Defines the provisioning states. Known values are: "Succeeded", + "Updating", "Creating", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.workloads.models.SapVirtualInstanceProvisioningState :ivar errors: Defines the Central Instance errors. @@ -4038,10 +4034,10 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - message_server_properties: Optional["MessageServerProperties"] = None, - enqueue_server_properties: Optional["EnqueueServerProperties"] = None, - gateway_server_properties: Optional["GatewayServerProperties"] = None, - enqueue_replication_server_properties: Optional["EnqueueReplicationServerProperties"] = None, + message_server_properties: Optional["_models.MessageServerProperties"] = None, + enqueue_server_properties: Optional["_models.EnqueueServerProperties"] = None, + gateway_server_properties: Optional["_models.GatewayServerProperties"] = None, + enqueue_replication_server_properties: Optional["_models.EnqueueReplicationServerProperties"] = None, **kwargs ): """ @@ -4107,11 +4103,11 @@ class SAPDatabaseInstance(TrackedResource): :vartype ip_address: str :ivar vm_details: The list of virtual machines. :vartype vm_details: list[~azure.mgmt.workloads.models.DatabaseVmDetails] - :ivar status: Defines the SAP Instance status. Possible values include: "Starting", "Running", + :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", "Stopping", "Offline", "PartiallyRunning", "Unavailable". :vartype status: str or ~azure.mgmt.workloads.models.SAPVirtualInstanceStatus - :ivar provisioning_state: Defines the provisioning states. Possible values include: - "Succeeded", "Updating", "Creating", "Failed", "Deleting". + :ivar provisioning_state: Defines the provisioning states. Known values are: "Succeeded", + "Updating", "Creating", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.workloads.models.SapVirtualInstanceProvisioningState :ivar errors: Defines the Database Instance errors. @@ -4192,7 +4188,7 @@ class SAPDatabaseInstanceList(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["SAPDatabaseInstance"]] = None, + value: Optional[List["_models.SAPDatabaseInstance"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -4281,17 +4277,17 @@ class SAPDiskConfigurationsRequest(msrest.serialization.Model): :ivar app_location: Required. The geo-location where the SAP resources will be created. :vartype app_location: str - :ivar environment: Required. Defines the environment type - Production/Non Production. Possible - values include: "NonProd", "Prod". + :ivar environment: Required. Defines the environment type - Production/Non Production. Known + values are: "NonProd", "Prod". :vartype environment: str or ~azure.mgmt.workloads.models.SAPEnvironmentType - :ivar sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", - "S4HANA", "Other". + :ivar sap_product: Required. Defines the SAP Product type. Known values are: "ECC", "S4HANA", + "Other". :vartype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType - :ivar database_type: Required. The database type. Eg: HANA, DB2, etc. Possible values include: - "HANA", "DB2". + :ivar database_type: Required. The database type. Eg: HANA, DB2, etc. Known values are: "HANA", + "DB2". :vartype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType - :ivar deployment_type: Required. The deployment type. Eg: SingleServer/ThreeTier. Possible - values include: "SingleServer", "ThreeTier". + :ivar deployment_type: Required. The deployment type. Eg: SingleServer/ThreeTier. Known values + are: "SingleServer", "ThreeTier". :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType :ivar db_vm_sku: Required. The VM SKU for database instance. :vartype db_vm_sku: str @@ -4319,27 +4315,27 @@ def __init__( self, *, app_location: str, - environment: Union[str, "SAPEnvironmentType"], - sap_product: Union[str, "SAPProductType"], - database_type: Union[str, "SAPDatabaseType"], - deployment_type: Union[str, "SAPDeploymentType"], + environment: Union[str, "_models.SAPEnvironmentType"], + sap_product: Union[str, "_models.SAPProductType"], + database_type: Union[str, "_models.SAPDatabaseType"], + deployment_type: Union[str, "_models.SAPDeploymentType"], db_vm_sku: str, **kwargs ): """ :keyword app_location: Required. The geo-location where the SAP resources will be created. :paramtype app_location: str - :keyword environment: Required. Defines the environment type - Production/Non Production. - Possible values include: "NonProd", "Prod". + :keyword environment: Required. Defines the environment type - Production/Non Production. Known + values are: "NonProd", "Prod". :paramtype environment: str or ~azure.mgmt.workloads.models.SAPEnvironmentType - :keyword sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", + :keyword sap_product: Required. Defines the SAP Product type. Known values are: "ECC", "S4HANA", "Other". :paramtype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType - :keyword database_type: Required. The database type. Eg: HANA, DB2, etc. Possible values - include: "HANA", "DB2". + :keyword database_type: Required. The database type. Eg: HANA, DB2, etc. Known values are: + "HANA", "DB2". :paramtype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType - :keyword deployment_type: Required. The deployment type. Eg: SingleServer/ThreeTier. Possible - values include: "SingleServer", "ThreeTier". + :keyword deployment_type: Required. The deployment type. Eg: SingleServer/ThreeTier. Known + values are: "SingleServer", "ThreeTier". :paramtype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType :keyword db_vm_sku: Required. The VM SKU for database instance. :paramtype db_vm_sku: str @@ -4367,7 +4363,7 @@ class SAPDiskConfigurationsResult(msrest.serialization.Model): def __init__( self, *, - disk_configurations: Optional[List["SAPDiskConfiguration"]] = None, + disk_configurations: Optional[List["_models.SAPDiskConfiguration"]] = None, **kwargs ): """ @@ -4387,7 +4383,7 @@ class SoftwareConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar software_installation_type: Required. The SAP software installation Type.Constant filled - by server. Possible values include: "ServiceInitiated", "SAPInstallWithoutOSConfig". + by server. Known values are: "ServiceInitiated", "SAPInstallWithoutOSConfig". :vartype software_installation_type: str or ~azure.mgmt.workloads.models.SAPSoftwareInstallationType """ @@ -4420,7 +4416,7 @@ class SAPInstallWithoutOSConfigSoftwareConfiguration(SoftwareConfiguration): All required parameters must be populated in order to send to Azure. :ivar software_installation_type: Required. The SAP software installation Type.Constant filled - by server. Possible values include: "ServiceInitiated", "SAPInstallWithoutOSConfig". + by server. Known values are: "ServiceInitiated", "SAPInstallWithoutOSConfig". :vartype software_installation_type: str or ~azure.mgmt.workloads.models.SAPSoftwareInstallationType :ivar bom_url: Required. The URL to the SAP Build of Materials(BOM) file. @@ -4455,7 +4451,7 @@ def __init__( bom_url: str, sap_bits_storage_account_id: str, software_version: str, - high_availability_software_configuration: Optional["HighAvailabilitySoftwareConfiguration"] = None, + high_availability_software_configuration: Optional["_models.HighAvailabilitySoftwareConfiguration"] = None, **kwargs ): """ @@ -4584,25 +4580,25 @@ class SAPSizingRecommendationRequest(msrest.serialization.Model): :ivar app_location: Required. The geo-location where the resource is to be created. :vartype app_location: str - :ivar environment: Required. Defines the environment type - Production/Non Production. Possible - values include: "NonProd", "Prod". + :ivar environment: Required. Defines the environment type - Production/Non Production. Known + values are: "NonProd", "Prod". :vartype environment: str or ~azure.mgmt.workloads.models.SAPEnvironmentType - :ivar sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", - "S4HANA", "Other". + :ivar sap_product: Required. Defines the SAP Product type. Known values are: "ECC", "S4HANA", + "Other". :vartype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType - :ivar deployment_type: Required. The deployment type. Eg: SingleServer/ThreeTier. Possible - values include: "SingleServer", "ThreeTier". + :ivar deployment_type: Required. The deployment type. Eg: SingleServer/ThreeTier. Known values + are: "SingleServer", "ThreeTier". :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType :ivar saps: Required. The SAP Application Performance Standard measurement. :vartype saps: long :ivar db_memory: Required. The database memory configuration. :vartype db_memory: long - :ivar database_type: Required. The database type. Possible values include: "HANA", "DB2". + :ivar database_type: Required. The database type. Known values are: "HANA", "DB2". :vartype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType - :ivar db_scale_method: The DB scale method. Possible values include: "ScaleUp". + :ivar db_scale_method: The DB scale method. Known values are: "ScaleUp". :vartype db_scale_method: str or ~azure.mgmt.workloads.models.SAPDatabaseScaleMethod - :ivar high_availability_type: The high availability type. Possible values include: - "AvailabilitySet", "AvailabilityZone". + :ivar high_availability_type: The high availability type. Known values are: "AvailabilitySet", + "AvailabilityZone". :vartype high_availability_type: str or ~azure.mgmt.workloads.models.SAPHighAvailabilityType """ @@ -4632,37 +4628,37 @@ def __init__( self, *, app_location: str, - environment: Union[str, "SAPEnvironmentType"], - sap_product: Union[str, "SAPProductType"], - deployment_type: Union[str, "SAPDeploymentType"], + environment: Union[str, "_models.SAPEnvironmentType"], + sap_product: Union[str, "_models.SAPProductType"], + deployment_type: Union[str, "_models.SAPDeploymentType"], saps: int, db_memory: int, - database_type: Union[str, "SAPDatabaseType"], - db_scale_method: Optional[Union[str, "SAPDatabaseScaleMethod"]] = None, - high_availability_type: Optional[Union[str, "SAPHighAvailabilityType"]] = None, + database_type: Union[str, "_models.SAPDatabaseType"], + db_scale_method: Optional[Union[str, "_models.SAPDatabaseScaleMethod"]] = None, + high_availability_type: Optional[Union[str, "_models.SAPHighAvailabilityType"]] = None, **kwargs ): """ :keyword app_location: Required. The geo-location where the resource is to be created. :paramtype app_location: str - :keyword environment: Required. Defines the environment type - Production/Non Production. - Possible values include: "NonProd", "Prod". + :keyword environment: Required. Defines the environment type - Production/Non Production. Known + values are: "NonProd", "Prod". :paramtype environment: str or ~azure.mgmt.workloads.models.SAPEnvironmentType - :keyword sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", + :keyword sap_product: Required. Defines the SAP Product type. Known values are: "ECC", "S4HANA", "Other". :paramtype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType - :keyword deployment_type: Required. The deployment type. Eg: SingleServer/ThreeTier. Possible - values include: "SingleServer", "ThreeTier". + :keyword deployment_type: Required. The deployment type. Eg: SingleServer/ThreeTier. Known + values are: "SingleServer", "ThreeTier". :paramtype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType :keyword saps: Required. The SAP Application Performance Standard measurement. :paramtype saps: long :keyword db_memory: Required. The database memory configuration. :paramtype db_memory: long - :keyword database_type: Required. The database type. Possible values include: "HANA", "DB2". + :keyword database_type: Required. The database type. Known values are: "HANA", "DB2". :paramtype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType - :keyword db_scale_method: The DB scale method. Possible values include: "ScaleUp". + :keyword db_scale_method: The DB scale method. Known values are: "ScaleUp". :paramtype db_scale_method: str or ~azure.mgmt.workloads.models.SAPDatabaseScaleMethod - :keyword high_availability_type: The high availability type. Possible values include: + :keyword high_availability_type: The high availability type. Known values are: "AvailabilitySet", "AvailabilityZone". :paramtype high_availability_type: str or ~azure.mgmt.workloads.models.SAPHighAvailabilityType """ @@ -4686,8 +4682,8 @@ class SAPSizingRecommendationResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar deployment_type: Required. The deployment Type.Constant filled by server. Possible values - include: "SingleServer", "ThreeTier". + :ivar deployment_type: Required. The deployment Type.Constant filled by server. Known values + are: "SingleServer", "ThreeTier". :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType """ @@ -4727,7 +4723,7 @@ class SAPSupportedResourceSkusResult(msrest.serialization.Model): def __init__( self, *, - supported_skus: Optional[List["SAPSupportedSku"]] = None, + supported_skus: Optional[List["_models.SAPSupportedSku"]] = None, **kwargs ): """ @@ -4787,20 +4783,20 @@ class SAPSupportedSkusRequest(msrest.serialization.Model): :ivar app_location: Required. The geo-location where the resource is to be created. :vartype app_location: str - :ivar environment: Required. Defines the environment type - Production/Non Production. Possible - values include: "NonProd", "Prod". + :ivar environment: Required. Defines the environment type - Production/Non Production. Known + values are: "NonProd", "Prod". :vartype environment: str or ~azure.mgmt.workloads.models.SAPEnvironmentType - :ivar sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", - "S4HANA", "Other". + :ivar sap_product: Required. Defines the SAP Product type. Known values are: "ECC", "S4HANA", + "Other". :vartype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType - :ivar deployment_type: Required. The deployment type. Eg: SingleServer/ThreeTier. Possible - values include: "SingleServer", "ThreeTier". + :ivar deployment_type: Required. The deployment type. Eg: SingleServer/ThreeTier. Known values + are: "SingleServer", "ThreeTier". :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType - :ivar database_type: Required. The database type. Eg: HANA, DB2, etc. Possible values include: - "HANA", "DB2". + :ivar database_type: Required. The database type. Eg: HANA, DB2, etc. Known values are: "HANA", + "DB2". :vartype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType - :ivar high_availability_type: The high availability type. Possible values include: - "AvailabilitySet", "AvailabilityZone". + :ivar high_availability_type: The high availability type. Known values are: "AvailabilitySet", + "AvailabilityZone". :vartype high_availability_type: str or ~azure.mgmt.workloads.models.SAPHighAvailabilityType """ @@ -4825,29 +4821,29 @@ def __init__( self, *, app_location: str, - environment: Union[str, "SAPEnvironmentType"], - sap_product: Union[str, "SAPProductType"], - deployment_type: Union[str, "SAPDeploymentType"], - database_type: Union[str, "SAPDatabaseType"], - high_availability_type: Optional[Union[str, "SAPHighAvailabilityType"]] = None, + environment: Union[str, "_models.SAPEnvironmentType"], + sap_product: Union[str, "_models.SAPProductType"], + deployment_type: Union[str, "_models.SAPDeploymentType"], + database_type: Union[str, "_models.SAPDatabaseType"], + high_availability_type: Optional[Union[str, "_models.SAPHighAvailabilityType"]] = None, **kwargs ): """ :keyword app_location: Required. The geo-location where the resource is to be created. :paramtype app_location: str - :keyword environment: Required. Defines the environment type - Production/Non Production. - Possible values include: "NonProd", "Prod". + :keyword environment: Required. Defines the environment type - Production/Non Production. Known + values are: "NonProd", "Prod". :paramtype environment: str or ~azure.mgmt.workloads.models.SAPEnvironmentType - :keyword sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", + :keyword sap_product: Required. Defines the SAP Product type. Known values are: "ECC", "S4HANA", "Other". :paramtype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType - :keyword deployment_type: Required. The deployment type. Eg: SingleServer/ThreeTier. Possible - values include: "SingleServer", "ThreeTier". + :keyword deployment_type: Required. The deployment type. Eg: SingleServer/ThreeTier. Known + values are: "SingleServer", "ThreeTier". :paramtype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType - :keyword database_type: Required. The database type. Eg: HANA, DB2, etc. Possible values - include: "HANA", "DB2". + :keyword database_type: Required. The database type. Eg: HANA, DB2, etc. Known values are: + "HANA", "DB2". :paramtype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType - :keyword high_availability_type: The high availability type. Possible values include: + :keyword high_availability_type: The high availability type. Known values are: "AvailabilitySet", "AvailabilityZone". :paramtype high_availability_type: str or ~azure.mgmt.workloads.models.SAPHighAvailabilityType """ @@ -4884,11 +4880,11 @@ class SAPVirtualInstance(TrackedResource): :vartype location: str :ivar identity: Managed service identity (user assigned identities). :vartype identity: ~azure.mgmt.workloads.models.UserAssignedServiceIdentity - :ivar environment: Required. Defines the environment type - Production/Non Production. Possible - values include: "NonProd", "Prod". + :ivar environment: Required. Defines the environment type - Production/Non Production. Known + values are: "NonProd", "Prod". :vartype environment: str or ~azure.mgmt.workloads.models.SAPEnvironmentType - :ivar sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", - "S4HANA", "Other". + :ivar sap_product: Required. Defines the SAP Product type. Known values are: "ECC", "S4HANA", + "Other". :vartype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType :ivar configuration: Required. Defines if an existing SAP system is being registered or a new SAP system is being created. @@ -4896,20 +4892,20 @@ class SAPVirtualInstance(TrackedResource): :ivar managed_resource_group_configuration: Managed resource group configuration. :vartype managed_resource_group_configuration: ~azure.mgmt.workloads.models.ManagedRGConfiguration - :ivar status: Defines the SAP Instance status. Possible values include: "Starting", "Running", + :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", "Stopping", "Offline", "PartiallyRunning", "Unavailable". :vartype status: str or ~azure.mgmt.workloads.models.SAPVirtualInstanceStatus - :ivar health: Defines the SAP Instance health. Possible values include: "Unknown", "Healthy", + :ivar health: Defines the SAP Instance health. Known values are: "Unknown", "Healthy", "Unhealthy", "Degraded". :vartype health: str or ~azure.mgmt.workloads.models.SAPHealthState - :ivar state: Defines the Virtual Instance for SAP state. Possible values include: + :ivar state: Defines the Virtual Instance for SAP state. Known values are: "InfrastructureDeploymentPending", "InfrastructureDeploymentInProgress", "InfrastructureDeploymentFailed", "SoftwareInstallationPending", "SoftwareInstallationInProgress", "SoftwareInstallationFailed", "DiscoveryPending", "DiscoveryInProgress", "DiscoveryFailed", "RegistrationComplete". :vartype state: str or ~azure.mgmt.workloads.models.SAPVirtualInstanceState - :ivar provisioning_state: Defines the provisioning states. Possible values include: - "Succeeded", "Updating", "Creating", "Failed", "Deleting". + :ivar provisioning_state: Defines the provisioning states. Known values are: "Succeeded", + "Updating", "Creating", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.workloads.models.SapVirtualInstanceProvisioningState :ivar errors: Defines the Virtual Instance for SAP errors. @@ -4955,12 +4951,12 @@ def __init__( self, *, location: str, - environment: Union[str, "SAPEnvironmentType"], - sap_product: Union[str, "SAPProductType"], - configuration: "SAPConfiguration", + environment: Union[str, "_models.SAPEnvironmentType"], + sap_product: Union[str, "_models.SAPProductType"], + configuration: "_models.SAPConfiguration", tags: Optional[Dict[str, str]] = None, - identity: Optional["UserAssignedServiceIdentity"] = None, - managed_resource_group_configuration: Optional["ManagedRGConfiguration"] = None, + identity: Optional["_models.UserAssignedServiceIdentity"] = None, + managed_resource_group_configuration: Optional["_models.ManagedRGConfiguration"] = None, **kwargs ): """ @@ -4970,10 +4966,10 @@ def __init__( :paramtype location: str :keyword identity: Managed service identity (user assigned identities). :paramtype identity: ~azure.mgmt.workloads.models.UserAssignedServiceIdentity - :keyword environment: Required. Defines the environment type - Production/Non Production. - Possible values include: "NonProd", "Prod". + :keyword environment: Required. Defines the environment type - Production/Non Production. Known + values are: "NonProd", "Prod". :paramtype environment: str or ~azure.mgmt.workloads.models.SAPEnvironmentType - :keyword sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", + :keyword sap_product: Required. Defines the SAP Product type. Known values are: "ECC", "S4HANA", "Other". :paramtype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType :keyword configuration: Required. Defines if an existing SAP system is being registered or a @@ -5010,7 +5006,7 @@ class SAPVirtualInstanceError(msrest.serialization.Model): def __init__( self, *, - properties: Optional["ErrorDefinition"] = None, + properties: Optional["_models.ErrorDefinition"] = None, **kwargs ): """ @@ -5038,7 +5034,7 @@ class SAPVirtualInstanceList(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["SAPVirtualInstance"]] = None, + value: Optional[List["_models.SAPVirtualInstance"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -5072,7 +5068,7 @@ class SearchProfile(NodeProfile): :vartype data_disks: list[~azure.mgmt.workloads.models.DiskInfo] :ivar node_resource_ids: VM/VMSS resource ARM Ids. :vartype node_resource_ids: list[str] - :ivar search_type: Required. Search type. Possible values include: "Elastic". + :ivar search_type: Required. Search type. Known values are: "Elastic". :vartype search_type: str or ~azure.mgmt.workloads.models.SearchType """ @@ -5098,11 +5094,11 @@ def __init__( self, *, node_sku: str, - os_image: "OsImageProfile", - os_disk: "DiskInfo", - search_type: Union[str, "SearchType"], + os_image: "_models.OsImageProfile", + os_disk: "_models.DiskInfo", + search_type: Union[str, "_models.SearchType"], name: Optional[str] = None, - data_disks: Optional[List["DiskInfo"]] = None, + data_disks: Optional[List["_models.DiskInfo"]] = None, **kwargs ): """ @@ -5116,7 +5112,7 @@ def __init__( :paramtype os_disk: ~azure.mgmt.workloads.models.DiskInfo :keyword data_disks: Data disks details. This property is not in use right now. :paramtype data_disks: list[~azure.mgmt.workloads.models.DiskInfo] - :keyword search_type: Required. Search type. Possible values include: "Elastic". + :keyword search_type: Required. Search type. Known values are: "Elastic". :paramtype search_type: str or ~azure.mgmt.workloads.models.SearchType """ super(SearchProfile, self).__init__(name=name, node_sku=node_sku, os_image=os_image, os_disk=os_disk, data_disks=data_disks, **kwargs) @@ -5129,7 +5125,7 @@ class ServiceInitiatedSoftwareConfiguration(SoftwareConfiguration): All required parameters must be populated in order to send to Azure. :ivar software_installation_type: Required. The SAP software installation Type.Constant filled - by server. Possible values include: "ServiceInitiated", "SAPInstallWithoutOSConfig". + by server. Known values are: "ServiceInitiated", "SAPInstallWithoutOSConfig". :vartype software_installation_type: str or ~azure.mgmt.workloads.models.SAPSoftwareInstallationType :ivar bom_url: Required. The URL to the SAP Build of Materials(BOM) file. @@ -5174,7 +5170,7 @@ def __init__( sap_bits_storage_account_id: str, sap_fqdn: str, ssh_private_key: str, - high_availability_software_configuration: Optional["HighAvailabilitySoftwareConfiguration"] = None, + high_availability_software_configuration: Optional["_models.HighAvailabilitySoftwareConfiguration"] = None, **kwargs ): """ @@ -5207,15 +5203,15 @@ class SingleServerConfiguration(InfrastructureConfiguration): All required parameters must be populated in order to send to Azure. - :ivar deployment_type: Required. The deployment Type.Constant filled by server. Possible values - include: "SingleServer", "ThreeTier". + :ivar deployment_type: Required. The deployment Type.Constant filled by server. Known values + are: "SingleServer", "ThreeTier". :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType :ivar app_resource_group: Required. The application resource group where SAP system resources will be deployed. :vartype app_resource_group: str :ivar network_configuration: Network configuration for the server. :vartype network_configuration: ~azure.mgmt.workloads.models.NetworkConfiguration - :ivar database_type: The database type. Possible values include: "HANA", "DB2". + :ivar database_type: The database type. Known values are: "HANA", "DB2". :vartype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType :ivar subnet_id: Required. The subnet id. :vartype subnet_id: str @@ -5245,9 +5241,9 @@ def __init__( *, app_resource_group: str, subnet_id: str, - virtual_machine_configuration: "VirtualMachineConfiguration", - network_configuration: Optional["NetworkConfiguration"] = None, - database_type: Optional[Union[str, "SAPDatabaseType"]] = None, + virtual_machine_configuration: "_models.VirtualMachineConfiguration", + network_configuration: Optional["_models.NetworkConfiguration"] = None, + database_type: Optional[Union[str, "_models.SAPDatabaseType"]] = None, **kwargs ): """ @@ -5256,7 +5252,7 @@ def __init__( :paramtype app_resource_group: str :keyword network_configuration: Network configuration for the server. :paramtype network_configuration: ~azure.mgmt.workloads.models.NetworkConfiguration - :keyword database_type: The database type. Possible values include: "HANA", "DB2". + :keyword database_type: The database type. Known values are: "HANA", "DB2". :paramtype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType :keyword subnet_id: Required. The subnet id. :paramtype subnet_id: str @@ -5278,8 +5274,8 @@ class SingleServerRecommendationResult(SAPSizingRecommendationResult): All required parameters must be populated in order to send to Azure. - :ivar deployment_type: Required. The deployment Type.Constant filled by server. Possible values - include: "SingleServer", "ThreeTier". + :ivar deployment_type: Required. The deployment Type.Constant filled by server. Known values + are: "SingleServer", "ThreeTier". :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType :ivar vm_sku: The recommended VM SKU for single server. :vartype vm_sku: str @@ -5342,7 +5338,7 @@ class Sku(msrest.serialization.Model): :ivar name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. :vartype name: str :ivar tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", + has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", "Standard", "Premium". :vartype tier: str or ~azure.mgmt.workloads.models.SkuTier :ivar size: The SKU size. When the name field is the combination of tier and some other value, @@ -5372,7 +5368,7 @@ def __init__( self, *, name: str, - tier: Optional[Union[str, "SkuTier"]] = None, + tier: Optional[Union[str, "_models.SkuTier"]] = None, size: Optional[str] = None, family: Optional[str] = None, capacity: Optional[int] = None, @@ -5382,7 +5378,7 @@ def __init__( :keyword name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. :paramtype name: str :keyword tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", + has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", "Standard", "Premium". :paramtype tier: str or ~azure.mgmt.workloads.models.SkuTier :keyword size: The SKU size. When the name field is the combination of tier and some other @@ -5444,7 +5440,7 @@ class SkuCapacity(msrest.serialization.Model): :vartype maximum: int :ivar default: Default capacity value. :vartype default: int - :ivar scale_type: Scale type of the SKU capacity. Possible values include: "None", "Manual", + :ivar scale_type: Scale type of the SKU capacity. Known values are: "None", "Manual", "Automatic". :vartype scale_type: str or ~azure.mgmt.workloads.models.SkuScaleType """ @@ -5462,7 +5458,7 @@ def __init__( minimum: Optional[int] = None, maximum: Optional[int] = None, default: Optional[int] = None, - scale_type: Optional[Union[str, "SkuScaleType"]] = None, + scale_type: Optional[Union[str, "_models.SkuScaleType"]] = None, **kwargs ): """ @@ -5472,7 +5468,7 @@ def __init__( :paramtype maximum: int :keyword default: Default capacity value. :paramtype default: int - :keyword scale_type: Scale type of the SKU capacity. Possible values include: "None", "Manual", + :keyword scale_type: Scale type of the SKU capacity. Known values are: "None", "Manual", "Automatic". :paramtype scale_type: str or ~azure.mgmt.workloads.models.SkuScaleType """ @@ -5587,11 +5583,11 @@ def __init__( family: Optional[str] = None, kind: Optional[str] = None, locations: Optional[List[str]] = None, - location_info: Optional[List["SkuLocationAndZones"]] = None, + location_info: Optional[List["_models.SkuLocationAndZones"]] = None, capacity: Optional[Any] = None, - costs: Optional[List["SkuCost"]] = None, - capabilities: Optional[List["SkuCapability"]] = None, - restrictions: Optional[List["SkuRestriction"]] = None, + costs: Optional[List["_models.SkuCost"]] = None, + capabilities: Optional[List["_models.SkuCapability"]] = None, + restrictions: Optional[List["_models.SkuRestriction"]] = None, **kwargs ): """ @@ -5651,7 +5647,7 @@ class SkuLocationAndZones(msrest.serialization.Model): :vartype zone_details: list[~azure.mgmt.workloads.models.SkuZoneDetail] :ivar extended_locations: The extended locations of SKU. :vartype extended_locations: list[str] - :ivar type: Type of the extended location. Possible values include: "Region", "EdgeZone". + :ivar type: Type of the extended location. Known values are: "Region", "EdgeZone". :vartype type: str or ~azure.mgmt.workloads.models.LocationType """ @@ -5668,9 +5664,9 @@ def __init__( *, location: Optional[str] = None, zones: Optional[List[str]] = None, - zone_details: Optional[List["SkuZoneDetail"]] = None, + zone_details: Optional[List["_models.SkuZoneDetail"]] = None, extended_locations: Optional[List[str]] = None, - type: Optional[Union[str, "LocationType"]] = None, + type: Optional[Union[str, "_models.LocationType"]] = None, **kwargs ): """ @@ -5682,7 +5678,7 @@ def __init__( :paramtype zone_details: list[~azure.mgmt.workloads.models.SkuZoneDetail] :keyword extended_locations: The extended locations of SKU. :paramtype extended_locations: list[str] - :keyword type: Type of the extended location. Possible values include: "Region", "EdgeZone". + :keyword type: Type of the extended location. Known values are: "Region", "EdgeZone". :paramtype type: str or ~azure.mgmt.workloads.models.LocationType """ super(SkuLocationAndZones, self).__init__(**kwargs) @@ -5696,14 +5692,13 @@ def __init__( class SkuRestriction(msrest.serialization.Model): """The SKU restriction definition. - :ivar type: The SKU restriction type. Possible values include: "NotSpecified", "Location", - "Zone". + :ivar type: The SKU restriction type. Known values are: "NotSpecified", "Location", "Zone". :vartype type: str or ~azure.mgmt.workloads.models.SkuRestrictionType :ivar values: Restriction values. :vartype values: list[str] :ivar restriction_info: The restriction information. :vartype restriction_info: any - :ivar reason_code: The SKU restriction reason code. Possible values include: "NotSpecified", + :ivar reason_code: The SKU restriction reason code. Known values are: "NotSpecified", "QuotaId", "NotAvailableForSubscription". :vartype reason_code: str or ~azure.mgmt.workloads.models.SkuRestrictionReasonCode """ @@ -5718,21 +5713,20 @@ class SkuRestriction(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "SkuRestrictionType"]] = None, + type: Optional[Union[str, "_models.SkuRestrictionType"]] = None, values: Optional[List[str]] = None, restriction_info: Optional[Any] = None, - reason_code: Optional[Union[str, "SkuRestrictionReasonCode"]] = None, + reason_code: Optional[Union[str, "_models.SkuRestrictionReasonCode"]] = None, **kwargs ): """ - :keyword type: The SKU restriction type. Possible values include: "NotSpecified", "Location", - "Zone". + :keyword type: The SKU restriction type. Known values are: "NotSpecified", "Location", "Zone". :paramtype type: str or ~azure.mgmt.workloads.models.SkuRestrictionType :keyword values: Restriction values. :paramtype values: list[str] :keyword restriction_info: The restriction information. :paramtype restriction_info: any - :keyword reason_code: The SKU restriction reason code. Possible values include: "NotSpecified", + :keyword reason_code: The SKU restriction reason code. Known values are: "NotSpecified", "QuotaId", "NotAvailableForSubscription". :paramtype reason_code: str or ~azure.mgmt.workloads.models.SkuRestrictionReasonCode """ @@ -5793,7 +5787,7 @@ def __init__( self, *, zones: Optional[List[str]] = None, - capabilities: Optional[List["SkuCapability"]] = None, + capabilities: Optional[List["_models.SkuCapability"]] = None, **kwargs ): """ @@ -5821,7 +5815,7 @@ class SshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: Optional[List["SshPublicKey"]] = None, + public_keys: Optional[List["_models.SshPublicKey"]] = None, **kwargs ): """ @@ -5925,15 +5919,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.workloads.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.workloads.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). :vartype last_modified_at: ~datetime.datetime @@ -5952,25 +5946,25 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = 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, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.workloads.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.workloads.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime @@ -6014,8 +6008,8 @@ class ThreeTierConfiguration(InfrastructureConfiguration): All required parameters must be populated in order to send to Azure. - :ivar deployment_type: Required. The deployment Type.Constant filled by server. Possible values - include: "SingleServer", "ThreeTier". + :ivar deployment_type: Required. The deployment Type.Constant filled by server. Known values + are: "SingleServer", "ThreeTier". :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType :ivar app_resource_group: Required. The application resource group where SAP system resources will be deployed. @@ -6054,11 +6048,11 @@ def __init__( self, *, app_resource_group: str, - central_server: "CentralServerConfiguration", - application_server: "ApplicationServerConfiguration", - database_server: "DatabaseConfiguration", - network_configuration: Optional["NetworkConfiguration"] = None, - high_availability_config: Optional["HighAvailabilityConfiguration"] = None, + central_server: "_models.CentralServerConfiguration", + application_server: "_models.ApplicationServerConfiguration", + database_server: "_models.DatabaseConfiguration", + network_configuration: Optional["_models.NetworkConfiguration"] = None, + high_availability_config: Optional["_models.HighAvailabilityConfiguration"] = None, **kwargs ): """ @@ -6090,8 +6084,8 @@ class ThreeTierRecommendationResult(SAPSizingRecommendationResult): All required parameters must be populated in order to send to Azure. - :ivar deployment_type: Required. The deployment Type.Constant filled by server. Possible values - include: "SingleServer", "ThreeTier". + :ivar deployment_type: Required. The deployment Type.Constant filled by server. Known values + are: "SingleServer", "ThreeTier". :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType :ivar db_vm_sku: The database VM SKU. :vartype db_vm_sku: str @@ -6174,7 +6168,7 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - identity: Optional["UserAssignedServiceIdentity"] = None, + identity: Optional["_models.UserAssignedServiceIdentity"] = None, **kwargs ): """ @@ -6281,7 +6275,7 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - identity: Optional["UserAssignedServiceIdentity"] = None, + identity: Optional["_models.UserAssignedServiceIdentity"] = None, **kwargs ): """ @@ -6395,8 +6389,8 @@ def __init__( self, *, vm_size: str, - image_reference: "ImageReference", - os_profile: "OSProfile", + image_reference: "_models.ImageReference", + os_profile: "_models.OSProfile", **kwargs ): """ @@ -6462,10 +6456,10 @@ def __init__( self, *, node_sku: str, - os_image: "OsImageProfile", - os_disk: "DiskInfo", + os_image: "_models.OsImageProfile", + os_disk: "_models.DiskInfo", name: Optional[str] = None, - data_disks: Optional[List["DiskInfo"]] = None, + data_disks: Optional[List["_models.DiskInfo"]] = None, auto_scale_min_count: Optional[int] = None, auto_scale_max_count: Optional[int] = None, **kwargs @@ -6496,8 +6490,8 @@ class WindowsConfiguration(OSConfiguration): All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS Type.Constant filled by server. Possible values include: - "Linux", "Windows". + :ivar os_type: Required. The OS Type.Constant filled by server. Known values are: "Linux", + "Windows". :vartype os_type: str or ~azure.mgmt.workloads.models.OSType """ @@ -6535,7 +6529,7 @@ class WordpressInstanceResource(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.workloads.models.SystemData - :ivar version: Application version. Possible values include: "5.4.3", "5.4.2", "5.4.1", "5.4". + :ivar version: Application version. Known values are: "5.4.3", "5.4.2", "5.4.1", "5.4". :vartype version: str or ~azure.mgmt.workloads.models.WordpressVersions :ivar database_name: Database name used by the application. :vartype database_name: str @@ -6543,7 +6537,7 @@ class WordpressInstanceResource(ProxyResource): :vartype database_user: str :ivar site_url: Site Url to access the WordPress application. :vartype site_url: str - :ivar provisioning_state: WordPress instance provisioning state. Possible values include: + :ivar provisioning_state: WordPress instance provisioning state. Known values are: "NotSpecified", "Accepted", "Created", "Succeeded", "Failed", "Canceled", "Installing". :vartype provisioning_state: str or ~azure.mgmt.workloads.models.ApplicationProvisioningState """ @@ -6572,14 +6566,13 @@ class WordpressInstanceResource(ProxyResource): def __init__( self, *, - version: Optional[Union[str, "WordpressVersions"]] = None, + version: Optional[Union[str, "_models.WordpressVersions"]] = None, database_name: Optional[str] = None, database_user: Optional[str] = None, **kwargs ): """ - :keyword version: Application version. Possible values include: "5.4.3", "5.4.2", "5.4.1", - "5.4". + :keyword version: Application version. Known values are: "5.4.3", "5.4.2", "5.4.1", "5.4". :paramtype version: str or ~azure.mgmt.workloads.models.WordpressVersions :keyword database_name: Database name used by the application. :paramtype database_name: str @@ -6611,7 +6604,7 @@ class WordpressInstanceResourceList(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["WordpressInstanceResource"]] = None, + value: Optional[List["_models.WordpressInstanceResource"]] = None, next_link: Optional[str] = None, **kwargs ): diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_patch.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# 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/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_workloads_client_enums.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_workloads_client_enums.py index d405fdf30ca0..7a7e78d3fe23 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_workloads_client_enums.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_workloads_client_enums.py @@ -7,17 +7,16 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. """ INTERNAL = "Internal" -class ApplicationProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ApplicationProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """WordPress instance provisioning state """ @@ -29,14 +28,14 @@ class ApplicationProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, CANCELED = "Canceled" INSTALLING = "Installing" -class AzureFrontDoorEnabled(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AzureFrontDoorEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Whether to enable Azure front door """ ENABLED = "Enabled" DISABLED = "Disabled" -class CentralServerVirtualMachineType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CentralServerVirtualMachineType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the type of central server VM. """ @@ -48,7 +47,7 @@ class CentralServerVirtualMachineType(with_metaclass(CaseInsensitiveEnumMeta, st ERS = "ERS" STANDBY = "Standby" -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -57,7 +56,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DatabaseTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DatabaseTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tier of the server SKU """ @@ -65,13 +64,13 @@ class DatabaseTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GENERAL_PURPOSE = "GeneralPurpose" MEMORY_OPTIMIZED = "MemoryOptimized" -class DatabaseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DatabaseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Database type """ MY_SQL = "MySql" -class DiskStorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DiskStorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage type """ @@ -79,28 +78,28 @@ class DiskStorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): STANDARD_LRS = "Standard_LRS" STANDARD_SSD_LRS = "StandardSSD_LRS" -class EnableBackup(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class EnableBackup(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Whether to enable Azure backup for the workload """ ENABLED = "Enabled" DISABLED = "Disabled" -class EnableSslEnforcement(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class EnableSslEnforcement(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Whether to enable SSL enforcement on the database """ ENABLED = "Enabled" DISABLED = "Disabled" -class EnqueueReplicationServerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class EnqueueReplicationServerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the type of Enqueue Replication Server. """ ENQUEUE_REPLICATOR1 = "EnqueueReplicator1" ENQUEUE_REPLICATOR2 = "EnqueueReplicator2" -class FileShareStorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class FileShareStorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """File share backing storage type """ @@ -109,42 +108,42 @@ class FileShareStorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): STANDARD_ZRS = "Standard_ZRS" PREMIUM_LRS = "Premium_LRS" -class FileShareType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class FileShareType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Share type """ NFS_ON_CONTROLLER = "NfsOnController" AZURE_FILES = "AzureFiles" -class HAEnabled(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class HAEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Whether to enable HA for the server """ ENABLED = "Enabled" DISABLED = "Disabled" -class LoadBalancerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Load balancer type """ APPLICATION_GATEWAY = "ApplicationGateway" LOAD_BALANCER = "LoadBalancer" -class LocationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LocationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the extended location. """ REGION = "Region" EDGE_ZONE = "EdgeZone" -class ManagedServiceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of managed service identity (only None, UserAssigned types are allowed). """ NONE = "None" USER_ASSIGNED = "UserAssigned" -class OperationProperties(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OperationProperties(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the workload operation origin. """ @@ -152,7 +151,7 @@ class OperationProperties(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER = "User" SYSTEM = "System" -class Origin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" """ @@ -161,39 +160,39 @@ class Origin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SYSTEM = "system" USER_SYSTEM = "user,system" -class OSImageOffer(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSImageOffer(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OS image offer """ UBUNTU_SERVER = "UbuntuServer" -class OSImagePublisher(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSImagePublisher(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OS image publisher """ CANONICAL = "Canonical" -class OSImageSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSImageSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OS image sku """ EIGHTEEN04_LTS = "18.04-LTS" SIXTEEN04_LTS = "16.04-LTS" -class OSImageVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSImageVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OS image version """ LATEST = "latest" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The OS Type """ LINUX = "Linux" WINDOWS = "Windows" -class PHPVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PHPVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): """PHP version """ @@ -201,7 +200,7 @@ class PHPVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SEVEN3 = "7.3" SEVEN4 = "7.4" -class PhpWorkloadProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PhpWorkloadProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Php workload resource provisioning state """ @@ -214,14 +213,14 @@ class PhpWorkloadProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, PROVISIONING = "Provisioning" DELETING = "Deleting" -class RedisCacheFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RedisCacheFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Cache family """ C = "C" P = "P" -class RoutingPreference(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RoutingPreference(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Sets the routing preference of the SAP monitor. By default only RFC1918 traffic is routed to the customer VNET. """ @@ -229,7 +228,7 @@ class RoutingPreference(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "Default" ROUTE_ALL = "RouteAll" -class SAPConfigurationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SAPConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The configuration Type. """ @@ -237,34 +236,34 @@ class SAPConfigurationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DISCOVERY = "Discovery" DEPLOYMENT_WITH_OS_CONFIG = "DeploymentWithOSConfig" -class SAPDatabaseScaleMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SAPDatabaseScaleMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The database scale method. """ SCALE_UP = "ScaleUp" -class SAPDatabaseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SAPDatabaseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the supported SAP Database types. """ HANA = "HANA" DB2 = "DB2" -class SAPDeploymentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SAPDeploymentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The deployment Type. """ SINGLE_SERVER = "SingleServer" THREE_TIER = "ThreeTier" -class SAPEnvironmentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SAPEnvironmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the environment type - Production/Non Production. """ NON_PROD = "NonProd" PROD = "Prod" -class SAPHealthState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SAPHealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the SAP Instance health. """ @@ -273,7 +272,7 @@ class SAPHealthState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): UNHEALTHY = "Unhealthy" DEGRADED = "Degraded" -class SAPHighAvailabilityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SAPHighAvailabilityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The high availability Type. AvailabilitySet guarantees 99.95% availability. Availability Zone guarantees 99.99% availability. """ @@ -281,7 +280,7 @@ class SAPHighAvailabilityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum) AVAILABILITY_SET = "AvailabilitySet" AVAILABILITY_ZONE = "AvailabilityZone" -class SAPProductType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SAPProductType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the SAP Product type. """ @@ -289,14 +288,14 @@ class SAPProductType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): S4_HANA = "S4HANA" OTHER = "Other" -class SAPSoftwareInstallationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SAPSoftwareInstallationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The SAP software installation Type. """ SERVICE_INITIATED = "ServiceInitiated" SAP_INSTALL_WITHOUT_OS_CONFIG = "SAPInstallWithoutOSConfig" -class SapVirtualInstanceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SapVirtualInstanceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the provisioning states. """ @@ -306,7 +305,7 @@ class SapVirtualInstanceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta FAILED = "Failed" DELETING = "Deleting" -class SAPVirtualInstanceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SAPVirtualInstanceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the Virtual Instance for SAP state. """ @@ -321,7 +320,7 @@ class SAPVirtualInstanceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum) DISCOVERY_FAILED = "DiscoveryFailed" REGISTRATION_COMPLETE = "RegistrationComplete" -class SAPVirtualInstanceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SAPVirtualInstanceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the SAP Instance status. """ @@ -332,13 +331,13 @@ class SAPVirtualInstanceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum PARTIALLY_RUNNING = "PartiallyRunning" UNAVAILABLE = "Unavailable" -class SearchType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SearchType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Search type """ ELASTIC = "Elastic" -class SkuRestrictionReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuRestrictionReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The SKU restriction reason code. """ @@ -346,7 +345,7 @@ class SkuRestrictionReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class SkuRestrictionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuRestrictionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The SKU restriction type. """ @@ -354,7 +353,7 @@ class SkuRestrictionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): LOCATION = "Location" ZONE = "Zone" -class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Scale type of the SKU capacity. """ @@ -362,7 +361,7 @@ class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" -class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. """ @@ -372,7 +371,7 @@ class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): STANDARD = "Standard" PREMIUM = "Premium" -class WordpressVersions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WordpressVersions(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Application version """ @@ -381,20 +380,20 @@ class WordpressVersions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FIVE4_1 = "5.4.1" FIVE4 = "5.4" -class WorkloadKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates which kind of php workload this resource represent e.g WordPress """ WORD_PRESS = "WordPress" -class WorkloadMonitorActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadMonitorActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the action type of workload operation. """ NOT_SPECIFIED = "NotSpecified" INTERNAL = "Internal" -class WorkloadMonitorProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadMonitorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """State of provisioning of the SAP monitor. """ diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/__init__.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/__init__.py index 776a9a684ec2..ce450c03ae12 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/__init__.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/__init__.py @@ -18,6 +18,9 @@ from ._provider_instances_operations import ProviderInstancesOperations from ._skus_operations import SkusOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'PhpWorkloadsOperations', 'WordpressInstancesOperations', @@ -31,3 +34,5 @@ 'ProviderInstancesOperations', 'SkusOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_monitors_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_monitors_operations.py index c3ad9d62562e..fd86b605784a 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_monitors_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_monitors_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from .._vendor import MixinABC, _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/monitors") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_request( monitor_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -136,14 +139,17 @@ def build_create_request_initial( resource_group_name: str, monitor_name: str, *, - json: JSONType = None, + json: Optional[_models.Monitor] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}") # pylint: disable=line-too-long path_format_arguments = { @@ -155,20 +161,18 @@ def build_create_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -181,9 +185,12 @@ def build_delete_request_initial( monitor_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}") # pylint: disable=line-too-long path_format_arguments = { @@ -195,18 +202,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -216,14 +221,17 @@ def build_update_request( resource_group_name: str, monitor_name: str, *, - json: JSONType = None, + json: Optional[_models.UpdateMonitorRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}") # pylint: disable=line-too-long path_format_arguments = { @@ -235,52 +243,48 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class MonitorsOperations(object): - """MonitorsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MonitorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.WorkloadsClient`'s + :attr:`monitors` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = 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.MonitorListResult"]: + ) -> Iterable[_models.MonitorListResult]: """Gets a list of SAP monitors in the specified subscription. Gets a list of SAP monitors in the specified subscription. The operations returns various @@ -291,13 +295,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.MonitorListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MonitorListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -305,9 +312,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -315,9 +324,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -356,7 +367,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.MonitorListResult"]: + ) -> Iterable[_models.MonitorListResult]: """Gets a list of SAP monitors. Gets a list of SAP monitors in the specified resource group. @@ -368,13 +379,16 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.MonitorListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MonitorListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -383,9 +397,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -394,9 +410,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -436,7 +454,7 @@ def get( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> "_models.Monitor": + ) -> _models.Monitor: """Gets properties of a SAP monitor. Gets properties of a SAP monitor for the specified subscription, resource group, and resource @@ -451,13 +469,16 @@ def get( :rtype: ~azure.mgmt.workloads.models.Monitor :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Monitor"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Monitor] request = build_get_request( @@ -466,11 +487,13 @@ def get( monitor_name=monitor_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -496,17 +519,20 @@ def _create_initial( self, resource_group_name: str, monitor_name: str, - monitor_parameter: "_models.Monitor", + monitor_parameter: _models.Monitor, **kwargs: Any - ) -> "_models.Monitor": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Monitor"] + ) -> _models.Monitor: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Monitor] _json = self._serialize.body(monitor_parameter, 'Monitor') @@ -518,11 +544,13 @@ def _create_initial( content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -552,9 +580,9 @@ def begin_create( self, resource_group_name: str, monitor_name: str, - monitor_parameter: "_models.Monitor", + monitor_parameter: _models.Monitor, **kwargs: Any - ) -> LROPoller["_models.Monitor"]: + ) -> LROPoller[_models.Monitor]: """Creates a SAP monitor. Creates a SAP monitor for the specified subscription, resource group, and resource name. @@ -577,37 +605,47 @@ def begin_create( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.Monitor] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Monitor] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Monitor"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, monitor_name=monitor_name, monitor_parameter=monitor_parameter, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('Monitor', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -625,14 +663,17 @@ def _delete_initial( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> Optional["_models.OperationStatusResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + ) -> Optional[_models.OperationStatusResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.OperationStatusResult]] request = build_delete_request_initial( @@ -641,11 +682,13 @@ def _delete_initial( monitor_name=monitor_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -674,7 +717,7 @@ def begin_delete( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> LROPoller["_models.OperationStatusResult"]: + ) -> LROPoller[_models.OperationStatusResult]: """Deletes a SAP monitor. Deletes a SAP monitor with the specified subscription, resource group, and SAP monitor name. @@ -696,34 +739,44 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatusResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, monitor_name=monitor_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -741,9 +794,9 @@ def update( self, resource_group_name: str, monitor_name: str, - body: "_models.UpdateMonitorRequest", + body: _models.UpdateMonitorRequest, **kwargs: Any - ) -> "_models.Monitor": + ) -> _models.Monitor: """Patches the Tags field of a SAP monitor. Patches the Tags field of a SAP monitor for the specified subscription, resource group, and SAP @@ -760,14 +813,17 @@ def update( :rtype: ~azure.mgmt.workloads.models.Monitor :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Monitor"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Monitor] _json = self._serialize.body(body, 'UpdateMonitorRequest') @@ -779,11 +835,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_operations.py index 47cc4820beb7..ceb08ad43055 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_operations.py @@ -16,10 +16,11 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import 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 .._vendor import _convert_request +from .._vendor import MixinABC, _convert_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.Workloads/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.WorkloadsClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = 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.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Lists all the available API operations under this PR. :keyword callable cls: A custom type or function that will be passed the direct response @@ -85,31 +85,38 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_patch.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# 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/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_php_workloads_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_php_workloads_operations.py index c64555e444c5..737d4fef06c4 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_php_workloads_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_php_workloads_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from .._vendor import MixinABC, _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/phpWorkloads") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_by_subscription_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_request( php_workload_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -136,14 +139,17 @@ def build_create_or_update_request_initial( resource_group_name: str, php_workload_name: str, *, - json: JSONType = None, + json: Optional[_models.PhpWorkloadResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}") # pylint: disable=line-too-long path_format_arguments = { @@ -155,20 +161,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -180,14 +184,17 @@ def build_update_request( resource_group_name: str, php_workload_name: str, *, - json: JSONType = None, + json: Optional[_models.PatchResourceRequestBody] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}") # pylint: disable=line-too-long path_format_arguments = { @@ -199,20 +206,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -227,9 +232,12 @@ def build_delete_request_initial( delete_infra: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}") # pylint: disable=line-too-long path_format_arguments = { @@ -241,50 +249,46 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if delete_infra is not None: - _query_parameters['delete-infra'] = _SERIALIZER.query("delete_infra", delete_infra, 'str', min_length=1) + _params['delete-infra'] = _SERIALIZER.query("delete_infra", delete_infra, 'str', min_length=1) # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PhpWorkloadsOperations(object): - """PhpWorkloadsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PhpWorkloadsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.WorkloadsClient`'s + :attr:`php_workloads` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = 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_by_subscription( self, **kwargs: Any - ) -> Iterable["_models.PhpWorkloadResourceList"]: + ) -> Iterable[_models.PhpWorkloadResourceList]: """Lists PHP workload resources for a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -293,13 +297,16 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.PhpWorkloadResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PhpWorkloadResourceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -307,9 +314,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -317,9 +326,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -358,7 +369,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.PhpWorkloadResourceList"]: + ) -> Iterable[_models.PhpWorkloadResourceList]: """Lists PHP workload resources in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -369,13 +380,16 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.PhpWorkloadResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PhpWorkloadResourceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -384,9 +398,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -395,9 +411,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -437,7 +455,7 @@ def get( resource_group_name: str, php_workload_name: str, **kwargs: Any - ) -> "_models.PhpWorkloadResource": + ) -> _models.PhpWorkloadResource: """Gets the PHP workload resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -449,13 +467,16 @@ def get( :rtype: ~azure.mgmt.workloads.models.PhpWorkloadResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PhpWorkloadResource] request = build_get_request( @@ -464,11 +485,13 @@ def get( php_workload_name=php_workload_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -494,17 +517,20 @@ def _create_or_update_initial( self, resource_group_name: str, php_workload_name: str, - php_workload_resource: "_models.PhpWorkloadResource", + php_workload_resource: _models.PhpWorkloadResource, **kwargs: Any - ) -> "_models.PhpWorkloadResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResource"] + ) -> _models.PhpWorkloadResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PhpWorkloadResource] _json = self._serialize.body(php_workload_resource, 'PhpWorkloadResource') @@ -516,11 +542,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -550,9 +578,9 @@ def begin_create_or_update( self, resource_group_name: str, php_workload_name: str, - php_workload_resource: "_models.PhpWorkloadResource", + php_workload_resource: _models.PhpWorkloadResource, **kwargs: Any - ) -> LROPoller["_models.PhpWorkloadResource"]: + ) -> LROPoller[_models.PhpWorkloadResource]: """Create or updated PHP workload resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -574,37 +602,47 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.PhpWorkloadResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PhpWorkloadResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, php_workload_name=php_workload_name, php_workload_resource=php_workload_resource, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('PhpWorkloadResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -622,9 +660,9 @@ def update( self, resource_group_name: str, php_workload_name: str, - resource_patch_request_body: "_models.PatchResourceRequestBody", + resource_patch_request_body: _models.PatchResourceRequestBody, **kwargs: Any - ) -> "_models.PhpWorkloadResource": + ) -> _models.PhpWorkloadResource: """Update PHP workload resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -638,14 +676,17 @@ def update( :rtype: ~azure.mgmt.workloads.models.PhpWorkloadResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PhpWorkloadResource] _json = self._serialize.body(resource_patch_request_body, 'PatchResourceRequestBody') @@ -657,11 +698,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -690,13 +733,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements delete_infra: Optional[str] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -706,11 +752,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version=api_version, delete_infra=delete_infra, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -756,21 +804,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, php_workload_name=php_workload_name, delete_infra=delete_infra, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -780,8 +833,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_provider_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_provider_instances_operations.py index c301c686d0fb..4bf82bf5d354 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_provider_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_provider_instances_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from .._vendor import MixinABC, _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( monitor_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( provider_instance_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_request_initial( monitor_name: str, provider_instance_name: str, *, - json: JSONType = None, + json: Optional[_models.ProviderInstance] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( provider_instance_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,42 +177,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ProviderInstancesOperations(object): - """ProviderInstancesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ProviderInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.WorkloadsClient`'s + :attr:`provider_instances` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = 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( @@ -214,7 +216,7 @@ def list( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> Iterable["_models.ProviderInstanceListResult"]: + ) -> Iterable[_models.ProviderInstanceListResult]: """Gets a list of provider instances in the specified SAP monitor. Gets a list of provider instances in the specified SAP monitor. The operations returns various @@ -230,13 +232,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.ProviderInstanceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ProviderInstanceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderInstanceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -246,9 +251,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -258,9 +265,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -301,7 +310,7 @@ def get( monitor_name: str, provider_instance_name: str, **kwargs: Any - ) -> "_models.ProviderInstance": + ) -> _models.ProviderInstance: """Gets properties of a provider instance. Gets properties of a provider instance for the specified subscription, resource group, SAP @@ -318,13 +327,16 @@ def get( :rtype: ~azure.mgmt.workloads.models.ProviderInstance :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderInstance"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ProviderInstance] request = build_get_request( @@ -334,11 +346,13 @@ def get( provider_instance_name=provider_instance_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -365,17 +379,20 @@ def _create_initial( resource_group_name: str, monitor_name: str, provider_instance_name: str, - provider_instance_parameter: "_models.ProviderInstance", + provider_instance_parameter: _models.ProviderInstance, **kwargs: Any - ) -> "_models.ProviderInstance": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderInstance"] + ) -> _models.ProviderInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ProviderInstance] _json = self._serialize.body(provider_instance_parameter, 'ProviderInstance') @@ -388,11 +405,13 @@ def _create_initial( content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -423,9 +442,9 @@ def begin_create( resource_group_name: str, monitor_name: str, provider_instance_name: str, - provider_instance_parameter: "_models.ProviderInstance", + provider_instance_parameter: _models.ProviderInstance, **kwargs: Any - ) -> LROPoller["_models.ProviderInstance"]: + ) -> LROPoller[_models.ProviderInstance]: """Creates a provider instance. Creates a provider instance for the specified subscription, resource group, SAP monitor name, @@ -452,17 +471,20 @@ def begin_create( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.ProviderInstance] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ProviderInstance] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderInstance"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, monitor_name=monitor_name, provider_instance_name=provider_instance_name, @@ -470,20 +492,27 @@ def begin_create( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ProviderInstance', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -502,14 +531,17 @@ def _delete_initial( monitor_name: str, provider_instance_name: str, **kwargs: Any - ) -> Optional["_models.OperationStatusResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + ) -> Optional[_models.OperationStatusResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.OperationStatusResult]] request = build_delete_request_initial( @@ -519,11 +551,13 @@ def _delete_initial( provider_instance_name=provider_instance_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -553,7 +587,7 @@ def begin_delete( monitor_name: str, provider_instance_name: str, **kwargs: Any - ) -> LROPoller["_models.OperationStatusResult"]: + ) -> LROPoller[_models.OperationStatusResult]: """Deletes a provider instance. Deletes a provider instance for the specified subscription, resource group, SAP monitor name, @@ -578,35 +612,45 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatusResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, monitor_name=monitor_name, provider_instance_name=provider_instance_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_application_server_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_application_server_instances_operations.py index f89d32b33f4c..84b6c059f15d 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_application_server_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_application_server_instances_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from .._vendor import MixinABC, _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_request( application_instance_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -51,18 +54,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -73,14 +74,17 @@ def build_create_request_initial( sap_virtual_instance_name: str, application_instance_name: str, *, - json: JSONType = None, + json: Optional[_models.SAPApplicationServerInstance] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -93,20 +97,18 @@ def build_create_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -119,14 +121,17 @@ def build_update_request_initial( sap_virtual_instance_name: str, application_instance_name: str, *, - json: JSONType = None, + json: Optional[_models.UpdateSAPApplicationInstanceRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -139,20 +144,18 @@ def build_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -166,9 +169,12 @@ def build_delete_request_initial( application_instance_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -181,18 +187,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -203,9 +207,12 @@ def build_list_request( sap_virtual_instance_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances") # pylint: disable=line-too-long path_format_arguments = { @@ -217,42 +224,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SAPApplicationServerInstancesOperations(object): - """SAPApplicationServerInstancesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SAPApplicationServerInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.WorkloadsClient`'s + :attr:`sap_application_server_instances` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = 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( @@ -261,7 +264,7 @@ def get( sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any - ) -> "_models.SAPApplicationServerInstance": + ) -> _models.SAPApplicationServerInstance: """Gets the SAP Application Server Instance. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -275,13 +278,16 @@ def get( :rtype: ~azure.mgmt.workloads.models.SAPApplicationServerInstance :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPApplicationServerInstance] request = build_get_request( @@ -291,11 +297,13 @@ def get( application_instance_name=application_instance_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -322,17 +330,20 @@ def _create_initial( resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, - body: Optional["_models.SAPApplicationServerInstance"] = None, + body: Optional[_models.SAPApplicationServerInstance] = None, **kwargs: Any - ) -> "_models.SAPApplicationServerInstance": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] + ) -> _models.SAPApplicationServerInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPApplicationServerInstance] if body is not None: _json = self._serialize.body(body, 'SAPApplicationServerInstance') @@ -348,11 +359,13 @@ def _create_initial( content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -383,9 +396,9 @@ def begin_create( resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, - body: Optional["_models.SAPApplicationServerInstance"] = None, + body: Optional[_models.SAPApplicationServerInstance] = None, **kwargs: Any - ) -> LROPoller["_models.SAPApplicationServerInstance"]: + ) -> LROPoller[_models.SAPApplicationServerInstance]: """Puts the SAP Application Server Instance. :code:`
`:code:`
`This will be used by service only. PUT by end user will return a Bad Request error. @@ -411,17 +424,20 @@ def begin_create( ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPApplicationServerInstance] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPApplicationServerInstance] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, application_instance_name=application_instance_name, @@ -429,20 +445,27 @@ def begin_create( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SAPApplicationServerInstance', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -460,17 +483,20 @@ def _update_initial( resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, - body: Optional["_models.UpdateSAPApplicationInstanceRequest"] = None, + body: Optional[_models.UpdateSAPApplicationInstanceRequest] = None, **kwargs: Any - ) -> "_models.SAPApplicationServerInstance": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] + ) -> _models.SAPApplicationServerInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPApplicationServerInstance] if body is not None: _json = self._serialize.body(body, 'UpdateSAPApplicationInstanceRequest') @@ -486,11 +512,13 @@ def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -521,9 +549,9 @@ def begin_update( resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, - body: Optional["_models.UpdateSAPApplicationInstanceRequest"] = None, + body: Optional[_models.UpdateSAPApplicationInstanceRequest] = None, **kwargs: Any - ) -> LROPoller["_models.SAPApplicationServerInstance"]: + ) -> LROPoller[_models.SAPApplicationServerInstance]: """Puts the SAP Application Server Instance. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -548,17 +576,20 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPApplicationServerInstance] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPApplicationServerInstance] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, application_instance_name=application_instance_name, @@ -566,20 +597,27 @@ def begin_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SAPApplicationServerInstance', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -598,14 +636,17 @@ def _delete_initial( sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any - ) -> Optional["_models.OperationStatusResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + ) -> Optional[_models.OperationStatusResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.OperationStatusResult]] request = build_delete_request_initial( @@ -615,11 +656,13 @@ def _delete_initial( application_instance_name=application_instance_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -649,7 +692,7 @@ def begin_delete( sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any - ) -> LROPoller["_models.OperationStatusResult"]: + ) -> LROPoller[_models.OperationStatusResult]: """Deletes the SAP Application Server Instance. :code:`
`:code:`
`This operation will be used by service only. Delete by end user will return a Bad Request error. @@ -672,35 +715,45 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatusResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, application_instance_name=application_instance_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -719,7 +772,7 @@ def list( resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> Iterable["_models.SAPApplicationServerInstanceList"]: + ) -> Iterable[_models.SAPApplicationServerInstanceList]: """Lists the SAP Application server Instances in an SVI. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -733,13 +786,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.SAPApplicationServerInstanceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPApplicationServerInstanceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstanceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -749,9 +805,11 @@ def prepare_request(next_link=None): sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -761,9 +819,11 @@ def prepare_request(next_link=None): sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_central_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_central_instances_operations.py index 73eafd5806ba..5a9c00a684e2 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_central_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_central_instances_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from .._vendor import MixinABC, _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_request( central_instance_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -51,18 +54,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -73,14 +74,17 @@ def build_create_request_initial( sap_virtual_instance_name: str, central_instance_name: str, *, - json: JSONType = None, + json: Optional[_models.SAPCentralServerInstance] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -93,20 +97,18 @@ def build_create_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -119,14 +121,17 @@ def build_update_request_initial( sap_virtual_instance_name: str, central_instance_name: str, *, - json: JSONType = None, + json: Optional[_models.UpdateSAPCentralInstanceRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -139,20 +144,18 @@ def build_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -166,9 +169,12 @@ def build_delete_request_initial( central_instance_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -181,18 +187,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -203,9 +207,12 @@ def build_list_request( sap_virtual_instance_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances") # pylint: disable=line-too-long path_format_arguments = { @@ -217,42 +224,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SAPCentralInstancesOperations(object): - """SAPCentralInstancesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SAPCentralInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.WorkloadsClient`'s + :attr:`sap_central_instances` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = 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( @@ -261,7 +264,7 @@ def get( sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any - ) -> "_models.SAPCentralServerInstance": + ) -> _models.SAPCentralServerInstance: """Gets the SAP Central Instance. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -276,13 +279,16 @@ def get( :rtype: ~azure.mgmt.workloads.models.SAPCentralServerInstance :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPCentralServerInstance] request = build_get_request( @@ -292,11 +298,13 @@ def get( central_instance_name=central_instance_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -323,17 +331,20 @@ def _create_initial( resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, - body: Optional["_models.SAPCentralServerInstance"] = None, + body: Optional[_models.SAPCentralServerInstance] = None, **kwargs: Any - ) -> "_models.SAPCentralServerInstance": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] + ) -> _models.SAPCentralServerInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPCentralServerInstance] if body is not None: _json = self._serialize.body(body, 'SAPCentralServerInstance') @@ -349,11 +360,13 @@ def _create_initial( content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -384,9 +397,9 @@ def begin_create( resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, - body: Optional["_models.SAPCentralServerInstance"] = None, + body: Optional[_models.SAPCentralServerInstance] = None, **kwargs: Any - ) -> LROPoller["_models.SAPCentralServerInstance"]: + ) -> LROPoller[_models.SAPCentralServerInstance]: """Puts the SAP Central Instance. :code:`
`:code:`
`This will be used by service only. PUT by end user will return a Bad Request error. @@ -412,17 +425,20 @@ def begin_create( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPCentralServerInstance] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPCentralServerInstance] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, central_instance_name=central_instance_name, @@ -430,20 +446,27 @@ def begin_create( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SAPCentralServerInstance', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -461,17 +484,20 @@ def _update_initial( resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, - body: Optional["_models.UpdateSAPCentralInstanceRequest"] = None, + body: Optional[_models.UpdateSAPCentralInstanceRequest] = None, **kwargs: Any - ) -> "_models.SAPCentralServerInstance": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] + ) -> _models.SAPCentralServerInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPCentralServerInstance] if body is not None: _json = self._serialize.body(body, 'UpdateSAPCentralInstanceRequest') @@ -487,11 +513,13 @@ def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -522,9 +550,9 @@ def begin_update( resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, - body: Optional["_models.UpdateSAPCentralInstanceRequest"] = None, + body: Optional[_models.UpdateSAPCentralInstanceRequest] = None, **kwargs: Any - ) -> LROPoller["_models.SAPCentralServerInstance"]: + ) -> LROPoller[_models.SAPCentralServerInstance]: """Updates the SAP Central Instance. :code:`
`:code:`
`This can be used to update tags. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -549,17 +577,20 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPCentralServerInstance] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPCentralServerInstance] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, central_instance_name=central_instance_name, @@ -567,20 +598,27 @@ def begin_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SAPCentralServerInstance', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -599,14 +637,17 @@ def _delete_initial( sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any - ) -> Optional["_models.OperationStatusResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + ) -> Optional[_models.OperationStatusResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.OperationStatusResult]] request = build_delete_request_initial( @@ -616,11 +657,13 @@ def _delete_initial( central_instance_name=central_instance_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -650,7 +693,7 @@ def begin_delete( sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any - ) -> LROPoller["_models.OperationStatusResult"]: + ) -> LROPoller[_models.OperationStatusResult]: """Deletes the SAP Central Instance. :code:`
`:code:`
`This will be used by service only. Delete by end user will return a Bad Request error. @@ -674,35 +717,45 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatusResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, central_instance_name=central_instance_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -721,7 +774,7 @@ def list( resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> Iterable["_models.SAPCentralInstanceList"]: + ) -> Iterable[_models.SAPCentralInstanceList]: """Lists the SAP Central Instances in an SVI. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -734,13 +787,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.SAPCentralInstanceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPCentralInstanceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralInstanceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -750,9 +806,11 @@ def prepare_request(next_link=None): sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -762,9 +820,11 @@ def prepare_request(next_link=None): sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_database_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_database_instances_operations.py index 68495b6fcbb4..804f83d5738b 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_database_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_database_instances_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from .._vendor import MixinABC, _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_request( database_instance_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -51,18 +54,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -73,14 +74,17 @@ def build_create_request_initial( sap_virtual_instance_name: str, database_instance_name: str, *, - json: JSONType = None, + json: Optional[_models.SAPDatabaseInstance] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -93,20 +97,18 @@ def build_create_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -119,14 +121,17 @@ def build_update_request_initial( sap_virtual_instance_name: str, database_instance_name: str, *, - json: JSONType = None, + json: Optional[_models.UpdateSAPDatabaseInstanceRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -139,20 +144,18 @@ def build_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -166,9 +169,12 @@ def build_delete_request_initial( database_instance_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -181,18 +187,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -203,9 +207,12 @@ def build_list_request( sap_virtual_instance_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances") # pylint: disable=line-too-long path_format_arguments = { @@ -217,42 +224,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SAPDatabaseInstancesOperations(object): - """SAPDatabaseInstancesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SAPDatabaseInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.WorkloadsClient`'s + :attr:`sap_database_instances` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = 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( @@ -261,7 +264,7 @@ def get( sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any - ) -> "_models.SAPDatabaseInstance": + ) -> _models.SAPDatabaseInstance: """Gets the SAP Database Instance. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -276,13 +279,16 @@ def get( :rtype: ~azure.mgmt.workloads.models.SAPDatabaseInstance :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPDatabaseInstance] request = build_get_request( @@ -292,11 +298,13 @@ def get( database_instance_name=database_instance_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -323,17 +331,20 @@ def _create_initial( resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, - body: Optional["_models.SAPDatabaseInstance"] = None, + body: Optional[_models.SAPDatabaseInstance] = None, **kwargs: Any - ) -> "_models.SAPDatabaseInstance": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] + ) -> _models.SAPDatabaseInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPDatabaseInstance] if body is not None: _json = self._serialize.body(body, 'SAPDatabaseInstance') @@ -349,11 +360,13 @@ def _create_initial( content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -384,9 +397,9 @@ def begin_create( resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, - body: Optional["_models.SAPDatabaseInstance"] = None, + body: Optional[_models.SAPDatabaseInstance] = None, **kwargs: Any - ) -> LROPoller["_models.SAPDatabaseInstance"]: + ) -> LROPoller[_models.SAPDatabaseInstance]: """Puts the SAP Database Instance. :code:`
`:code:`
`This will be used by service only. PUT by end user will return a Bad Request error. @@ -412,17 +425,20 @@ def begin_create( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPDatabaseInstance] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPDatabaseInstance] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, database_instance_name=database_instance_name, @@ -430,20 +446,27 @@ def begin_create( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SAPDatabaseInstance', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -461,17 +484,20 @@ def _update_initial( resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, - body: Optional["_models.UpdateSAPDatabaseInstanceRequest"] = None, + body: Optional[_models.UpdateSAPDatabaseInstanceRequest] = None, **kwargs: Any - ) -> "_models.SAPDatabaseInstance": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] + ) -> _models.SAPDatabaseInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPDatabaseInstance] if body is not None: _json = self._serialize.body(body, 'UpdateSAPDatabaseInstanceRequest') @@ -487,11 +513,13 @@ def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -522,9 +550,9 @@ def begin_update( resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, - body: Optional["_models.UpdateSAPDatabaseInstanceRequest"] = None, + body: Optional[_models.UpdateSAPDatabaseInstanceRequest] = None, **kwargs: Any - ) -> LROPoller["_models.SAPDatabaseInstance"]: + ) -> LROPoller[_models.SAPDatabaseInstance]: """Puts the SAP Database Instance. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -549,17 +577,20 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPDatabaseInstance] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPDatabaseInstance] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, database_instance_name=database_instance_name, @@ -567,20 +598,27 @@ def begin_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SAPDatabaseInstance', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -599,14 +637,17 @@ def _delete_initial( sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any - ) -> Optional["_models.OperationStatusResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + ) -> Optional[_models.OperationStatusResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.OperationStatusResult]] request = build_delete_request_initial( @@ -616,11 +657,13 @@ def _delete_initial( database_instance_name=database_instance_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -650,7 +693,7 @@ def begin_delete( sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any - ) -> LROPoller["_models.OperationStatusResult"]: + ) -> LROPoller[_models.OperationStatusResult]: """Deletes the SAP Database Instance. :code:`
`:code:`
`This will be used by service only. Delete by end user will return a Bad Request error. @@ -674,35 +717,45 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatusResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, database_instance_name=database_instance_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -721,7 +774,7 @@ def list( resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> Iterable["_models.SAPDatabaseInstanceList"]: + ) -> Iterable[_models.SAPDatabaseInstanceList]: """Lists the SAP Database Instances in an SVI. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -734,13 +787,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.SAPDatabaseInstanceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPDatabaseInstanceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstanceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -750,9 +806,11 @@ def prepare_request(next_link=None): sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -762,9 +820,11 @@ def prepare_request(next_link=None): sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_virtual_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_virtual_instances_operations.py index 99f0b81d4481..57907cf2a6b6 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_virtual_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_virtual_instances_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from .._vendor import MixinABC, _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,14 +34,17 @@ def build_create_request_initial( resource_group_name: str, sap_virtual_instance_name: str, *, - json: JSONType = None, + json: Optional[_models.SAPVirtualInstance] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -79,9 +80,12 @@ def build_get_request( sap_virtual_instance_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -93,18 +97,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -114,14 +116,17 @@ def build_update_request( resource_group_name: str, sap_virtual_instance_name: str, *, - json: JSONType = None, + json: Optional[_models.UpdateSAPVirtualInstanceRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -133,20 +138,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -159,9 +162,12 @@ def build_delete_request_initial( sap_virtual_instance_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -173,18 +179,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances") # pylint: disable=line-too-long path_format_arguments = { @@ -207,18 +214,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -227,9 +232,12 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/sapVirtualInstances") path_format_arguments = { @@ -239,18 +247,16 @@ def build_list_by_subscription_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -261,9 +267,12 @@ def build_start_request_initial( sap_virtual_instance_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -275,18 +284,16 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -296,14 +303,17 @@ def build_stop_request_initial( resource_group_name: str, sap_virtual_instance_name: str, *, - json: JSONType = None, + json: Optional[_models.StopRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -315,62 +325,61 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class SAPVirtualInstancesOperations(object): - """SAPVirtualInstancesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SAPVirtualInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.WorkloadsClient`'s + :attr:`sap_virtual_instances` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + def _create_initial( self, resource_group_name: str, sap_virtual_instance_name: str, - body: Optional["_models.SAPVirtualInstance"] = None, + body: Optional[_models.SAPVirtualInstance] = None, **kwargs: Any - ) -> "_models.SAPVirtualInstance": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstance"] + ) -> _models.SAPVirtualInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPVirtualInstance] if body is not None: _json = self._serialize.body(body, 'SAPVirtualInstance') @@ -385,11 +394,13 @@ def _create_initial( content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -419,9 +430,9 @@ def begin_create( self, resource_group_name: str, sap_virtual_instance_name: str, - body: Optional["_models.SAPVirtualInstance"] = None, + body: Optional[_models.SAPVirtualInstance] = None, **kwargs: Any - ) -> LROPoller["_models.SAPVirtualInstance"]: + ) -> LROPoller[_models.SAPVirtualInstance]: """Creates an Virtual Instance for SAP. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -443,37 +454,47 @@ def begin_create( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPVirtualInstance] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPVirtualInstance] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstance"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, body=body, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SAPVirtualInstance', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -492,7 +513,7 @@ def get( resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> "_models.SAPVirtualInstance": + ) -> _models.SAPVirtualInstance: """Gets an Virtual Instance for SAP. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -504,13 +525,16 @@ def get( :rtype: ~azure.mgmt.workloads.models.SAPVirtualInstance :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstance"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPVirtualInstance] request = build_get_request( @@ -519,11 +543,13 @@ def get( sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -550,9 +576,9 @@ def update( self, resource_group_name: str, sap_virtual_instance_name: str, - body: Optional["_models.UpdateSAPVirtualInstanceRequest"] = None, + body: Optional[_models.UpdateSAPVirtualInstanceRequest] = None, **kwargs: Any - ) -> "_models.SAPVirtualInstance": + ) -> _models.SAPVirtualInstance: """Updates an Virtual Instance for SAP. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -566,14 +592,17 @@ def update( :rtype: ~azure.mgmt.workloads.models.SAPVirtualInstance :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstance"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPVirtualInstance] if body is not None: _json = self._serialize.body(body, 'UpdateSAPVirtualInstanceRequest') @@ -588,11 +617,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -619,14 +650,17 @@ def _delete_initial( resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> Optional["_models.OperationStatusResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + ) -> Optional[_models.OperationStatusResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.OperationStatusResult]] request = build_delete_request_initial( @@ -635,11 +669,13 @@ def _delete_initial( sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -668,7 +704,7 @@ def begin_delete( resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> LROPoller["_models.OperationStatusResult"]: + ) -> LROPoller[_models.OperationStatusResult]: """Deletes an Virtual Instance for SAP. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -688,34 +724,44 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatusResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -733,7 +779,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.SAPVirtualInstanceList"]: + ) -> Iterable[_models.SAPVirtualInstanceList]: """Gets all Virtual Instances for SAP in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -744,13 +790,16 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.SAPVirtualInstanceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPVirtualInstanceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstanceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -759,9 +808,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -770,9 +821,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -810,7 +863,7 @@ def get_next(next_link=None): def list_by_subscription( self, **kwargs: Any - ) -> Iterable["_models.SAPVirtualInstanceList"]: + ) -> Iterable[_models.SAPVirtualInstanceList]: """Gets all Virtual Instances for SAP in the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -819,13 +872,16 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.SAPVirtualInstanceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPVirtualInstanceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstanceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -833,9 +889,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -843,9 +901,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -884,14 +944,17 @@ def _start_initial( resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> Optional["_models.OperationStatusResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + ) -> Optional[_models.OperationStatusResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.OperationStatusResult]] request = build_start_request_initial( @@ -900,11 +963,13 @@ def _start_initial( sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -933,7 +998,7 @@ def begin_start( resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> LROPoller["_models.OperationStatusResult"]: + ) -> LROPoller[_models.OperationStatusResult]: """Starts the SAP System. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -953,34 +1018,44 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatusResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -997,17 +1072,20 @@ def _stop_initial( self, resource_group_name: str, sap_virtual_instance_name: str, - body: Optional["_models.StopRequest"] = None, + body: Optional[_models.StopRequest] = None, **kwargs: Any - ) -> Optional["_models.OperationStatusResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + ) -> Optional[_models.OperationStatusResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.OperationStatusResult]] if body is not None: _json = self._serialize.body(body, 'StopRequest') @@ -1022,11 +1100,13 @@ def _stop_initial( content_type=content_type, json=_json, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1054,9 +1134,9 @@ def begin_stop( self, resource_group_name: str, sap_virtual_instance_name: str, - body: Optional["_models.StopRequest"] = None, + body: Optional[_models.StopRequest] = None, **kwargs: Any - ) -> LROPoller["_models.OperationStatusResult"]: + ) -> LROPoller[_models.OperationStatusResult]: """Stops the SAP System. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1078,37 +1158,47 @@ def begin_stop( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatusResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, sap_virtual_instance_name=sap_virtual_instance_name, body=body, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('OperationStatusResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_skus_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_skus_operations.py index 8f383ae2bc26..22af38486c1b 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_skus_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_skus_operations.py @@ -16,10 +16,11 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import 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 .._vendor import _convert_request, _format_url_section +from .._vendor import MixinABC, _convert_request, _format_url_section T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -30,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/skus") path_format_arguments = { @@ -42,48 +46,44 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SkusOperations(object): - """SkusOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.WorkloadsClient`'s + :attr:`skus` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = 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.SkusListResult"]: + ) -> Iterable[_models.SkusListResult]: """Lists all the available SKUs under this PR. :keyword callable cls: A custom type or function that will be passed the direct response @@ -91,13 +91,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.SkusListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SkusListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SkusListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -105,9 +108,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -115,9 +120,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_wordpress_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_wordpress_instances_operations.py index 6d99c1b5dc38..c20e040036b0 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_wordpress_instances_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_wordpress_instances_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from .._vendor import MixinABC, _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( php_workload_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( php_workload_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -106,14 +108,17 @@ def build_create_or_update_request_initial( resource_group_name: str, php_workload_name: str, *, - json: JSONType = None, + json: Optional[_models.WordpressInstanceResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default") # pylint: disable=line-too-long path_format_arguments = { @@ -125,20 +130,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -151,9 +154,12 @@ def build_delete_request( php_workload_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default") # pylint: disable=line-too-long path_format_arguments = { @@ -165,42 +171,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class WordpressInstancesOperations(object): - """WordpressInstancesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class WordpressInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.workloads.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.WorkloadsClient`'s + :attr:`wordpress_instances` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = 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( @@ -208,7 +210,7 @@ def list( resource_group_name: str, php_workload_name: str, **kwargs: Any - ) -> Iterable["_models.WordpressInstanceResourceList"]: + ) -> Iterable[_models.WordpressInstanceResourceList]: """Lists WordPress instance resources under a phpWorkload resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -222,13 +224,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.WordpressInstanceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.WordpressInstanceResourceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.WordpressInstanceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -238,9 +243,11 @@ def prepare_request(next_link=None): php_workload_name=php_workload_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -250,9 +257,11 @@ def prepare_request(next_link=None): php_workload_name=php_workload_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -292,7 +301,7 @@ def get( resource_group_name: str, php_workload_name: str, **kwargs: Any - ) -> "_models.WordpressInstanceResource": + ) -> _models.WordpressInstanceResource: """Gets the WordPress instance resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -304,13 +313,16 @@ def get( :rtype: ~azure.mgmt.workloads.models.WordpressInstanceResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.WordpressInstanceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.WordpressInstanceResource] request = build_get_request( @@ -319,11 +331,13 @@ def get( php_workload_name=php_workload_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -349,17 +363,20 @@ def _create_or_update_initial( self, resource_group_name: str, php_workload_name: str, - wordpress_instance_resource: "_models.WordpressInstanceResource", + wordpress_instance_resource: _models.WordpressInstanceResource, **kwargs: Any - ) -> "_models.WordpressInstanceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.WordpressInstanceResource"] + ) -> _models.WordpressInstanceResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.WordpressInstanceResource] _json = self._serialize.body(wordpress_instance_resource, 'WordpressInstanceResource') @@ -371,11 +388,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -405,9 +424,9 @@ def begin_create_or_update( self, resource_group_name: str, php_workload_name: str, - wordpress_instance_resource: "_models.WordpressInstanceResource", + wordpress_instance_resource: _models.WordpressInstanceResource, **kwargs: Any - ) -> LROPoller["_models.WordpressInstanceResource"]: + ) -> LROPoller[_models.WordpressInstanceResource]: """Create or updated WordPress instance resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -429,37 +448,47 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.WordpressInstanceResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.WordpressInstanceResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.WordpressInstanceResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, php_workload_name=php_workload_name, wordpress_instance_resource=wordpress_instance_resource, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('WordpressInstanceResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -490,13 +519,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -505,11 +537,13 @@ def delete( # pylint: disable=inconsistent-return-statements php_workload_name=php_workload_name, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_workloads_client_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_workloads_client_operations.py index 74346da4a818..1406986d0c4f 100644 --- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_workloads_client_operations.py +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_workloads_client_operations.py @@ -15,12 +15,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import 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 .._vendor import _convert_request, _format_url_section +from .._vendor import MixinABC, _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -30,14 +30,17 @@ def build_sap_sizing_recommendations_request( subscription_id: str, location: str, *, - json: JSONType = None, + json: Optional[_models.SAPSizingRecommendationRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecommendations") # pylint: disable=line-too-long path_format_arguments = { @@ -48,20 +51,18 @@ def build_sap_sizing_recommendations_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -72,14 +73,17 @@ def build_sap_supported_sku_request( subscription_id: str, location: str, *, - json: JSONType = None, + json: Optional[_models.SAPSupportedSkusRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku") # pylint: disable=line-too-long path_format_arguments = { @@ -90,20 +94,18 @@ def build_sap_supported_sku_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -114,14 +116,17 @@ def build_sap_disk_configurations_request( subscription_id: str, location: str, *, - json: JSONType = None, + json: Optional[_models.SAPDiskConfigurationsRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -132,20 +137,18 @@ def build_sap_disk_configurations_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,14 +159,17 @@ def build_sap_availability_zone_details_request( subscription_id: str, location: str, *, - json: JSONType = None, + json: Optional[_models.SAPAvailabilityZoneDetailsRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails") # pylint: disable=line-too-long path_format_arguments = { @@ -174,34 +180,32 @@ def build_sap_availability_zone_details_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class WorkloadsClientOperationsMixin(object): +class WorkloadsClientOperationsMixin(MixinABC): @distributed_trace def sap_sizing_recommendations( self, location: str, - sap_sizing_recommendation: Optional["_models.SAPSizingRecommendationRequest"] = None, + sap_sizing_recommendation: Optional[_models.SAPSizingRecommendationRequest] = None, **kwargs: Any - ) -> "_models.SAPSizingRecommendationResult": + ) -> _models.SAPSizingRecommendationResult: """Get SAP sizing recommendations. :param location: The name of Azure region. @@ -214,14 +218,17 @@ def sap_sizing_recommendations( :rtype: ~azure.mgmt.workloads.models.SAPSizingRecommendationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPSizingRecommendationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPSizingRecommendationResult] if sap_sizing_recommendation is not None: _json = self._serialize.body(sap_sizing_recommendation, 'SAPSizingRecommendationRequest') @@ -235,11 +242,13 @@ def sap_sizing_recommendations( content_type=content_type, json=_json, template_url=self.sap_sizing_recommendations.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -265,9 +274,9 @@ def sap_sizing_recommendations( def sap_supported_sku( self, location: str, - sap_supported_sku: Optional["_models.SAPSupportedSkusRequest"] = None, + sap_supported_sku: Optional[_models.SAPSupportedSkusRequest] = None, **kwargs: Any - ) -> "_models.SAPSupportedResourceSkusResult": + ) -> _models.SAPSupportedResourceSkusResult: """Get SAP supported SKUs. :param location: The name of Azure region. @@ -279,14 +288,17 @@ def sap_supported_sku( :rtype: ~azure.mgmt.workloads.models.SAPSupportedResourceSkusResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPSupportedResourceSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPSupportedResourceSkusResult] if sap_supported_sku is not None: _json = self._serialize.body(sap_supported_sku, 'SAPSupportedSkusRequest') @@ -300,11 +312,13 @@ def sap_supported_sku( content_type=content_type, json=_json, template_url=self.sap_supported_sku.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -330,9 +344,9 @@ def sap_supported_sku( def sap_disk_configurations( self, location: str, - sap_disk_configurations: Optional["_models.SAPDiskConfigurationsRequest"] = None, + sap_disk_configurations: Optional[_models.SAPDiskConfigurationsRequest] = None, **kwargs: Any - ) -> "_models.SAPDiskConfigurationsResult": + ) -> _models.SAPDiskConfigurationsResult: """Get SAP Disk Configurations. :param location: The name of Azure region. @@ -344,14 +358,17 @@ def sap_disk_configurations( :rtype: ~azure.mgmt.workloads.models.SAPDiskConfigurationsResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDiskConfigurationsResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPDiskConfigurationsResult] if sap_disk_configurations is not None: _json = self._serialize.body(sap_disk_configurations, 'SAPDiskConfigurationsRequest') @@ -365,11 +382,13 @@ def sap_disk_configurations( content_type=content_type, json=_json, template_url=self.sap_disk_configurations.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -395,9 +414,9 @@ def sap_disk_configurations( def sap_availability_zone_details( self, location: str, - sap_availability_zone_details: Optional["_models.SAPAvailabilityZoneDetailsRequest"] = None, + sap_availability_zone_details: Optional[_models.SAPAvailabilityZoneDetailsRequest] = None, **kwargs: Any - ) -> "_models.SAPAvailabilityZoneDetailsResult": + ) -> _models.SAPAvailabilityZoneDetailsResult: """Get SAP Availability Zone Details. :param location: The name of Azure region. @@ -411,14 +430,17 @@ def sap_availability_zone_details( :rtype: ~azure.mgmt.workloads.models.SAPAvailabilityZoneDetailsResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPAvailabilityZoneDetailsResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SAPAvailabilityZoneDetailsResult] if sap_availability_zone_details is not None: _json = self._serialize.body(sap_availability_zone_details, 'SAPAvailabilityZoneDetailsRequest') @@ -432,11 +454,13 @@ def sap_availability_zone_details( content_type=content_type, json=_json, template_url=self.sap_availability_zone_details.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs