diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/_meta.json b/sdk/sql/azure-mgmt-sqlvirtualmachine/_meta.json index 1f7464aa83fd..96009e066001 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/_meta.json +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/_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": "08894fa8d66cb44dc62a73f7a09530f905985fa3", + "commit": "a23ca365833f062080a08c48b3babc7cdd19ab48", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/sqlvirtualmachine/resource-manager/readme.md --multiapi --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/sqlvirtualmachine/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/sqlvirtualmachine/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/__init__.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/__init__.py index a056e3f0c70b..feefbb1173f2 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/__init__.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/__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__ = ['SqlVirtualMachineManagementClient'] +__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/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_configuration.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_configuration.py index ac6081c3f47c..7bc5d5d77bd8 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_configuration.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_configuration.py @@ -29,8 +29,8 @@ class SqlVirtualMachineManagementClientConfiguration(Configuration): # pylint: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription ID that identifies an Azure subscription. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-02-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ @@ -41,7 +41,7 @@ def __init__( **kwargs: Any ) -> None: super(SqlVirtualMachineManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', "2022-02-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_metadata.json b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_metadata.json deleted file mode 100644 index 18c683eb114e..000000000000 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_metadata.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "chosen_version": "2021-11-01-preview", - "total_api_version_list": ["2021-11-01-preview"], - "client": { - "name": "SqlVirtualMachineManagementClient", - "filename": "_sql_virtual_machine_management_client", - "description": "The SQL virtual machine management API provides a RESTful set of web APIs that interact with Azure Compute, Network \u0026 Storage services to manage your SQL Server virtual machine. The API enables users to create, delete and retrieve a SQL virtual machine, SQL virtual machine group or availability group listener.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SqlVirtualMachineManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SqlVirtualMachineManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription ID that identifies an Azure subscription.", - "docstring_type": "str", - "required": true - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Subscription ID that identifies an Azure subscription.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "availability_group_listeners": "AvailabilityGroupListenersOperations", - "operations": "Operations", - "sql_virtual_machine_groups": "SqlVirtualMachineGroupsOperations", - "sql_virtual_machines": "SqlVirtualMachinesOperations" - } -} \ No newline at end of file diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_sql_virtual_machine_management_client.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_sql_virtual_machine_management_client.py index 1c1b4d6e1379..eff3267fd2e1 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_sql_virtual_machine_management_client.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_sql_virtual_machine_management_client.py @@ -45,8 +45,8 @@ class SqlVirtualMachineManagementClient: :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-02-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -66,10 +66,18 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.availability_group_listeners = AvailabilityGroupListenersOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.sql_virtual_machine_groups = SqlVirtualMachineGroupsOperations(self._client, self._config, self._serialize, self._deserialize) - self.sql_virtual_machines = SqlVirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.availability_group_listeners = AvailabilityGroupListenersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sql_virtual_machine_groups = SqlVirtualMachineGroupsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sql_virtual_machines = SqlVirtualMachinesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_version.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_version.py index 20971492f129..e5754a47ce68 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_version.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b3" +VERSION = "1.0.0b1" diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/__init__.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/__init__.py index 44ab4c13e048..b7f528a0c2f6 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/__init__.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._sql_virtual_machine_management_client import SqlVirtualMachineManagementClient + +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__ = ['SqlVirtualMachineManagementClient'] +__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/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/_configuration.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/_configuration.py index dd9a63708bcf..7bc29c24abb6 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/_configuration.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/_configuration.py @@ -29,8 +29,8 @@ class SqlVirtualMachineManagementClientConfiguration(Configuration): # pylint: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription ID that identifies an Azure subscription. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-02-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ @@ -41,7 +41,7 @@ def __init__( **kwargs: Any ) -> None: super(SqlVirtualMachineManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', "2022-02-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/_sql_virtual_machine_management_client.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/_sql_virtual_machine_management_client.py index 64151b7cd8c8..39e760f403a6 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/_sql_virtual_machine_management_client.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/_sql_virtual_machine_management_client.py @@ -45,8 +45,8 @@ class SqlVirtualMachineManagementClient: :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-02-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -66,10 +66,18 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.availability_group_listeners = AvailabilityGroupListenersOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.sql_virtual_machine_groups = SqlVirtualMachineGroupsOperations(self._client, self._config, self._serialize, self._deserialize) - self.sql_virtual_machines = SqlVirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.availability_group_listeners = AvailabilityGroupListenersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sql_virtual_machine_groups = SqlVirtualMachineGroupsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sql_virtual_machines = SqlVirtualMachinesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/__init__.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/__init__.py index c54af11a6331..e100b0ff6420 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/__init__.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/__init__.py @@ -11,9 +11,14 @@ from ._sql_virtual_machine_groups_operations import SqlVirtualMachineGroupsOperations from ._sql_virtual_machines_operations import SqlVirtualMachinesOperations +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__ = [ 'AvailabilityGroupListenersOperations', 'Operations', 'SqlVirtualMachineGroupsOperations', 'SqlVirtualMachinesOperations', ] +__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/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_availability_group_listeners_operations.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_availability_group_listeners_operations.py index fc8f952198d1..6848671115de 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_availability_group_listeners_operations.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_availability_group_listeners_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,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AvailabilityGroupListenersOperations: - """AvailabilityGroupListenersOperations 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.sqlvirtualmachine.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.sqlvirtualmachine.aio.SqlVirtualMachineManagementClient`'s + :attr:`availability_group_listeners` 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( @@ -55,7 +54,7 @@ async def get( availability_group_listener_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> "_models.AvailabilityGroupListener": + ) -> _models.AvailabilityGroupListener: """Gets an availability group listener. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -72,13 +71,16 @@ async def get( :rtype: ~azure.mgmt.sqlvirtualmachine.models.AvailabilityGroupListener :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilityGroupListener"] 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-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AvailabilityGroupListener] request = build_get_request( @@ -89,11 +91,13 @@ async def get( api_version=api_version, expand=expand, 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 @@ -119,17 +123,20 @@ async def _create_or_update_initial( resource_group_name: str, sql_virtual_machine_group_name: str, availability_group_listener_name: str, - parameters: "_models.AvailabilityGroupListener", + parameters: _models.AvailabilityGroupListener, **kwargs: Any - ) -> "_models.AvailabilityGroupListener": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilityGroupListener"] + ) -> _models.AvailabilityGroupListener: 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-11-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', "2022-02-01")) # 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.AvailabilityGroupListener] _json = self._serialize.body(parameters, 'AvailabilityGroupListener') @@ -142,11 +149,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 @@ -177,9 +186,9 @@ async def begin_create_or_update( resource_group_name: str, sql_virtual_machine_group_name: str, availability_group_listener_name: str, - parameters: "_models.AvailabilityGroupListener", + parameters: _models.AvailabilityGroupListener, **kwargs: Any - ) -> AsyncLROPoller["_models.AvailabilityGroupListener"]: + ) -> AsyncLROPoller[_models.AvailabilityGroupListener]: """Creates or updates an availability group listener. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -205,17 +214,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sqlvirtualmachine.models.AvailabilityGroupListener] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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.AvailabilityGroupListener] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilityGroupListener"] lro_delay = kwargs.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, sql_virtual_machine_group_name=sql_virtual_machine_group_name, availability_group_listener_name=availability_group_listener_name, @@ -223,20 +235,27 @@ async def begin_create_or_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('AvailabilityGroupListener', 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( @@ -256,13 +275,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements availability_group_listener_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -272,11 +294,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, 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 @@ -322,21 +346,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-11-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', "2022-02-01")) # 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, sql_virtual_machine_group_name=sql_virtual_machine_group_name, availability_group_listener_name=availability_group_listener_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -346,8 +375,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - 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( @@ -366,7 +401,7 @@ def list_by_group( resource_group_name: str, sql_virtual_machine_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AvailabilityGroupListenerListResult"]: + ) -> AsyncIterable[_models.AvailabilityGroupListenerListResult]: """Lists all availability group listeners in a SQL virtual machine group. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -381,13 +416,16 @@ def list_by_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sqlvirtualmachine.models.AvailabilityGroupListenerListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AvailabilityGroupListenerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilityGroupListenerListResult"] 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: @@ -397,9 +435,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_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: @@ -409,9 +449,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/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_operations.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_operations.py index c738502df99e..e0e654056a66 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_operations.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ 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.sqlvirtualmachine.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.sqlvirtualmachine.aio.SqlVirtualMachineManagementClient`'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 of the available SQL Virtual Machine Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sqlvirtualmachine.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_patch.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/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/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_sql_virtual_machine_groups_operations.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_sql_virtual_machine_groups_operations.py index 00cf1f29cfb1..80138af682cf 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_sql_virtual_machine_groups_operations.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_sql_virtual_machine_groups_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,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SqlVirtualMachineGroupsOperations: - """SqlVirtualMachineGroupsOperations 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.sqlvirtualmachine.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.sqlvirtualmachine.aio.SqlVirtualMachineManagementClient`'s + :attr:`sql_virtual_machine_groups` 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( @@ -53,7 +52,7 @@ async def get( resource_group_name: str, sql_virtual_machine_group_name: str, **kwargs: Any - ) -> "_models.SqlVirtualMachineGroup": + ) -> _models.SqlVirtualMachineGroup: """Gets a SQL virtual machine group. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -66,13 +65,16 @@ async def get( :rtype: ~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineGroup"] 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-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlVirtualMachineGroup] request = build_get_request( @@ -81,11 +83,13 @@ async def get( subscription_id=self._config.subscription_id, 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 @@ -110,17 +114,20 @@ async def _create_or_update_initial( self, resource_group_name: str, sql_virtual_machine_group_name: str, - parameters: "_models.SqlVirtualMachineGroup", + parameters: _models.SqlVirtualMachineGroup, **kwargs: Any - ) -> "_models.SqlVirtualMachineGroup": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineGroup"] + ) -> _models.SqlVirtualMachineGroup: 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-11-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', "2022-02-01")) # 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.SqlVirtualMachineGroup] _json = self._serialize.body(parameters, 'SqlVirtualMachineGroup') @@ -132,11 +139,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 @@ -166,9 +175,9 @@ async def begin_create_or_update( self, resource_group_name: str, sql_virtual_machine_group_name: str, - parameters: "_models.SqlVirtualMachineGroup", + parameters: _models.SqlVirtualMachineGroup, **kwargs: Any - ) -> AsyncLROPoller["_models.SqlVirtualMachineGroup"]: + ) -> AsyncLROPoller[_models.SqlVirtualMachineGroup]: """Creates or updates a SQL virtual machine group. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -192,37 +201,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineGroup] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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.SqlVirtualMachineGroup] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineGroup"] lro_delay = kwargs.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, sql_virtual_machine_group_name=sql_virtual_machine_group_name, parameters=parameters, 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('SqlVirtualMachineGroup', 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( @@ -241,13 +260,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements sql_virtual_machine_group_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -256,11 +278,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, 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 @@ -303,20 +327,25 @@ 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-11-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', "2022-02-01")) # 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, sql_virtual_machine_group_name=sql_virtual_machine_group_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -326,8 +355,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - 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( @@ -344,17 +379,20 @@ async def _update_initial( self, resource_group_name: str, sql_virtual_machine_group_name: str, - parameters: "_models.SqlVirtualMachineGroupUpdate", + parameters: _models.SqlVirtualMachineGroupUpdate, **kwargs: Any - ) -> "_models.SqlVirtualMachineGroup": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineGroup"] + ) -> _models.SqlVirtualMachineGroup: 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-11-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', "2022-02-01")) # 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.SqlVirtualMachineGroup] _json = self._serialize.body(parameters, 'SqlVirtualMachineGroupUpdate') @@ -366,11 +404,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 @@ -396,9 +436,9 @@ async def begin_update( self, resource_group_name: str, sql_virtual_machine_group_name: str, - parameters: "_models.SqlVirtualMachineGroupUpdate", + parameters: _models.SqlVirtualMachineGroupUpdate, **kwargs: Any - ) -> AsyncLROPoller["_models.SqlVirtualMachineGroup"]: + ) -> AsyncLROPoller[_models.SqlVirtualMachineGroup]: """Updates SQL virtual machine group tags. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -422,37 +462,47 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineGroup] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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.SqlVirtualMachineGroup] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineGroup"] lro_delay = kwargs.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, sql_virtual_machine_group_name=sql_virtual_machine_group_name, parameters=parameters, 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('SqlVirtualMachineGroup', 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( @@ -470,7 +520,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SqlVirtualMachineGroupListResult"]: + ) -> AsyncIterable[_models.SqlVirtualMachineGroupListResult]: """Gets all SQL virtual machine groups in a resource group. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -483,13 +533,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlVirtualMachineGroupListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineGroupListResult"] 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: @@ -498,9 +551,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, 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: @@ -509,9 +564,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 @@ -548,7 +605,7 @@ async def get_next(next_link=None): def list( self, **kwargs: Any - ) -> AsyncIterable["_models.SqlVirtualMachineGroupListResult"]: + ) -> AsyncIterable[_models.SqlVirtualMachineGroupListResult]: """Gets all SQL virtual machine groups in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -558,13 +615,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlVirtualMachineGroupListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineGroupListResult"] 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: @@ -572,9 +632,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: @@ -582,9 +644,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/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_sql_virtual_machines_operations.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_sql_virtual_machines_operations.py index 45cc0da41563..ec376adb6c32 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_sql_virtual_machines_operations.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_sql_virtual_machines_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,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SqlVirtualMachinesOperations: - """SqlVirtualMachinesOperations 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.sqlvirtualmachine.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.sqlvirtualmachine.aio.SqlVirtualMachineManagementClient`'s + :attr:`sql_virtual_machines` 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_sql_vm_group( @@ -53,7 +52,7 @@ def list_by_sql_vm_group( resource_group_name: str, sql_virtual_machine_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SqlVirtualMachineListResult"]: + ) -> AsyncIterable[_models.SqlVirtualMachineListResult]: """Gets the list of sql virtual machines in a SQL virtual machine group. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -68,13 +67,16 @@ def list_by_sql_vm_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlVirtualMachineListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineListResult"] 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: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_sql_vm_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: @@ -96,9 +100,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 @@ -135,7 +141,7 @@ async def get_next(next_link=None): def list( self, **kwargs: Any - ) -> AsyncIterable["_models.SqlVirtualMachineListResult"]: + ) -> AsyncIterable[_models.SqlVirtualMachineListResult]: """Gets all SQL virtual machines in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -145,13 +151,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlVirtualMachineListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineListResult"] 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: @@ -159,9 +168,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: @@ -169,9 +180,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 @@ -204,111 +217,6 @@ async def get_next(next_link=None): ) list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines"} # type: ignore - async def _redeploy_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - sql_virtual_machine_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - - - request = build_redeploy_request_initial( - resource_group_name=resource_group_name, - sql_virtual_machine_name=sql_virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._redeploy_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _redeploy_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy"} # type: ignore - - - @distributed_trace_async - async def begin_redeploy( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - sql_virtual_machine_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Uninstalls and reinstalls the SQL Iaas Extension. - - :param resource_group_name: Name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param sql_virtual_machine_name: Name of the SQL virtual machine. - :type sql_virtual_machine_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._redeploy_initial( - resource_group_name=resource_group_name, - sql_virtual_machine_name=sql_virtual_machine_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy"} # type: ignore - @distributed_trace_async async def get( self, @@ -316,7 +224,7 @@ async def get( sql_virtual_machine_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> "_models.SqlVirtualMachine": + ) -> _models.SqlVirtualMachine: """Gets a SQL virtual machine. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -331,13 +239,16 @@ async def get( :rtype: ~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachine :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachine"] 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-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlVirtualMachine] request = build_get_request( @@ -347,11 +258,13 @@ async def get( api_version=api_version, expand=expand, 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 @@ -376,17 +289,20 @@ async def _create_or_update_initial( self, resource_group_name: str, sql_virtual_machine_name: str, - parameters: "_models.SqlVirtualMachine", + parameters: _models.SqlVirtualMachine, **kwargs: Any - ) -> "_models.SqlVirtualMachine": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachine"] + ) -> _models.SqlVirtualMachine: 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-11-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', "2022-02-01")) # 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.SqlVirtualMachine] _json = self._serialize.body(parameters, 'SqlVirtualMachine') @@ -398,11 +314,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 @@ -432,9 +350,9 @@ async def begin_create_or_update( self, resource_group_name: str, sql_virtual_machine_name: str, - parameters: "_models.SqlVirtualMachine", + parameters: _models.SqlVirtualMachine, **kwargs: Any - ) -> AsyncLROPoller["_models.SqlVirtualMachine"]: + ) -> AsyncLROPoller[_models.SqlVirtualMachine]: """Creates or updates a SQL virtual machine. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -458,37 +376,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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.SqlVirtualMachine] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachine"] lro_delay = kwargs.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, sql_virtual_machine_name=sql_virtual_machine_name, parameters=parameters, 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('SqlVirtualMachine', 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( @@ -507,13 +435,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements sql_virtual_machine_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -522,11 +453,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, 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 @@ -569,20 +502,25 @@ 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-11-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', "2022-02-01")) # 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, sql_virtual_machine_name=sql_virtual_machine_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -592,8 +530,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - 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( @@ -610,17 +554,20 @@ async def _update_initial( self, resource_group_name: str, sql_virtual_machine_name: str, - parameters: "_models.SqlVirtualMachineUpdate", + parameters: _models.SqlVirtualMachineUpdate, **kwargs: Any - ) -> "_models.SqlVirtualMachine": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachine"] + ) -> _models.SqlVirtualMachine: 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-11-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', "2022-02-01")) # 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.SqlVirtualMachine] _json = self._serialize.body(parameters, 'SqlVirtualMachineUpdate') @@ -632,11 +579,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 @@ -662,9 +611,9 @@ async def begin_update( self, resource_group_name: str, sql_virtual_machine_name: str, - parameters: "_models.SqlVirtualMachineUpdate", + parameters: _models.SqlVirtualMachineUpdate, **kwargs: Any - ) -> AsyncLROPoller["_models.SqlVirtualMachine"]: + ) -> AsyncLROPoller[_models.SqlVirtualMachine]: """Updates a SQL virtual machine. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -688,37 +637,47 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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.SqlVirtualMachine] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachine"] lro_delay = kwargs.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, sql_virtual_machine_name=sql_virtual_machine_name, parameters=parameters, 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('SqlVirtualMachine', 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( @@ -736,7 +695,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SqlVirtualMachineListResult"]: + ) -> AsyncIterable[_models.SqlVirtualMachineListResult]: """Gets all SQL virtual machines in a resource group. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -749,13 +708,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlVirtualMachineListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineListResult"] 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: @@ -764,9 +726,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, 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: @@ -775,9 +739,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 @@ -810,19 +776,143 @@ async def get_next(next_link=None): ) list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines"} # type: ignore - async def _start_assessment_initial( # pylint: disable=inconsistent-return-statements + async def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, sql_virtual_machine_name: str, **kwargs: Any ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + sql_virtual_machine_name=sql_virtual_machine_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._redeploy_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _redeploy_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy"} # type: ignore + + + @distributed_trace_async + async def begin_redeploy( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + sql_virtual_machine_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Uninstalls and reinstalls the SQL Iaas Extension. + + :param resource_group_name: Name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param sql_virtual_machine_name: Name of the SQL virtual machine. + :type sql_virtual_machine_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # 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._redeploy_initial( # type: ignore + resource_group_name=resource_group_name, + sql_virtual_machine_name=sql_virtual_machine_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): + if cls: + return cls(pipeline_response, None, {}) + + + 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( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy"} # type: ignore + + async def _start_assessment_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + sql_virtual_machine_name: str, + **kwargs: Any + ) -> 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-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_assessment_request_initial( @@ -831,11 +921,13 @@ async def _start_assessment_initial( # pylint: disable=inconsistent-return-stat subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._start_assessment_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 @@ -878,20 +970,25 @@ async def begin_start_assessment( # pylint: disable=inconsistent-return-stateme :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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._start_assessment_initial( + raw_result = await self._start_assessment_initial( # type: ignore resource_group_name=resource_group_name, sql_virtual_machine_name=sql_virtual_machine_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -901,8 +998,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - 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/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/models/__init__.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/models/__init__.py index e3ea193416eb..899526025c4d 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/models/__init__.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/models/__init__.py @@ -16,6 +16,7 @@ from ._models_py3 import AvailabilityGroupListenerListResult from ._models_py3 import KeyVaultCredentialSettings from ._models_py3 import LoadBalancerConfiguration +from ._models_py3 import MultiSubnetIpConfiguration from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult @@ -50,6 +51,7 @@ BackupScheduleType, ClusterConfiguration, ClusterManagerType, + ClusterSubnetType, Commit, ConnectivityType, CreatedByType, @@ -69,7 +71,9 @@ SqlWorkloadType, StorageWorkloadType, ) - +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__ = [ 'AdditionalFeaturesServerConfigurations', 'AgConfiguration', @@ -81,6 +85,7 @@ 'AvailabilityGroupListenerListResult', 'KeyVaultCredentialSettings', 'LoadBalancerConfiguration', + 'MultiSubnetIpConfiguration', 'Operation', 'OperationDisplay', 'OperationListResult', @@ -112,6 +117,7 @@ 'BackupScheduleType', 'ClusterConfiguration', 'ClusterManagerType', + 'ClusterSubnetType', 'Commit', 'ConnectivityType', 'CreatedByType', @@ -131,3 +137,5 @@ 'SqlWorkloadType', 'StorageWorkloadType', ] +__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/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/models/_models_py3.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/models/_models_py3.py index 95cd7b0c3f24..84fcc592f261 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/models/_models_py3.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._sql_virtual_machine_management_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class AdditionalFeaturesServerConfigurations(msrest.serialization.Model): @@ -42,28 +44,26 @@ def __init__( class AgConfiguration(msrest.serialization.Model): """Availability group configuration. - Variables are only populated by the server, and will be ignored when sending a request. - :ivar replicas: Replica configurations. :vartype replicas: list[~azure.mgmt.sqlvirtualmachine.models.AgReplica] """ - _validation = { - 'replicas': {'readonly': True}, - } - _attribute_map = { 'replicas': {'key': 'replicas', 'type': '[AgReplica]'}, } def __init__( self, + *, + replicas: Optional[List["_models.AgReplica"]] = None, **kwargs ): """ + :keyword replicas: Replica configurations. + :paramtype replicas: list[~azure.mgmt.sqlvirtualmachine.models.AgReplica] """ super(AgConfiguration, self).__init__(**kwargs) - self.replicas = None + self.replicas = replicas class AgReplica(msrest.serialization.Model): @@ -71,17 +71,16 @@ class AgReplica(msrest.serialization.Model): :ivar sql_virtual_machine_instance_id: Sql VirtualMachine Instance Id. :vartype sql_virtual_machine_instance_id: str - :ivar role: Replica Role in availability group. Possible values include: "PRIMARY", - "SECONDARY". + :ivar role: Replica Role in availability group. Known values are: "PRIMARY", "SECONDARY". :vartype role: str or ~azure.mgmt.sqlvirtualmachine.models.Role - :ivar commit: Replica commit mode in availability group. Possible values include: + :ivar commit: Replica commit mode in availability group. Known values are: "SYNCHRONOUS_COMMIT", "ASYNCHRONOUS_COMMIT". :vartype commit: str or ~azure.mgmt.sqlvirtualmachine.models.Commit - :ivar failover: Replica failover mode in availability group. Possible values include: - "AUTOMATIC", "MANUAL". + :ivar failover: Replica failover mode in availability group. Known values are: "AUTOMATIC", + "MANUAL". :vartype failover: str or ~azure.mgmt.sqlvirtualmachine.models.Failover - :ivar readable_secondary: Replica readable secondary mode in availability group. Possible - values include: "NO", "ALL", "READ_ONLY". + :ivar readable_secondary: Replica readable secondary mode in availability group. Known values + are: "NO", "ALL", "READ_ONLY". :vartype readable_secondary: str or ~azure.mgmt.sqlvirtualmachine.models.ReadableSecondary """ @@ -97,26 +96,25 @@ def __init__( self, *, sql_virtual_machine_instance_id: Optional[str] = None, - role: Optional[Union[str, "Role"]] = None, - commit: Optional[Union[str, "Commit"]] = None, - failover: Optional[Union[str, "Failover"]] = None, - readable_secondary: Optional[Union[str, "ReadableSecondary"]] = None, + role: Optional[Union[str, "_models.Role"]] = None, + commit: Optional[Union[str, "_models.Commit"]] = None, + failover: Optional[Union[str, "_models.Failover"]] = None, + readable_secondary: Optional[Union[str, "_models.ReadableSecondary"]] = None, **kwargs ): """ :keyword sql_virtual_machine_instance_id: Sql VirtualMachine Instance Id. :paramtype sql_virtual_machine_instance_id: str - :keyword role: Replica Role in availability group. Possible values include: "PRIMARY", - "SECONDARY". + :keyword role: Replica Role in availability group. Known values are: "PRIMARY", "SECONDARY". :paramtype role: str or ~azure.mgmt.sqlvirtualmachine.models.Role - :keyword commit: Replica commit mode in availability group. Possible values include: + :keyword commit: Replica commit mode in availability group. Known values are: "SYNCHRONOUS_COMMIT", "ASYNCHRONOUS_COMMIT". :paramtype commit: str or ~azure.mgmt.sqlvirtualmachine.models.Commit - :keyword failover: Replica failover mode in availability group. Possible values include: - "AUTOMATIC", "MANUAL". + :keyword failover: Replica failover mode in availability group. Known values are: "AUTOMATIC", + "MANUAL". :paramtype failover: str or ~azure.mgmt.sqlvirtualmachine.models.Failover - :keyword readable_secondary: Replica readable secondary mode in availability group. Possible - values include: "NO", "ALL", "READ_ONLY". + :keyword readable_secondary: Replica readable secondary mode in availability group. Known + values are: "NO", "ALL", "READ_ONLY". :paramtype readable_secondary: str or ~azure.mgmt.sqlvirtualmachine.models.ReadableSecondary """ super(AgReplica, self).__init__(**kwargs) @@ -149,7 +147,7 @@ def __init__( *, enable: Optional[bool] = None, run_immediately: Optional[bool] = None, - schedule: Optional["Schedule"] = None, + schedule: Optional["_models.Schedule"] = None, **kwargs ): """ @@ -185,11 +183,10 @@ class AutoBackupSettings(msrest.serialization.Model): :vartype password: str :ivar backup_system_dbs: Include or exclude system databases from auto backup. :vartype backup_system_dbs: bool - :ivar backup_schedule_type: Backup schedule type. Possible values include: "Manual", - "Automated". + :ivar backup_schedule_type: Backup schedule type. Known values are: "Manual", "Automated". :vartype backup_schedule_type: str or ~azure.mgmt.sqlvirtualmachine.models.BackupScheduleType :ivar full_backup_frequency: Frequency of full backups. In both cases, full backups begin - during the next scheduled time window. Possible values include: "Daily", "Weekly". + during the next scheduled time window. Known values are: "Daily", "Weekly". :vartype full_backup_frequency: str or ~azure.mgmt.sqlvirtualmachine.models.FullBackupFrequencyType :ivar days_of_week: Days of the week for the backups when FullBackupFrequency is set to Weekly. @@ -232,9 +229,9 @@ def __init__( storage_access_key: Optional[str] = None, password: Optional[str] = None, backup_system_dbs: Optional[bool] = None, - backup_schedule_type: Optional[Union[str, "BackupScheduleType"]] = None, - full_backup_frequency: Optional[Union[str, "FullBackupFrequencyType"]] = None, - days_of_week: Optional[List[Union[str, "AutoBackupDaysOfWeek"]]] = None, + backup_schedule_type: Optional[Union[str, "_models.BackupScheduleType"]] = None, + full_backup_frequency: Optional[Union[str, "_models.FullBackupFrequencyType"]] = None, + days_of_week: Optional[List[Union[str, "_models.AutoBackupDaysOfWeek"]]] = None, full_backup_start_time: Optional[int] = None, full_backup_window_hours: Optional[int] = None, log_backup_frequency: Optional[int] = None, @@ -257,11 +254,10 @@ def __init__( :paramtype password: str :keyword backup_system_dbs: Include or exclude system databases from auto backup. :paramtype backup_system_dbs: bool - :keyword backup_schedule_type: Backup schedule type. Possible values include: "Manual", - "Automated". + :keyword backup_schedule_type: Backup schedule type. Known values are: "Manual", "Automated". :paramtype backup_schedule_type: str or ~azure.mgmt.sqlvirtualmachine.models.BackupScheduleType :keyword full_backup_frequency: Frequency of full backups. In both cases, full backups begin - during the next scheduled time window. Possible values include: "Daily", "Weekly". + during the next scheduled time window. Known values are: "Daily", "Weekly". :paramtype full_backup_frequency: str or ~azure.mgmt.sqlvirtualmachine.models.FullBackupFrequencyType :keyword days_of_week: Days of the week for the backups when FullBackupFrequency is set to @@ -298,8 +294,8 @@ class AutoPatchingSettings(msrest.serialization.Model): :ivar enable: Enable or disable autopatching on SQL virtual machine. :vartype enable: bool - :ivar day_of_week: Day of week to apply the patch on. Possible values include: "Everyday", - "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday". + :ivar day_of_week: Day of week to apply the patch on. Known values are: "Everyday", "Monday", + "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday". :vartype day_of_week: str or ~azure.mgmt.sqlvirtualmachine.models.DayOfWeek :ivar maintenance_window_starting_hour: Hour of the day when patching is initiated. Local VM time. @@ -319,7 +315,7 @@ def __init__( self, *, enable: Optional[bool] = None, - day_of_week: Optional[Union[str, "DayOfWeek"]] = None, + day_of_week: Optional[Union[str, "_models.DayOfWeek"]] = None, maintenance_window_starting_hour: Optional[int] = None, maintenance_window_duration: Optional[int] = None, **kwargs @@ -327,7 +323,7 @@ def __init__( """ :keyword enable: Enable or disable autopatching on SQL virtual machine. :paramtype enable: bool - :keyword day_of_week: Day of week to apply the patch on. Possible values include: "Everyday", + :keyword day_of_week: Day of week to apply the patch on. Known values are: "Everyday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday". :paramtype day_of_week: str or ~azure.mgmt.sqlvirtualmachine.models.DayOfWeek :keyword maintenance_window_starting_hour: Hour of the day when patching is initiated. Local VM @@ -435,6 +431,10 @@ class AvailabilityGroupListener(ProxyResource): group listener. :vartype load_balancer_configurations: list[~azure.mgmt.sqlvirtualmachine.models.LoadBalancerConfiguration] + :ivar multi_subnet_ip_configurations: List of multi subnet IP configurations for an AG + listener. + :vartype multi_subnet_ip_configurations: + list[~azure.mgmt.sqlvirtualmachine.models.MultiSubnetIpConfiguration] :ivar create_default_availability_group_if_not_exist: Create a default availability group if it does not exist. :vartype create_default_availability_group_if_not_exist: bool @@ -460,6 +460,7 @@ class AvailabilityGroupListener(ProxyResource): 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'availability_group_name': {'key': 'properties.availabilityGroupName', 'type': 'str'}, 'load_balancer_configurations': {'key': 'properties.loadBalancerConfigurations', 'type': '[LoadBalancerConfiguration]'}, + 'multi_subnet_ip_configurations': {'key': 'properties.multiSubnetIpConfigurations', 'type': '[MultiSubnetIpConfiguration]'}, 'create_default_availability_group_if_not_exist': {'key': 'properties.createDefaultAvailabilityGroupIfNotExist', 'type': 'bool'}, 'port': {'key': 'properties.port', 'type': 'int'}, 'availability_group_configuration': {'key': 'properties.availabilityGroupConfiguration', 'type': 'AgConfiguration'}, @@ -469,10 +470,11 @@ def __init__( self, *, availability_group_name: Optional[str] = None, - load_balancer_configurations: Optional[List["LoadBalancerConfiguration"]] = None, + load_balancer_configurations: Optional[List["_models.LoadBalancerConfiguration"]] = None, + multi_subnet_ip_configurations: Optional[List["_models.MultiSubnetIpConfiguration"]] = None, create_default_availability_group_if_not_exist: Optional[bool] = None, port: Optional[int] = None, - availability_group_configuration: Optional["AgConfiguration"] = None, + availability_group_configuration: Optional["_models.AgConfiguration"] = None, **kwargs ): """ @@ -482,6 +484,10 @@ def __init__( group listener. :paramtype load_balancer_configurations: list[~azure.mgmt.sqlvirtualmachine.models.LoadBalancerConfiguration] + :keyword multi_subnet_ip_configurations: List of multi subnet IP configurations for an AG + listener. + :paramtype multi_subnet_ip_configurations: + list[~azure.mgmt.sqlvirtualmachine.models.MultiSubnetIpConfiguration] :keyword create_default_availability_group_if_not_exist: Create a default availability group if it does not exist. :paramtype create_default_availability_group_if_not_exist: bool @@ -496,6 +502,7 @@ def __init__( self.provisioning_state = None self.availability_group_name = availability_group_name self.load_balancer_configurations = load_balancer_configurations + self.multi_subnet_ip_configurations = multi_subnet_ip_configurations self.create_default_availability_group_if_not_exist = create_default_availability_group_if_not_exist self.port = port self.availability_group_configuration = availability_group_configuration @@ -613,7 +620,7 @@ class LoadBalancerConfiguration(msrest.serialization.Model): def __init__( self, *, - private_ip_address: Optional["PrivateIPAddress"] = None, + private_ip_address: Optional["_models.PrivateIPAddress"] = None, public_ip_address_resource_id: Optional[str] = None, load_balancer_resource_id: Optional[str] = None, probe_port: Optional[int] = None, @@ -641,6 +648,47 @@ def __init__( self.sql_virtual_machine_instances = sql_virtual_machine_instances +class MultiSubnetIpConfiguration(msrest.serialization.Model): + """Multi subnet ip configuration for an availability group listener. + + All required parameters must be populated in order to send to Azure. + + :ivar private_ip_address: Required. Private IP address. + :vartype private_ip_address: ~azure.mgmt.sqlvirtualmachine.models.PrivateIPAddress + :ivar sql_virtual_machine_instance: Required. SQL virtual machine instance resource id that are + enrolled into the availability group listener. + :vartype sql_virtual_machine_instance: str + """ + + _validation = { + 'private_ip_address': {'required': True}, + 'sql_virtual_machine_instance': {'required': True}, + } + + _attribute_map = { + 'private_ip_address': {'key': 'privateIpAddress', 'type': 'PrivateIPAddress'}, + 'sql_virtual_machine_instance': {'key': 'sqlVirtualMachineInstance', 'type': 'str'}, + } + + def __init__( + self, + *, + private_ip_address: "_models.PrivateIPAddress", + sql_virtual_machine_instance: str, + **kwargs + ): + """ + :keyword private_ip_address: Required. Private IP address. + :paramtype private_ip_address: ~azure.mgmt.sqlvirtualmachine.models.PrivateIPAddress + :keyword sql_virtual_machine_instance: Required. SQL virtual machine instance resource id that + are enrolled into the availability group listener. + :paramtype sql_virtual_machine_instance: str + """ + super(MultiSubnetIpConfiguration, self).__init__(**kwargs) + self.private_ip_address = private_ip_address + self.sql_virtual_machine_instance = sql_virtual_machine_instance + + class Operation(msrest.serialization.Model): """SQL REST API operation definition. @@ -650,8 +698,7 @@ class Operation(msrest.serialization.Model): :vartype name: str :ivar display: The localized display information for this particular operation / action. :vartype display: ~azure.mgmt.sqlvirtualmachine.models.OperationDisplay - :ivar origin: The intended executor of the operation. Possible values include: "user", - "system". + :ivar origin: The intended executor of the operation. Known values are: "user", "system". :vartype origin: str or ~azure.mgmt.sqlvirtualmachine.models.OperationOrigin :ivar properties: Additional descriptions for the operation. :vartype properties: dict[str, any] @@ -799,8 +846,8 @@ class ResourceIdentity(msrest.serialization.Model): :ivar principal_id: The Azure Active Directory principal id. :vartype principal_id: str :ivar type: The identity type. Set this to 'SystemAssigned' in order to automatically create - and assign an Azure Active Directory principal for the resource. Possible values include: - "None", "SystemAssigned". + and assign an Azure Active Directory principal for the resource. Known values are: "None", + "SystemAssigned". :vartype type: str or ~azure.mgmt.sqlvirtualmachine.models.IdentityType :ivar tenant_id: The Azure Active Directory tenant id. :vartype tenant_id: str @@ -820,13 +867,13 @@ class ResourceIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "IdentityType"]] = None, + type: Optional[Union[str, "_models.IdentityType"]] = None, **kwargs ): """ :keyword type: The identity type. Set this to 'SystemAssigned' in order to automatically create - and assign an Azure Active Directory principal for the resource. Possible values include: - "None", "SystemAssigned". + and assign an Azure Active Directory principal for the resource. Known values are: "None", + "SystemAssigned". :paramtype type: str or ~azure.mgmt.sqlvirtualmachine.models.IdentityType """ super(ResourceIdentity, self).__init__(**kwargs) @@ -846,8 +893,8 @@ class Schedule(msrest.serialization.Model): :ivar monthly_occurrence: Occurrence of the DayOfWeek day within a month to schedule assessment. Takes values: 1,2,3,4 and -1. Use -1 for last DayOfWeek day of the month. :vartype monthly_occurrence: int - :ivar day_of_week: Day of the week to run assessment. Possible values include: "Monday", - "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday". + :ivar day_of_week: Day of the week to run assessment. Known values are: "Monday", "Tuesday", + "Wednesday", "Thursday", "Friday", "Saturday", "Sunday". :vartype day_of_week: str or ~azure.mgmt.sqlvirtualmachine.models.AssessmentDayOfWeek :ivar start_time: Time of the day in HH:mm format. Eg. 17:30. :vartype start_time: str @@ -867,7 +914,7 @@ def __init__( enable: Optional[bool] = None, weekly_interval: Optional[int] = None, monthly_occurrence: Optional[int] = None, - day_of_week: Optional[Union[str, "AssessmentDayOfWeek"]] = None, + day_of_week: Optional[Union[str, "_models.AssessmentDayOfWeek"]] = None, start_time: Optional[str] = None, **kwargs ): @@ -880,8 +927,8 @@ def __init__( :keyword monthly_occurrence: Occurrence of the DayOfWeek day within a month to schedule assessment. Takes values: 1,2,3,4 and -1. Use -1 for last DayOfWeek day of the month. :paramtype monthly_occurrence: int - :keyword day_of_week: Day of the week to run assessment. Possible values include: "Monday", - "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday". + :keyword day_of_week: Day of the week to run assessment. Known values are: "Monday", "Tuesday", + "Wednesday", "Thursday", "Friday", "Saturday", "Sunday". :paramtype day_of_week: str or ~azure.mgmt.sqlvirtualmachine.models.AssessmentDayOfWeek :keyword start_time: Time of the day in HH:mm format. Eg. 17:30. :paramtype start_time: str @@ -924,11 +971,11 @@ class ServerConfigurationsManagementSettings(msrest.serialization.Model): def __init__( self, *, - sql_connectivity_update_settings: Optional["SqlConnectivityUpdateSettings"] = None, - sql_workload_type_update_settings: Optional["SqlWorkloadTypeUpdateSettings"] = None, - sql_storage_update_settings: Optional["SqlStorageUpdateSettings"] = None, - additional_features_server_configurations: Optional["AdditionalFeaturesServerConfigurations"] = None, - sql_instance_settings: Optional["SQLInstanceSettings"] = None, + sql_connectivity_update_settings: Optional["_models.SqlConnectivityUpdateSettings"] = None, + sql_workload_type_update_settings: Optional["_models.SqlWorkloadTypeUpdateSettings"] = None, + sql_storage_update_settings: Optional["_models.SqlStorageUpdateSettings"] = None, + additional_features_server_configurations: Optional["_models.AdditionalFeaturesServerConfigurations"] = None, + sql_instance_settings: Optional["_models.SQLInstanceSettings"] = None, **kwargs ): """ @@ -958,8 +1005,8 @@ def __init__( class SqlConnectivityUpdateSettings(msrest.serialization.Model): """Set the access level and network port settings for SQL Server. - :ivar connectivity_type: SQL Server connectivity option. Possible values include: "LOCAL", - "PRIVATE", "PUBLIC". + :ivar connectivity_type: SQL Server connectivity option. Known values are: "LOCAL", "PRIVATE", + "PUBLIC". :vartype connectivity_type: str or ~azure.mgmt.sqlvirtualmachine.models.ConnectivityType :ivar port: SQL Server port. :vartype port: int @@ -979,14 +1026,14 @@ class SqlConnectivityUpdateSettings(msrest.serialization.Model): def __init__( self, *, - connectivity_type: Optional[Union[str, "ConnectivityType"]] = None, + connectivity_type: Optional[Union[str, "_models.ConnectivityType"]] = None, port: Optional[int] = None, sql_auth_update_user_name: Optional[str] = None, sql_auth_update_password: Optional[str] = None, **kwargs ): """ - :keyword connectivity_type: SQL Server connectivity option. Possible values include: "LOCAL", + :keyword connectivity_type: SQL Server connectivity option. Known values are: "LOCAL", "PRIVATE", "PUBLIC". :paramtype connectivity_type: str or ~azure.mgmt.sqlvirtualmachine.models.ConnectivityType :keyword port: SQL Server port. @@ -1016,6 +1063,10 @@ class SQLInstanceSettings(msrest.serialization.Model): :vartype min_server_memory_mb: int :ivar max_server_memory_mb: SQL Server maximum memory. :vartype max_server_memory_mb: int + :ivar is_lpim_enabled: SQL Server LPIM. + :vartype is_lpim_enabled: bool + :ivar is_ifi_enabled: SQL Server IFI. + :vartype is_ifi_enabled: bool """ _attribute_map = { @@ -1024,6 +1075,8 @@ class SQLInstanceSettings(msrest.serialization.Model): 'is_optimize_for_ad_hoc_workloads_enabled': {'key': 'isOptimizeForAdHocWorkloadsEnabled', 'type': 'bool'}, 'min_server_memory_mb': {'key': 'minServerMemoryMB', 'type': 'int'}, 'max_server_memory_mb': {'key': 'maxServerMemoryMB', 'type': 'int'}, + 'is_lpim_enabled': {'key': 'isLpimEnabled', 'type': 'bool'}, + 'is_ifi_enabled': {'key': 'isIfiEnabled', 'type': 'bool'}, } def __init__( @@ -1034,6 +1087,8 @@ def __init__( is_optimize_for_ad_hoc_workloads_enabled: Optional[bool] = None, min_server_memory_mb: Optional[int] = None, max_server_memory_mb: Optional[int] = None, + is_lpim_enabled: Optional[bool] = None, + is_ifi_enabled: Optional[bool] = None, **kwargs ): """ @@ -1047,6 +1102,10 @@ def __init__( :paramtype min_server_memory_mb: int :keyword max_server_memory_mb: SQL Server maximum memory. :paramtype max_server_memory_mb: int + :keyword is_lpim_enabled: SQL Server LPIM. + :paramtype is_lpim_enabled: bool + :keyword is_ifi_enabled: SQL Server IFI. + :paramtype is_ifi_enabled: bool """ super(SQLInstanceSettings, self).__init__(**kwargs) self.collation = collation @@ -1054,6 +1113,8 @@ def __init__( self.is_optimize_for_ad_hoc_workloads_enabled = is_optimize_for_ad_hoc_workloads_enabled self.min_server_memory_mb = min_server_memory_mb self.max_server_memory_mb = max_server_memory_mb + self.is_lpim_enabled = is_lpim_enabled + self.is_ifi_enabled = is_ifi_enabled class SQLStorageSettings(msrest.serialization.Model): @@ -1095,8 +1156,8 @@ class SqlStorageUpdateSettings(msrest.serialization.Model): :vartype disk_count: int :ivar starting_device_id: Device id of the first disk to be updated. :vartype starting_device_id: int - :ivar disk_configuration_type: Disk configuration to apply to SQL Server. Possible values - include: "NEW", "EXTEND", "ADD". + :ivar disk_configuration_type: Disk configuration to apply to SQL Server. Known values are: + "NEW", "EXTEND", "ADD". :vartype disk_configuration_type: str or ~azure.mgmt.sqlvirtualmachine.models.DiskConfigurationType """ @@ -1112,7 +1173,7 @@ def __init__( *, disk_count: Optional[int] = None, starting_device_id: Optional[int] = None, - disk_configuration_type: Optional[Union[str, "DiskConfigurationType"]] = None, + disk_configuration_type: Optional[Union[str, "_models.DiskConfigurationType"]] = None, **kwargs ): """ @@ -1120,8 +1181,8 @@ def __init__( :paramtype disk_count: int :keyword starting_device_id: Device id of the first disk to be updated. :paramtype starting_device_id: int - :keyword disk_configuration_type: Disk configuration to apply to SQL Server. Possible values - include: "NEW", "EXTEND", "ADD". + :keyword disk_configuration_type: Disk configuration to apply to SQL Server. Known values are: + "NEW", "EXTEND", "ADD". :paramtype disk_configuration_type: str or ~azure.mgmt.sqlvirtualmachine.models.DiskConfigurationType """ @@ -1134,16 +1195,20 @@ def __init__( class SQLTempDbSettings(msrest.serialization.Model): """SQLTempDbSettings. - :ivar data_file_size: SQL Server default file size. + :ivar data_file_size: SQL Server tempdb data file size. :vartype data_file_size: int - :ivar data_growth: SQL Server default file autoGrowth size. + :ivar data_growth: SQL Server tempdb data file autoGrowth size. :vartype data_growth: int - :ivar log_file_size: SQL Server default file size. + :ivar log_file_size: SQL Server tempdb log file size. :vartype log_file_size: int - :ivar log_growth: SQL Server default file autoGrowth size. + :ivar log_growth: SQL Server tempdb log file autoGrowth size. :vartype log_growth: int - :ivar data_file_count: SQL Server default file count. + :ivar data_file_count: SQL Server tempdb data file count. :vartype data_file_count: int + :ivar persist_folder: SQL Server tempdb persist folder choice. + :vartype persist_folder: bool + :ivar persist_folder_path: SQL Server tempdb persist folder location. + :vartype persist_folder_path: str :ivar luns: Logical Unit Numbers for the disks. :vartype luns: list[int] :ivar default_file_path: SQL Server default file path. @@ -1156,6 +1221,8 @@ class SQLTempDbSettings(msrest.serialization.Model): 'log_file_size': {'key': 'logFileSize', 'type': 'int'}, 'log_growth': {'key': 'logGrowth', 'type': 'int'}, 'data_file_count': {'key': 'dataFileCount', 'type': 'int'}, + 'persist_folder': {'key': 'persistFolder', 'type': 'bool'}, + 'persist_folder_path': {'key': 'persistFolderPath', 'type': 'str'}, 'luns': {'key': 'luns', 'type': '[int]'}, 'default_file_path': {'key': 'defaultFilePath', 'type': 'str'}, } @@ -1168,21 +1235,27 @@ def __init__( log_file_size: Optional[int] = None, log_growth: Optional[int] = None, data_file_count: Optional[int] = None, + persist_folder: Optional[bool] = None, + persist_folder_path: Optional[str] = None, luns: Optional[List[int]] = None, default_file_path: Optional[str] = None, **kwargs ): """ - :keyword data_file_size: SQL Server default file size. + :keyword data_file_size: SQL Server tempdb data file size. :paramtype data_file_size: int - :keyword data_growth: SQL Server default file autoGrowth size. + :keyword data_growth: SQL Server tempdb data file autoGrowth size. :paramtype data_growth: int - :keyword log_file_size: SQL Server default file size. + :keyword log_file_size: SQL Server tempdb log file size. :paramtype log_file_size: int - :keyword log_growth: SQL Server default file autoGrowth size. + :keyword log_growth: SQL Server tempdb log file autoGrowth size. :paramtype log_growth: int - :keyword data_file_count: SQL Server default file count. + :keyword data_file_count: SQL Server tempdb data file count. :paramtype data_file_count: int + :keyword persist_folder: SQL Server tempdb persist folder choice. + :paramtype persist_folder: bool + :keyword persist_folder_path: SQL Server tempdb persist folder location. + :paramtype persist_folder_path: str :keyword luns: Logical Unit Numbers for the disks. :paramtype luns: list[int] :keyword default_file_path: SQL Server default file path. @@ -1194,6 +1267,8 @@ def __init__( self.log_file_size = log_file_size self.log_growth = log_growth self.data_file_count = data_file_count + self.persist_folder = persist_folder + self.persist_folder_path = persist_folder_path self.luns = luns self.default_file_path = default_file_path @@ -1278,14 +1353,13 @@ class SqlVirtualMachine(TrackedResource): :vartype provisioning_state: str :ivar sql_image_offer: SQL image offer. Examples include SQL2016-WS2016, SQL2017-WS2016. :vartype sql_image_offer: str - :ivar sql_server_license_type: SQL Server license type. Possible values include: "PAYG", - "AHUB", "DR". + :ivar sql_server_license_type: SQL Server license type. Known values are: "PAYG", "AHUB", "DR". :vartype sql_server_license_type: str or ~azure.mgmt.sqlvirtualmachine.models.SqlServerLicenseType - :ivar sql_management: SQL Server Management type. Possible values include: "Full", - "LightWeight", "NoAgent". + :ivar sql_management: SQL Server Management type. Known values are: "Full", "LightWeight", + "NoAgent". :vartype sql_management: str or ~azure.mgmt.sqlvirtualmachine.models.SqlManagementMode - :ivar sql_image_sku: SQL Server edition type. Possible values include: "Developer", "Express", + :ivar sql_image_sku: SQL Server edition type. Known values are: "Developer", "Express", "Standard", "Enterprise", "Web". :vartype sql_image_sku: str or ~azure.mgmt.sqlvirtualmachine.models.SqlImageSku :ivar sql_virtual_machine_group_resource_id: ARM resource id of the SQL virtual machine group @@ -1294,6 +1368,9 @@ class SqlVirtualMachine(TrackedResource): :ivar wsfc_domain_credentials: Domain credentials for setting up Windows Server Failover Cluster for SQL availability group. :vartype wsfc_domain_credentials: ~azure.mgmt.sqlvirtualmachine.models.WsfcDomainCredentials + :ivar wsfc_static_ip: Domain credentials for setting up Windows Server Failover Cluster for SQL + availability group. + :vartype wsfc_static_ip: str :ivar auto_patching_settings: Auto patching settings for applying critical security updates to SQL virtual machine. :vartype auto_patching_settings: ~azure.mgmt.sqlvirtualmachine.models.AutoPatchingSettings @@ -1337,6 +1414,7 @@ class SqlVirtualMachine(TrackedResource): 'sql_image_sku': {'key': 'properties.sqlImageSku', 'type': 'str'}, 'sql_virtual_machine_group_resource_id': {'key': 'properties.sqlVirtualMachineGroupResourceId', 'type': 'str'}, 'wsfc_domain_credentials': {'key': 'properties.wsfcDomainCredentials', 'type': 'WsfcDomainCredentials'}, + 'wsfc_static_ip': {'key': 'properties.wsfcStaticIp', 'type': 'str'}, 'auto_patching_settings': {'key': 'properties.autoPatchingSettings', 'type': 'AutoPatchingSettings'}, 'auto_backup_settings': {'key': 'properties.autoBackupSettings', 'type': 'AutoBackupSettings'}, 'key_vault_credential_settings': {'key': 'properties.keyVaultCredentialSettings', 'type': 'KeyVaultCredentialSettings'}, @@ -1350,20 +1428,21 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - identity: Optional["ResourceIdentity"] = None, + identity: Optional["_models.ResourceIdentity"] = None, virtual_machine_resource_id: Optional[str] = None, sql_image_offer: Optional[str] = None, - sql_server_license_type: Optional[Union[str, "SqlServerLicenseType"]] = None, - sql_management: Optional[Union[str, "SqlManagementMode"]] = None, - sql_image_sku: Optional[Union[str, "SqlImageSku"]] = None, + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, + sql_management: Optional[Union[str, "_models.SqlManagementMode"]] = None, + sql_image_sku: Optional[Union[str, "_models.SqlImageSku"]] = None, sql_virtual_machine_group_resource_id: Optional[str] = None, - wsfc_domain_credentials: Optional["WsfcDomainCredentials"] = None, - auto_patching_settings: Optional["AutoPatchingSettings"] = None, - auto_backup_settings: Optional["AutoBackupSettings"] = None, - key_vault_credential_settings: Optional["KeyVaultCredentialSettings"] = None, - server_configurations_management_settings: Optional["ServerConfigurationsManagementSettings"] = None, - storage_configuration_settings: Optional["StorageConfigurationSettings"] = None, - assessment_settings: Optional["AssessmentSettings"] = None, + wsfc_domain_credentials: Optional["_models.WsfcDomainCredentials"] = None, + wsfc_static_ip: Optional[str] = None, + auto_patching_settings: Optional["_models.AutoPatchingSettings"] = None, + auto_backup_settings: Optional["_models.AutoBackupSettings"] = None, + key_vault_credential_settings: Optional["_models.KeyVaultCredentialSettings"] = None, + server_configurations_management_settings: Optional["_models.ServerConfigurationsManagementSettings"] = None, + storage_configuration_settings: Optional["_models.StorageConfigurationSettings"] = None, + assessment_settings: Optional["_models.AssessmentSettings"] = None, **kwargs ): """ @@ -1378,15 +1457,15 @@ def __init__( :paramtype virtual_machine_resource_id: str :keyword sql_image_offer: SQL image offer. Examples include SQL2016-WS2016, SQL2017-WS2016. :paramtype sql_image_offer: str - :keyword sql_server_license_type: SQL Server license type. Possible values include: "PAYG", - "AHUB", "DR". + :keyword sql_server_license_type: SQL Server license type. Known values are: "PAYG", "AHUB", + "DR". :paramtype sql_server_license_type: str or ~azure.mgmt.sqlvirtualmachine.models.SqlServerLicenseType - :keyword sql_management: SQL Server Management type. Possible values include: "Full", - "LightWeight", "NoAgent". + :keyword sql_management: SQL Server Management type. Known values are: "Full", "LightWeight", + "NoAgent". :paramtype sql_management: str or ~azure.mgmt.sqlvirtualmachine.models.SqlManagementMode - :keyword sql_image_sku: SQL Server edition type. Possible values include: "Developer", - "Express", "Standard", "Enterprise", "Web". + :keyword sql_image_sku: SQL Server edition type. Known values are: "Developer", "Express", + "Standard", "Enterprise", "Web". :paramtype sql_image_sku: str or ~azure.mgmt.sqlvirtualmachine.models.SqlImageSku :keyword sql_virtual_machine_group_resource_id: ARM resource id of the SQL virtual machine group this SQL virtual machine is or will be part of. @@ -1394,6 +1473,9 @@ def __init__( :keyword wsfc_domain_credentials: Domain credentials for setting up Windows Server Failover Cluster for SQL availability group. :paramtype wsfc_domain_credentials: ~azure.mgmt.sqlvirtualmachine.models.WsfcDomainCredentials + :keyword wsfc_static_ip: Domain credentials for setting up Windows Server Failover Cluster for + SQL availability group. + :paramtype wsfc_static_ip: str :keyword auto_patching_settings: Auto patching settings for applying critical security updates to SQL virtual machine. :paramtype auto_patching_settings: ~azure.mgmt.sqlvirtualmachine.models.AutoPatchingSettings @@ -1423,6 +1505,7 @@ def __init__( self.sql_image_sku = sql_image_sku self.sql_virtual_machine_group_resource_id = sql_virtual_machine_group_resource_id self.wsfc_domain_credentials = wsfc_domain_credentials + self.wsfc_static_ip = wsfc_static_ip self.auto_patching_settings = auto_patching_settings self.auto_backup_settings = auto_backup_settings self.key_vault_credential_settings = key_vault_credential_settings @@ -1454,14 +1537,14 @@ class SqlVirtualMachineGroup(TrackedResource): :vartype provisioning_state: str :ivar sql_image_offer: SQL image offer. Examples may include SQL2016-WS2016, SQL2017-WS2016. :vartype sql_image_offer: str - :ivar sql_image_sku: SQL image sku. Possible values include: "Developer", "Enterprise". + :ivar sql_image_sku: SQL image sku. Known values are: "Developer", "Enterprise". :vartype sql_image_sku: str or ~azure.mgmt.sqlvirtualmachine.models.SqlVmGroupImageSku - :ivar scale_type: Scale type. Possible values include: "HA". + :ivar scale_type: Scale type. Known values are: "HA". :vartype scale_type: str or ~azure.mgmt.sqlvirtualmachine.models.ScaleType :ivar cluster_manager_type: Type of cluster manager: Windows Server Failover Cluster (WSFC), - implied by the scale type of the group and the OS type. Possible values include: "WSFC". + implied by the scale type of the group and the OS type. Known values are: "WSFC". :vartype cluster_manager_type: str or ~azure.mgmt.sqlvirtualmachine.models.ClusterManagerType - :ivar cluster_configuration: Cluster type. Possible values include: "Domainful". + :ivar cluster_configuration: Cluster type. Known values are: "Domainful". :vartype cluster_configuration: str or ~azure.mgmt.sqlvirtualmachine.models.ClusterConfiguration :ivar wsfc_domain_profile: Cluster Active Directory domain profile. @@ -1502,8 +1585,8 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, sql_image_offer: Optional[str] = None, - sql_image_sku: Optional[Union[str, "SqlVmGroupImageSku"]] = None, - wsfc_domain_profile: Optional["WsfcDomainProfile"] = None, + sql_image_sku: Optional[Union[str, "_models.SqlVmGroupImageSku"]] = None, + wsfc_domain_profile: Optional["_models.WsfcDomainProfile"] = None, **kwargs ): """ @@ -1513,7 +1596,7 @@ def __init__( :paramtype tags: dict[str, str] :keyword sql_image_offer: SQL image offer. Examples may include SQL2016-WS2016, SQL2017-WS2016. :paramtype sql_image_offer: str - :keyword sql_image_sku: SQL image sku. Possible values include: "Developer", "Enterprise". + :keyword sql_image_sku: SQL image sku. Known values are: "Developer", "Enterprise". :paramtype sql_image_sku: str or ~azure.mgmt.sqlvirtualmachine.models.SqlVmGroupImageSku :keyword wsfc_domain_profile: Cluster Active Directory domain profile. :paramtype wsfc_domain_profile: ~azure.mgmt.sqlvirtualmachine.models.WsfcDomainProfile @@ -1646,8 +1729,7 @@ def __init__( class SqlWorkloadTypeUpdateSettings(msrest.serialization.Model): """Set workload type to optimize storage for SQL Server. - :ivar sql_workload_type: SQL Server workload type. Possible values include: "GENERAL", "OLTP", - "DW". + :ivar sql_workload_type: SQL Server workload type. Known values are: "GENERAL", "OLTP", "DW". :vartype sql_workload_type: str or ~azure.mgmt.sqlvirtualmachine.models.SqlWorkloadType """ @@ -1658,12 +1740,12 @@ class SqlWorkloadTypeUpdateSettings(msrest.serialization.Model): def __init__( self, *, - sql_workload_type: Optional[Union[str, "SqlWorkloadType"]] = None, + sql_workload_type: Optional[Union[str, "_models.SqlWorkloadType"]] = None, **kwargs ): """ - :keyword sql_workload_type: SQL Server workload type. Possible values include: "GENERAL", - "OLTP", "DW". + :keyword sql_workload_type: SQL Server workload type. Known values are: "GENERAL", "OLTP", + "DW". :paramtype sql_workload_type: str or ~azure.mgmt.sqlvirtualmachine.models.SqlWorkloadType """ super(SqlWorkloadTypeUpdateSettings, self).__init__(**kwargs) @@ -1681,12 +1763,11 @@ class StorageConfigurationSettings(msrest.serialization.Model): :vartype sql_temp_db_settings: ~azure.mgmt.sqlvirtualmachine.models.SQLTempDbSettings :ivar sql_system_db_on_data_disk: SQL Server SystemDb Storage on DataPool if true. :vartype sql_system_db_on_data_disk: bool - :ivar disk_configuration_type: Disk configuration to apply to SQL Server. Possible values - include: "NEW", "EXTEND", "ADD". + :ivar disk_configuration_type: Disk configuration to apply to SQL Server. Known values are: + "NEW", "EXTEND", "ADD". :vartype disk_configuration_type: str or ~azure.mgmt.sqlvirtualmachine.models.DiskConfigurationType - :ivar storage_workload_type: Storage workload type. Possible values include: "GENERAL", "OLTP", - "DW". + :ivar storage_workload_type: Storage workload type. Known values are: "GENERAL", "OLTP", "DW". :vartype storage_workload_type: str or ~azure.mgmt.sqlvirtualmachine.models.StorageWorkloadType """ @@ -1702,12 +1783,12 @@ class StorageConfigurationSettings(msrest.serialization.Model): def __init__( self, *, - sql_data_settings: Optional["SQLStorageSettings"] = None, - sql_log_settings: Optional["SQLStorageSettings"] = None, - sql_temp_db_settings: Optional["SQLTempDbSettings"] = None, + sql_data_settings: Optional["_models.SQLStorageSettings"] = None, + sql_log_settings: Optional["_models.SQLStorageSettings"] = None, + sql_temp_db_settings: Optional["_models.SQLTempDbSettings"] = None, sql_system_db_on_data_disk: Optional[bool] = None, - disk_configuration_type: Optional[Union[str, "DiskConfigurationType"]] = None, - storage_workload_type: Optional[Union[str, "StorageWorkloadType"]] = None, + disk_configuration_type: Optional[Union[str, "_models.DiskConfigurationType"]] = None, + storage_workload_type: Optional[Union[str, "_models.StorageWorkloadType"]] = None, **kwargs ): """ @@ -1719,12 +1800,12 @@ def __init__( :paramtype sql_temp_db_settings: ~azure.mgmt.sqlvirtualmachine.models.SQLTempDbSettings :keyword sql_system_db_on_data_disk: SQL Server SystemDb Storage on DataPool if true. :paramtype sql_system_db_on_data_disk: bool - :keyword disk_configuration_type: Disk configuration to apply to SQL Server. Possible values - include: "NEW", "EXTEND", "ADD". + :keyword disk_configuration_type: Disk configuration to apply to SQL Server. Known values are: + "NEW", "EXTEND", "ADD". :paramtype disk_configuration_type: str or ~azure.mgmt.sqlvirtualmachine.models.DiskConfigurationType - :keyword storage_workload_type: Storage workload type. Possible values include: "GENERAL", - "OLTP", "DW". + :keyword storage_workload_type: Storage workload type. Known values are: "GENERAL", "OLTP", + "DW". :paramtype storage_workload_type: str or ~azure.mgmt.sqlvirtualmachine.models.StorageWorkloadType """ @@ -1742,15 +1823,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.sqlvirtualmachine.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.sqlvirtualmachine.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). :vartype last_modified_at: ~datetime.datetime @@ -1769,25 +1850,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.sqlvirtualmachine.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.sqlvirtualmachine.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime @@ -1862,6 +1943,9 @@ class WsfcDomainProfile(msrest.serialization.Model): :vartype storage_account_url: str :ivar storage_account_primary_key: Primary key of the witness storage account. :vartype storage_account_primary_key: str + :ivar cluster_subnet_type: Cluster subnet type. Known values are: "SingleSubnet", + "MultiSubnet". + :vartype cluster_subnet_type: str or ~azure.mgmt.sqlvirtualmachine.models.ClusterSubnetType """ _attribute_map = { @@ -1873,6 +1957,7 @@ class WsfcDomainProfile(msrest.serialization.Model): 'file_share_witness_path': {'key': 'fileShareWitnessPath', 'type': 'str'}, 'storage_account_url': {'key': 'storageAccountUrl', 'type': 'str'}, 'storage_account_primary_key': {'key': 'storageAccountPrimaryKey', 'type': 'str'}, + 'cluster_subnet_type': {'key': 'clusterSubnetType', 'type': 'str'}, } def __init__( @@ -1886,6 +1971,7 @@ def __init__( file_share_witness_path: Optional[str] = None, storage_account_url: Optional[str] = None, storage_account_primary_key: Optional[str] = None, + cluster_subnet_type: Optional[Union[str, "_models.ClusterSubnetType"]] = None, **kwargs ): """ @@ -1908,6 +1994,9 @@ def __init__( :paramtype storage_account_url: str :keyword storage_account_primary_key: Primary key of the witness storage account. :paramtype storage_account_primary_key: str + :keyword cluster_subnet_type: Cluster subnet type. Known values are: "SingleSubnet", + "MultiSubnet". + :paramtype cluster_subnet_type: str or ~azure.mgmt.sqlvirtualmachine.models.ClusterSubnetType """ super(WsfcDomainProfile, self).__init__(**kwargs) self.domain_fqdn = domain_fqdn @@ -1918,3 +2007,4 @@ def __init__( self.file_share_witness_path = file_share_witness_path self.storage_account_url = storage_account_url self.storage_account_primary_key = storage_account_primary_key + self.cluster_subnet_type = cluster_subnet_type diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/models/_patch.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/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/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/models/_sql_virtual_machine_management_client_enums.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/models/_sql_virtual_machine_management_client_enums.py index 062a0e2a3a30..de0e0e631583 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/models/_sql_virtual_machine_management_client_enums.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/models/_sql_virtual_machine_management_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AssessmentDayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AssessmentDayOfWeek(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Day of the week to run assessment. """ @@ -23,7 +22,7 @@ class AssessmentDayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SATURDAY = "Saturday" SUNDAY = "Sunday" -class AutoBackupDaysOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AutoBackupDaysOfWeek(str, Enum, metaclass=CaseInsensitiveEnumMeta): MONDAY = "Monday" TUESDAY = "Tuesday" @@ -33,34 +32,41 @@ class AutoBackupDaysOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SATURDAY = "Saturday" SUNDAY = "Sunday" -class BackupScheduleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class BackupScheduleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Backup schedule type. """ MANUAL = "Manual" AUTOMATED = "Automated" -class ClusterConfiguration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ClusterConfiguration(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Cluster type. """ DOMAINFUL = "Domainful" -class ClusterManagerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ClusterManagerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of cluster manager: Windows Server Failover Cluster (WSFC), implied by the scale type of the group and the OS type. """ WSFC = "WSFC" -class Commit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ClusterSubnetType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Cluster subnet type. + """ + + SINGLE_SUBNET = "SingleSubnet" + MULTI_SUBNET = "MultiSubnet" + +class Commit(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Replica commit mode in availability group. """ SYNCHRONOUS_COMMIT = "SYNCHRONOUS_COMMIT" ASYNCHRONOUS_COMMIT = "ASYNCHRONOUS_COMMIT" -class ConnectivityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectivityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SQL Server connectivity option. """ @@ -68,7 +74,7 @@ class ConnectivityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PRIVATE = "PRIVATE" PUBLIC = "PUBLIC" -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -77,7 +83,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DayOfWeek(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Day of week to apply the patch on. """ @@ -90,7 +96,7 @@ class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SATURDAY = "Saturday" SUNDAY = "Sunday" -class DiskConfigurationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DiskConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Disk configuration to apply to SQL Server. """ @@ -98,14 +104,14 @@ class DiskConfigurationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): EXTEND = "EXTEND" ADD = "ADD" -class Failover(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Failover(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Replica failover mode in availability group. """ AUTOMATIC = "AUTOMATIC" MANUAL = "MANUAL" -class FullBackupFrequencyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class FullBackupFrequencyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Frequency of full backups. In both cases, full backups begin during the next scheduled time window. """ @@ -113,7 +119,7 @@ class FullBackupFrequencyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum) DAILY = "Daily" WEEKLY = "Weekly" -class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource. """ @@ -121,14 +127,14 @@ class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" SYSTEM_ASSIGNED = "SystemAssigned" -class OperationOrigin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OperationOrigin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The intended executor of the operation. """ USER = "user" SYSTEM = "system" -class ReadableSecondary(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ReadableSecondary(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Replica readable secondary mode in availability group. """ @@ -136,20 +142,20 @@ class ReadableSecondary(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALL = "ALL" READ_ONLY = "READ_ONLY" -class Role(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Role(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Replica Role in availability group. """ PRIMARY = "PRIMARY" SECONDARY = "SECONDARY" -class ScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Scale type. """ HA = "HA" -class SqlImageSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SqlImageSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SQL Server edition type. """ @@ -159,7 +165,7 @@ class SqlImageSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENTERPRISE = "Enterprise" WEB = "Web" -class SqlManagementMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SqlManagementMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SQL Server Management type. """ @@ -167,7 +173,7 @@ class SqlManagementMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): LIGHT_WEIGHT = "LightWeight" NO_AGENT = "NoAgent" -class SqlServerLicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SqlServerLicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SQL Server license type. """ @@ -175,14 +181,14 @@ class SqlServerLicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): AHUB = "AHUB" DR = "DR" -class SqlVmGroupImageSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SqlVmGroupImageSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SQL image sku. """ DEVELOPER = "Developer" ENTERPRISE = "Enterprise" -class SqlWorkloadType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SqlWorkloadType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SQL Server workload type. """ @@ -190,7 +196,7 @@ class SqlWorkloadType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): OLTP = "OLTP" DW = "DW" -class StorageWorkloadType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class StorageWorkloadType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage workload type. """ diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/__init__.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/__init__.py index c54af11a6331..e100b0ff6420 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/__init__.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/__init__.py @@ -11,9 +11,14 @@ from ._sql_virtual_machine_groups_operations import SqlVirtualMachineGroupsOperations from ._sql_virtual_machines_operations import SqlVirtualMachinesOperations +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__ = [ 'AvailabilityGroupListenersOperations', 'Operations', 'SqlVirtualMachineGroupsOperations', 'SqlVirtualMachinesOperations', ] +__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/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_availability_group_listeners_operations.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_availability_group_listeners_operations.py index c149e1486029..52f4be3013f7 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_availability_group_listeners_operations.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_availability_group_listeners_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 T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -38,9 +38,12 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}/availabilityGroupListeners/{availabilityGroupListenerName}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$expand'] = _SERIALIZER.query("expand", expand, '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 ) @@ -77,14 +78,17 @@ def build_create_or_update_request_initial( availability_group_listener_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.AvailabilityGroupListener] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}/availabilityGroupListeners/{availabilityGroupListenerName}") # pylint: disable=line-too-long path_format_arguments = { @@ -97,20 +101,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 @@ -124,8 +126,9 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}/availabilityGroupListeners/{availabilityGroupListenerName}") # pylint: disable=line-too-long path_format_arguments = { @@ -138,13 +141,12 @@ 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') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -155,9 +157,12 @@ def build_list_by_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}/availabilityGroupListeners") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +174,38 @@ def build_list_by_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 ) -class AvailabilityGroupListenersOperations(object): - """AvailabilityGroupListenersOperations 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 AvailabilityGroupListenersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.sqlvirtualmachine.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.sqlvirtualmachine.SqlVirtualMachineManagementClient`'s + :attr:`availability_group_listeners` 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( @@ -214,7 +215,7 @@ def get( availability_group_listener_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> "_models.AvailabilityGroupListener": + ) -> _models.AvailabilityGroupListener: """Gets an availability group listener. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -231,13 +232,16 @@ def get( :rtype: ~azure.mgmt.sqlvirtualmachine.models.AvailabilityGroupListener :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilityGroupListener"] 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-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AvailabilityGroupListener] request = build_get_request( @@ -248,11 +252,13 @@ def get( api_version=api_version, expand=expand, 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 @@ -278,17 +284,20 @@ def _create_or_update_initial( resource_group_name: str, sql_virtual_machine_group_name: str, availability_group_listener_name: str, - parameters: "_models.AvailabilityGroupListener", + parameters: _models.AvailabilityGroupListener, **kwargs: Any - ) -> "_models.AvailabilityGroupListener": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilityGroupListener"] + ) -> _models.AvailabilityGroupListener: 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-11-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', "2022-02-01")) # 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.AvailabilityGroupListener] _json = self._serialize.body(parameters, 'AvailabilityGroupListener') @@ -301,11 +310,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 @@ -336,9 +347,9 @@ def begin_create_or_update( resource_group_name: str, sql_virtual_machine_group_name: str, availability_group_listener_name: str, - parameters: "_models.AvailabilityGroupListener", + parameters: _models.AvailabilityGroupListener, **kwargs: Any - ) -> LROPoller["_models.AvailabilityGroupListener"]: + ) -> LROPoller[_models.AvailabilityGroupListener]: """Creates or updates an availability group listener. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -364,17 +375,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.sqlvirtualmachine.models.AvailabilityGroupListener] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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.AvailabilityGroupListener] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilityGroupListener"] lro_delay = kwargs.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, sql_virtual_machine_group_name=sql_virtual_machine_group_name, availability_group_listener_name=availability_group_listener_name, @@ -382,20 +396,27 @@ def begin_create_or_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('AvailabilityGroupListener', 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( @@ -415,13 +436,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements availability_group_listener_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -431,11 +455,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, 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 @@ -481,21 +507,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-11-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', "2022-02-01")) # 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, sql_virtual_machine_group_name=sql_virtual_machine_group_name, availability_group_listener_name=availability_group_listener_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -505,8 +536,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - 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( @@ -525,7 +562,7 @@ def list_by_group( resource_group_name: str, sql_virtual_machine_group_name: str, **kwargs: Any - ) -> Iterable["_models.AvailabilityGroupListenerListResult"]: + ) -> Iterable[_models.AvailabilityGroupListenerListResult]: """Lists all availability group listeners in a SQL virtual machine group. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -540,13 +577,16 @@ def list_by_group( ~azure.core.paging.ItemPaged[~azure.mgmt.sqlvirtualmachine.models.AvailabilityGroupListenerListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AvailabilityGroupListenerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilityGroupListenerListResult"] 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: @@ -556,9 +596,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_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: @@ -568,9 +610,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/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_operations.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_operations.py index 2834f8aec2d7..c85be9f6ca02 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_operations.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.SqlVirtualMachine/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.sqlvirtualmachine.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.sqlvirtualmachine.SqlVirtualMachineManagementClient`'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 of the available SQL Virtual Machine Rest API operations. :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.sqlvirtualmachine.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_patch.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/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/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_sql_virtual_machine_groups_operations.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_sql_virtual_machine_groups_operations.py index 1850094d42da..ba6aa575581d 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_sql_virtual_machine_groups_operations.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_sql_virtual_machine_groups_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 T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,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 ) @@ -70,14 +71,17 @@ def build_create_or_update_request_initial( sql_virtual_machine_group_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.SqlVirtualMachineGroup] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}") # pylint: disable=line-too-long path_format_arguments = { @@ -89,20 +93,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 @@ -115,8 +117,9 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,13 +131,12 @@ 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') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -144,14 +146,17 @@ def build_update_request_initial( sql_virtual_machine_group_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.SqlVirtualMachineGroupUpdate] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}") # pylint: disable=line-too-long path_format_arguments = { @@ -163,20 +168,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 @@ -188,9 +191,12 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups") # pylint: disable=line-too-long path_format_arguments = { @@ -201,18 +207,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 ) @@ -221,9 +225,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups") # pylint: disable=line-too-long path_format_arguments = { @@ -233,42 +240,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 SqlVirtualMachineGroupsOperations(object): - """SqlVirtualMachineGroupsOperations 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 SqlVirtualMachineGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.sqlvirtualmachine.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.sqlvirtualmachine.SqlVirtualMachineManagementClient`'s + :attr:`sql_virtual_machine_groups` 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( @@ -276,7 +279,7 @@ def get( resource_group_name: str, sql_virtual_machine_group_name: str, **kwargs: Any - ) -> "_models.SqlVirtualMachineGroup": + ) -> _models.SqlVirtualMachineGroup: """Gets a SQL virtual machine group. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -289,13 +292,16 @@ def get( :rtype: ~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineGroup"] 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-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlVirtualMachineGroup] request = build_get_request( @@ -304,11 +310,13 @@ def get( subscription_id=self._config.subscription_id, 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 @@ -333,17 +341,20 @@ def _create_or_update_initial( self, resource_group_name: str, sql_virtual_machine_group_name: str, - parameters: "_models.SqlVirtualMachineGroup", + parameters: _models.SqlVirtualMachineGroup, **kwargs: Any - ) -> "_models.SqlVirtualMachineGroup": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineGroup"] + ) -> _models.SqlVirtualMachineGroup: 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-11-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', "2022-02-01")) # 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.SqlVirtualMachineGroup] _json = self._serialize.body(parameters, 'SqlVirtualMachineGroup') @@ -355,11 +366,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 @@ -389,9 +402,9 @@ def begin_create_or_update( self, resource_group_name: str, sql_virtual_machine_group_name: str, - parameters: "_models.SqlVirtualMachineGroup", + parameters: _models.SqlVirtualMachineGroup, **kwargs: Any - ) -> LROPoller["_models.SqlVirtualMachineGroup"]: + ) -> LROPoller[_models.SqlVirtualMachineGroup]: """Creates or updates a SQL virtual machine group. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -415,37 +428,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineGroup] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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.SqlVirtualMachineGroup] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineGroup"] lro_delay = kwargs.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, sql_virtual_machine_group_name=sql_virtual_machine_group_name, parameters=parameters, 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('SqlVirtualMachineGroup', 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( @@ -464,13 +487,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements sql_virtual_machine_group_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -479,11 +505,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, 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 @@ -526,20 +554,25 @@ 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-11-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', "2022-02-01")) # 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, sql_virtual_machine_group_name=sql_virtual_machine_group_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -549,8 +582,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - 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( @@ -567,17 +606,20 @@ def _update_initial( self, resource_group_name: str, sql_virtual_machine_group_name: str, - parameters: "_models.SqlVirtualMachineGroupUpdate", + parameters: _models.SqlVirtualMachineGroupUpdate, **kwargs: Any - ) -> "_models.SqlVirtualMachineGroup": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineGroup"] + ) -> _models.SqlVirtualMachineGroup: 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-11-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', "2022-02-01")) # 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.SqlVirtualMachineGroup] _json = self._serialize.body(parameters, 'SqlVirtualMachineGroupUpdate') @@ -589,11 +631,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 @@ -619,9 +663,9 @@ def begin_update( self, resource_group_name: str, sql_virtual_machine_group_name: str, - parameters: "_models.SqlVirtualMachineGroupUpdate", + parameters: _models.SqlVirtualMachineGroupUpdate, **kwargs: Any - ) -> LROPoller["_models.SqlVirtualMachineGroup"]: + ) -> LROPoller[_models.SqlVirtualMachineGroup]: """Updates SQL virtual machine group tags. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -645,37 +689,47 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineGroup] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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.SqlVirtualMachineGroup] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineGroup"] lro_delay = kwargs.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, sql_virtual_machine_group_name=sql_virtual_machine_group_name, parameters=parameters, 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('SqlVirtualMachineGroup', 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( @@ -693,7 +747,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.SqlVirtualMachineGroupListResult"]: + ) -> Iterable[_models.SqlVirtualMachineGroupListResult]: """Gets all SQL virtual machine groups in a resource group. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -706,13 +760,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlVirtualMachineGroupListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineGroupListResult"] 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: @@ -721,9 +778,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, 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: @@ -732,9 +791,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 @@ -771,7 +832,7 @@ def get_next(next_link=None): def list( self, **kwargs: Any - ) -> Iterable["_models.SqlVirtualMachineGroupListResult"]: + ) -> Iterable[_models.SqlVirtualMachineGroupListResult]: """Gets all SQL virtual machine groups in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -781,13 +842,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlVirtualMachineGroupListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineGroupListResult"] 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: @@ -795,9 +859,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: @@ -805,9 +871,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/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_sql_virtual_machines_operations.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_sql_virtual_machines_operations.py index b63b94d2e655..9bbb7a88c4b0 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_sql_virtual_machines_operations.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_sql_virtual_machines_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 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_by_sql_vm_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}/sqlVirtualMachines") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_by_sql_vm_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 ) @@ -69,9 +70,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines") # pylint: disable=line-too-long path_format_arguments = { @@ -81,48 +85,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, - **kwargs - ) - - -def build_redeploy_request_initial( - resource_group_name: str, - sql_virtual_machine_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy") # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "sqlVirtualMachineName": _SERIALIZER.url("sql_virtual_machine_name", sql_virtual_machine_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -135,9 +107,12 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}") # pylint: disable=line-too-long path_format_arguments = { @@ -149,20 +124,18 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$expand'] = _SERIALIZER.query("expand", expand, '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 ) @@ -172,14 +145,17 @@ def build_create_or_update_request_initial( sql_virtual_machine_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.SqlVirtualMachine] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}") # pylint: disable=line-too-long path_format_arguments = { @@ -191,20 +167,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 @@ -217,8 +191,9 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}") # pylint: disable=line-too-long path_format_arguments = { @@ -230,13 +205,12 @@ 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') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -246,14 +220,17 @@ def build_update_request_initial( sql_virtual_machine_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.SqlVirtualMachineUpdate] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}") # pylint: disable=line-too-long path_format_arguments = { @@ -265,20 +242,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 @@ -290,9 +265,12 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines") # pylint: disable=line-too-long path_format_arguments = { @@ -303,18 +281,46 @@ 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 + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + sql_virtual_machine_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sqlVirtualMachineName": _SERIALIZER.url("sql_virtual_machine_name", sql_virtual_machine_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, **kwargs ) @@ -325,8 +331,9 @@ def build_start_assessment_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/startAssessment") # pylint: disable=line-too-long path_format_arguments = { @@ -338,37 +345,34 @@ def build_start_assessment_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') return HttpRequest( method="POST", url=_url, - params=_query_parameters, + params=_params, **kwargs ) -class SqlVirtualMachinesOperations(object): - """SqlVirtualMachinesOperations 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 SqlVirtualMachinesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.sqlvirtualmachine.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.sqlvirtualmachine.SqlVirtualMachineManagementClient`'s + :attr:`sql_virtual_machines` 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_sql_vm_group( @@ -376,7 +380,7 @@ def list_by_sql_vm_group( resource_group_name: str, sql_virtual_machine_group_name: str, **kwargs: Any - ) -> Iterable["_models.SqlVirtualMachineListResult"]: + ) -> Iterable[_models.SqlVirtualMachineListResult]: """Gets the list of sql virtual machines in a SQL virtual machine group. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -391,13 +395,16 @@ def list_by_sql_vm_group( ~azure.core.paging.ItemPaged[~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlVirtualMachineListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineListResult"] 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: @@ -407,9 +414,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_sql_vm_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: @@ -419,9 +428,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 @@ -458,7 +469,7 @@ def get_next(next_link=None): def list( self, **kwargs: Any - ) -> Iterable["_models.SqlVirtualMachineListResult"]: + ) -> Iterable[_models.SqlVirtualMachineListResult]: """Gets all SQL virtual machines in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -468,13 +479,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlVirtualMachineListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineListResult"] 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: @@ -482,9 +496,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: @@ -492,9 +508,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 @@ -527,111 +545,6 @@ def get_next(next_link=None): ) list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines"} # type: ignore - def _redeploy_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - sql_virtual_machine_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - - - request = build_redeploy_request_initial( - resource_group_name=resource_group_name, - sql_virtual_machine_name=sql_virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._redeploy_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _redeploy_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy"} # type: ignore - - - @distributed_trace - def begin_redeploy( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - sql_virtual_machine_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Uninstalls and reinstalls the SQL Iaas Extension. - - :param resource_group_name: Name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param sql_virtual_machine_name: Name of the SQL virtual machine. - :type sql_virtual_machine_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._redeploy_initial( - resource_group_name=resource_group_name, - sql_virtual_machine_name=sql_virtual_machine_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy"} # type: ignore - @distributed_trace def get( self, @@ -639,7 +552,7 @@ def get( sql_virtual_machine_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> "_models.SqlVirtualMachine": + ) -> _models.SqlVirtualMachine: """Gets a SQL virtual machine. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -654,13 +567,16 @@ def get( :rtype: ~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachine :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachine"] 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-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlVirtualMachine] request = build_get_request( @@ -670,11 +586,13 @@ def get( api_version=api_version, expand=expand, 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 @@ -699,17 +617,20 @@ def _create_or_update_initial( self, resource_group_name: str, sql_virtual_machine_name: str, - parameters: "_models.SqlVirtualMachine", + parameters: _models.SqlVirtualMachine, **kwargs: Any - ) -> "_models.SqlVirtualMachine": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachine"] + ) -> _models.SqlVirtualMachine: 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-11-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', "2022-02-01")) # 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.SqlVirtualMachine] _json = self._serialize.body(parameters, 'SqlVirtualMachine') @@ -721,11 +642,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 @@ -755,9 +678,9 @@ def begin_create_or_update( self, resource_group_name: str, sql_virtual_machine_name: str, - parameters: "_models.SqlVirtualMachine", + parameters: _models.SqlVirtualMachine, **kwargs: Any - ) -> LROPoller["_models.SqlVirtualMachine"]: + ) -> LROPoller[_models.SqlVirtualMachine]: """Creates or updates a SQL virtual machine. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -780,37 +703,47 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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.SqlVirtualMachine] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachine"] lro_delay = kwargs.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, sql_virtual_machine_name=sql_virtual_machine_name, parameters=parameters, 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('SqlVirtualMachine', 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( @@ -829,13 +762,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements sql_virtual_machine_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -844,11 +780,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, 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 @@ -891,20 +829,25 @@ 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-11-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', "2022-02-01")) # 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, sql_virtual_machine_name=sql_virtual_machine_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -914,8 +857,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - 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( @@ -932,17 +881,20 @@ def _update_initial( self, resource_group_name: str, sql_virtual_machine_name: str, - parameters: "_models.SqlVirtualMachineUpdate", + parameters: _models.SqlVirtualMachineUpdate, **kwargs: Any - ) -> "_models.SqlVirtualMachine": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachine"] + ) -> _models.SqlVirtualMachine: 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-11-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', "2022-02-01")) # 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.SqlVirtualMachine] _json = self._serialize.body(parameters, 'SqlVirtualMachineUpdate') @@ -954,11 +906,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 @@ -984,9 +938,9 @@ def begin_update( self, resource_group_name: str, sql_virtual_machine_name: str, - parameters: "_models.SqlVirtualMachineUpdate", + parameters: _models.SqlVirtualMachineUpdate, **kwargs: Any - ) -> LROPoller["_models.SqlVirtualMachine"]: + ) -> LROPoller[_models.SqlVirtualMachine]: """Updates a SQL virtual machine. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -1009,37 +963,47 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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.SqlVirtualMachine] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachine"] lro_delay = kwargs.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, sql_virtual_machine_name=sql_virtual_machine_name, parameters=parameters, 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('SqlVirtualMachine', 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( @@ -1057,7 +1021,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.SqlVirtualMachineListResult"]: + ) -> Iterable[_models.SqlVirtualMachineListResult]: """Gets all SQL virtual machines in a resource group. :param resource_group_name: Name of the resource group that contains the resource. You can @@ -1070,13 +1034,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SqlVirtualMachineListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlVirtualMachineListResult"] 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: @@ -1085,9 +1052,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, 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: @@ -1096,9 +1065,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 @@ -1131,19 +1102,143 @@ def get_next(next_link=None): ) list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines"} # type: ignore - def _start_assessment_initial( # pylint: disable=inconsistent-return-statements + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, sql_virtual_machine_name: str, **kwargs: Any ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + sql_virtual_machine_name=sql_virtual_machine_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._redeploy_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _redeploy_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy"} # type: ignore + + + @distributed_trace + def begin_redeploy( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + sql_virtual_machine_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Uninstalls and reinstalls the SQL Iaas Extension. + + :param resource_group_name: Name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param sql_virtual_machine_name: Name of the SQL virtual machine. + :type sql_virtual_machine_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # 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._redeploy_initial( # type: ignore + resource_group_name=resource_group_name, + sql_virtual_machine_name=sql_virtual_machine_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): + if cls: + return cls(pipeline_response, None, {}) + + + 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( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy"} # type: ignore + + def _start_assessment_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + sql_virtual_machine_name: str, + **kwargs: Any + ) -> 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-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_assessment_request_initial( @@ -1152,11 +1247,13 @@ def _start_assessment_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._start_assessment_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 @@ -1199,20 +1296,25 @@ def begin_start_assessment( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-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', "2022-02-01")) # 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._start_assessment_initial( + raw_result = self._start_assessment_initial( # type: ignore resource_group_name=resource_group_name, sql_virtual_machine_name=sql_virtual_machine_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1222,8 +1324,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - 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(