From e7d0b64cbcbfeb815fb9044627c2849b799a2ee9 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 1 Jun 2023 05:27:29 +0000 Subject: [PATCH] CodeGen from PR 24248 in Azure/azure-rest-api-specs Merge 21db649740fb70f4cdb60a3c6fc2046e3ced5370 into b9ce503202d918a37d8a537fbd2a785e3850f836 --- .../azure-mgmt-sqlvirtualmachine/_meta.json | 6 +- .../mgmt/sqlvirtualmachine/_configuration.py | 10 +- .../mgmt/sqlvirtualmachine/_serialization.py | 93 ++- .../_sql_virtual_machine_management_client.py | 6 +- .../azure/mgmt/sqlvirtualmachine/_vendor.py | 5 +- .../azure/mgmt/sqlvirtualmachine/_version.py | 2 +- .../sqlvirtualmachine/aio/_configuration.py | 10 +- .../_sql_virtual_machine_management_client.py | 6 +- ...availability_group_listeners_operations.py | 48 +- .../aio/operations/_operations.py | 12 +- .../_sql_virtual_machine_groups_operations.py | 72 +- ...virtual_machine_troubleshoot_operations.py | 23 +- .../_sql_virtual_machines_operations.py | 563 +++++++-------- .../sqlvirtualmachine/models/_models_py3.py | 211 +++--- ...virtual_machine_management_client_enums.py | 22 +- ...availability_group_listeners_operations.py | 64 +- .../operations/_operations.py | 16 +- .../_sql_virtual_machine_groups_operations.py | 96 +-- ...virtual_machine_troubleshoot_operations.py | 27 +- .../_sql_virtual_machines_operations.py | 679 +++++++++--------- ...e_or_update_availability_group_listener.py | 2 +- ...bility_group_listener_with_multi_subnet.py | 2 +- ...virtual_machine_automated_backup_weekly.py | 3 +- ...ate_or_update_sql_virtual_machine_group.py | 3 +- ...reate_or_update_sql_virtual_machine_max.py | 21 +- ...reate_or_update_sql_virtual_machine_min.py | 2 +- ...al_machine_storage_configuration_extend.py | 2 +- ...rtual_machine_storage_configuration_new.py | 2 +- ...or_update_virtual_machine_with_vm_group.py | 2 +- .../delete_availability_group_listener.py | 5 +- .../delete_sql_virtual_machine.py | 5 +- .../delete_sql_virtual_machine_group.py | 5 +- .../get_availability_group_listener.py | 2 +- .../get_sql_virtual_machine.py | 2 +- .../get_sql_virtual_machine_group.py | 2 +- ...st_by_group_availability_group_listener.py | 2 +- ...t_by_resource_group_sql_virtual_machine.py | 2 +- ...esource_group_sql_virtual_machine_group.py | 2 +- ...rtual_machine_group_sql_virtual_machine.py | 2 +- .../generated_samples/list_operation.py | 2 +- .../list_subscription_sql_virtual_machine.py | 2 +- ..._subscription_sql_virtual_machine_group.py | 2 +- .../redeploy_sql_virtual_machine.py | 5 +- ...start_assessment_on_sql_virtual_machine.py | 5 +- .../troubleshoot_sql_virtual_machine.py | 2 +- .../update_sql_virtual_machine.py | 2 +- .../update_sql_virtual_machine_group.py | 2 +- 47 files changed, 988 insertions(+), 1073 deletions(-) diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/_meta.json b/sdk/sql/azure-mgmt-sqlvirtualmachine/_meta.json index 0937599ee138..465e318f3c7c 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/_meta.json +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/_meta.json @@ -1,11 +1,11 @@ { - "commit": "020f48c422ec455cdee9f6516f2d0172d13e77a3", + "commit": "282a2b7013942cf57f9227e242e6ed70fff87688", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.4.12", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/sqlvirtualmachine/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/sqlvirtualmachine/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.4.12 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/sqlvirtualmachine/resource-manager/readme.md" } \ No newline at end of file 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 4b4ce59061e5..8be602606ef8 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_configuration.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -35,14 +29,14 @@ class SqlVirtualMachineManagementClientConfiguration(Configuration): # pylint: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription ID that identifies an Azure subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-08-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-01-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SqlVirtualMachineManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-08-01-preview"] = kwargs.pop("api_version", "2022-08-01-preview") + api_version: str = kwargs.pop("api_version", "2023-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_serialization.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_serialization.py index 2c170e28dbca..842ae727fbbc 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_serialization.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -602,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1242,7 +1271,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1266,7 +1295,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1332,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: 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 f17dd2343e8f..c5ed6325743d 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 @@ -54,7 +54,7 @@ class SqlVirtualMachineManagementClient: # pylint: disable=client-accepts-api-v :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-08-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-01-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -71,7 +71,7 @@ def __init__( self._config = SqlVirtualMachineManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -120,5 +120,5 @@ def __enter__(self) -> "SqlVirtualMachineManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_vendor.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_vendor.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) 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 9cf33092d41b..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.0b5" +VERSION = "1.0.0b1" 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 aeef54c7b894..cc2bcb7dd7fa 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 @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -35,14 +29,14 @@ class SqlVirtualMachineManagementClientConfiguration(Configuration): # pylint: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription ID that identifies an Azure subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-08-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-01-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SqlVirtualMachineManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-08-01-preview"] = kwargs.pop("api_version", "2022-08-01-preview") + api_version: str = kwargs.pop("api_version", "2023-01-01-preview") 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 56973fc1a0c5..5ef4f6efc9c8 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 @@ -54,7 +54,7 @@ class SqlVirtualMachineManagementClient: # pylint: disable=client-accepts-api-v :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-08-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-01-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -71,7 +71,7 @@ def __init__( self._config = SqlVirtualMachineManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -120,5 +120,5 @@ async def __aenter__(self) -> "SqlVirtualMachineManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) 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 1da61a40e166..90294e4f0ccd 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. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_group_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -101,9 +97,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilityGroupListener] = kwargs.pop("cls", None) request = build_get_request( @@ -120,8 +114,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -161,16 +156,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailabilityGroupListener] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AvailabilityGroupListener") @@ -191,8 +184,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -315,8 +309,8 @@ async def begin_create_or_update( :type sql_virtual_machine_group_name: str :param availability_group_listener_name: Name of the availability group listener. Required. :type availability_group_listener_name: str - :param parameters: The availability group listener. Is either a model type or a IO type. - Required. + :param parameters: The availability group listener. Is either a AvailabilityGroupListener type + or a IO type. Required. :type parameters: ~azure.mgmt.sqlvirtualmachine.models.AvailabilityGroupListener or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -338,9 +332,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailabilityGroupListener] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -407,9 +399,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -425,8 +415,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -479,9 +470,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -545,9 +534,7 @@ def list_by_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilityGroupListenerListResult] = kwargs.pop("cls", None) error_map = { @@ -601,8 +588,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 d8fa85ef7768..000b0a41b2ff 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,9 +64,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -122,8 +115,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 6912145457f5..250779521414 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. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -94,9 +90,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlVirtualMachineGroup] = kwargs.pop("cls", None) request = build_get_request( @@ -111,8 +105,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,16 +146,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SqlVirtualMachineGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SqlVirtualMachineGroup") @@ -180,8 +173,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -295,8 +289,8 @@ async def begin_create_or_update( :type resource_group_name: str :param sql_virtual_machine_group_name: Name of the SQL virtual machine group. Required. :type sql_virtual_machine_group_name: str - :param parameters: The SQL virtual machine group. Is either a model type or a IO type. - Required. + :param parameters: The SQL virtual machine group. Is either a SqlVirtualMachineGroup type or a + IO type. Required. :type parameters: ~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -318,9 +312,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SqlVirtualMachineGroup] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -382,9 +374,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -399,8 +389,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -447,9 +438,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -509,16 +498,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SqlVirtualMachineGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SqlVirtualMachineGroupUpdate") @@ -538,8 +525,9 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -649,8 +637,8 @@ async def begin_update( :type resource_group_name: str :param sql_virtual_machine_group_name: Name of the SQL virtual machine group. Required. :type sql_virtual_machine_group_name: str - :param parameters: The SQL virtual machine group. Is either a model type or a IO type. - Required. + :param parameters: The SQL virtual machine group. Is either a SqlVirtualMachineGroupUpdate type + or a IO type. Required. :type parameters: ~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineGroupUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -672,9 +660,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SqlVirtualMachineGroup] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -741,9 +727,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlVirtualMachineGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -796,8 +780,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -828,9 +813,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SqlVirtualMachineGroup"] _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlVirtualMachineGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -882,8 +865,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_sql_virtual_machine_troubleshoot_operations.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_sql_virtual_machine_troubleshoot_operations.py index 50a6059af9e8..d8b5eb3993f1 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_sql_virtual_machine_troubleshoot_operations.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/operations/_sql_virtual_machine_troubleshoot_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. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -30,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._sql_virtual_machine_troubleshoot_operations import build_troubleshoot_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,16 +71,14 @@ async def _troubleshoot_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.SqlVmTroubleshooting]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SqlVmTroubleshooting") @@ -104,8 +98,9 @@ async def _troubleshoot_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -221,8 +216,8 @@ async def begin_troubleshoot( :type resource_group_name: str :param sql_virtual_machine_name: Name of the SQL virtual machine. Required. :type sql_virtual_machine_name: str - :param parameters: The SQL virtual machine troubleshooting entity. Is either a model type or a - IO type. Required. + :param parameters: The SQL virtual machine troubleshooting entity. Is either a + SqlVmTroubleshooting type or a IO type. Required. :type parameters: ~azure.mgmt.sqlvirtualmachine.models.SqlVmTroubleshooting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -244,9 +239,7 @@ async def begin_troubleshoot( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SqlVmTroubleshooting] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) 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 ed6127748484..002a184d1996 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. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -43,10 +43,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,9 +86,7 @@ def list_by_sql_vm_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlVirtualMachineListResult] = kwargs.pop("cls", None) error_map = { @@ -146,8 +140,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -177,9 +172,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SqlVirtualMachine"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlVirtualMachineListResult] = kwargs.pop("cls", None) error_map = { @@ -231,8 +224,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -247,6 +241,246 @@ async def get_next(next_link=None): list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines"} + 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, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_start_assessment_request( + 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._start_assessment_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _start_assessment_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/startAssessment" + } + + @distributed_trace_async + async def begin_start_assessment( + self, resource_group_name: str, sql_virtual_machine_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts SQL best practices Assessment on SQL virtual machine. + + :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. Required. + :type resource_group_name: str + :param sql_virtual_machine_name: Name of the SQL virtual machine. Required. + :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_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) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.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) # type: ignore + + begin_start_assessment.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/startAssessment" + } + + 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, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_redeploy_request( + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _redeploy_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy" + } + + @distributed_trace_async + async def begin_redeploy( + 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. Required. + :type resource_group_name: str + :param sql_virtual_machine_name: Name of the SQL virtual machine. Required. + :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._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): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.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) # type: ignore + + begin_redeploy.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy" + } + @distributed_trace_async async def get( self, resource_group_name: str, sql_virtual_machine_name: str, expand: Optional[str] = None, **kwargs: Any @@ -276,9 +510,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlVirtualMachine] = kwargs.pop("cls", None) request = build_get_request( @@ -294,8 +526,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -334,16 +567,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SqlVirtualMachine] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SqlVirtualMachine") @@ -363,8 +594,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -478,7 +710,8 @@ async def begin_create_or_update( :type resource_group_name: str :param sql_virtual_machine_name: Name of the SQL virtual machine. Required. :type sql_virtual_machine_name: str - :param parameters: The SQL virtual machine. Is either a model type or a IO type. Required. + :param parameters: The SQL virtual machine. Is either a SqlVirtualMachine type or a IO type. + Required. :type parameters: ~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachine or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -500,9 +733,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SqlVirtualMachine] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -564,9 +795,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -581,8 +810,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -629,9 +859,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -691,16 +919,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SqlVirtualMachine] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SqlVirtualMachineUpdate") @@ -720,8 +946,9 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -831,7 +1058,8 @@ async def begin_update( :type resource_group_name: str :param sql_virtual_machine_name: Name of the SQL virtual machine. Required. :type sql_virtual_machine_name: str - :param parameters: The SQL virtual machine. Is either a model type or a IO type. Required. + :param parameters: The SQL virtual machine. Is either a SqlVirtualMachineUpdate type or a IO + type. Required. :type parameters: ~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -853,9 +1081,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SqlVirtualMachine] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -921,9 +1147,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlVirtualMachineListResult] = kwargs.pop("cls", None) error_map = { @@ -976,8 +1200,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -993,249 +1218,3 @@ async def get_next(next_link=None): list_by_resource_group.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines" } - - 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, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_start_assessment_request( - 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._start_assessment_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _start_assessment_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/startAssessment" - } - - @distributed_trace_async - async def begin_start_assessment( - self, resource_group_name: str, sql_virtual_machine_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Starts SQL best practices Assessment on SQL virtual machine. - - :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. Required. - :type resource_group_name: str - :param sql_virtual_machine_name: Name of the SQL virtual machine. Required. - :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: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_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) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.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) # type: ignore - - begin_start_assessment.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/startAssessment" - } - - 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, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_redeploy_request( - 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) - - pipeline_response: PipelineResponse = 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _redeploy_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy" - } - - @distributed_trace_async - async def begin_redeploy( - 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. Required. - :type resource_group_name: str - :param sql_virtual_machine_name: Name of the SQL virtual machine. Required. - :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: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.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) # type: ignore - - begin_redeploy.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy" - } 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 e8e66f64a0a8..57f04ceff266 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 @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization @@ -29,7 +29,7 @@ class AADAuthenticationSettings(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, *, client_id: Optional[str] = None, **kwargs): + def __init__(self, *, client_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword client_id: The client Id of the Managed Identity to query Microsoft Graph API. An empty string must be used for the system assigned Managed Identity. @@ -50,7 +50,7 @@ class AdditionalFeaturesServerConfigurations(_serialization.Model): "is_r_services_enabled": {"key": "isRServicesEnabled", "type": "bool"}, } - def __init__(self, *, is_r_services_enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, is_r_services_enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword is_r_services_enabled: Enable or disable R services (SQL 2016 onwards). :paramtype is_r_services_enabled: bool @@ -70,7 +70,7 @@ class AgConfiguration(_serialization.Model): "replicas": {"key": "replicas", "type": "[AgReplica]"}, } - def __init__(self, *, replicas: Optional[List["_models.AgReplica"]] = None, **kwargs): + def __init__(self, *, replicas: Optional[List["_models.AgReplica"]] = None, **kwargs: Any) -> None: """ :keyword replicas: Replica configurations. :paramtype replicas: list[~azure.mgmt.sqlvirtualmachine.models.AgReplica] @@ -84,16 +84,16 @@ class AgReplica(_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. Known values are: "PRIMARY" and "SECONDARY". + :ivar role: Replica Role in availability group. Known values are: "Primary" and "Secondary". :vartype role: str or ~azure.mgmt.sqlvirtualmachine.models.Role - :ivar commit: Replica commit mode in availability group. Known values are: "SYNCHRONOUS_COMMIT" - and "ASYNCHRONOUS_COMMIT". + :ivar commit: Replica commit mode in availability group. Known values are: "Synchronous_Commit" + and "Asynchronous_Commit". :vartype commit: str or ~azure.mgmt.sqlvirtualmachine.models.Commit - :ivar failover: Replica failover mode in availability group. Known values are: "AUTOMATIC" and - "MANUAL". + :ivar failover: Replica failover mode in availability group. Known values are: "Automatic" and + "Manual". :vartype failover: str or ~azure.mgmt.sqlvirtualmachine.models.Failover :ivar readable_secondary: Replica readable secondary mode in availability group. Known values - are: "NO", "ALL", and "READ_ONLY". + are: "No", "All", and "Read_Only". :vartype readable_secondary: str or ~azure.mgmt.sqlvirtualmachine.models.ReadableSecondary """ @@ -113,21 +113,21 @@ def __init__( commit: Optional[Union[str, "_models.Commit"]] = None, failover: Optional[Union[str, "_models.Failover"]] = None, readable_secondary: Optional[Union[str, "_models.ReadableSecondary"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sql_virtual_machine_instance_id: Sql VirtualMachine Instance Id. :paramtype sql_virtual_machine_instance_id: str - :keyword role: Replica Role in availability group. Known values are: "PRIMARY" and "SECONDARY". + :keyword role: Replica Role in availability group. Known values are: "Primary" and "Secondary". :paramtype role: str or ~azure.mgmt.sqlvirtualmachine.models.Role :keyword commit: Replica commit mode in availability group. Known values are: - "SYNCHRONOUS_COMMIT" and "ASYNCHRONOUS_COMMIT". + "Synchronous_Commit" and "Asynchronous_Commit". :paramtype commit: str or ~azure.mgmt.sqlvirtualmachine.models.Commit - :keyword failover: Replica failover mode in availability group. Known values are: "AUTOMATIC" - and "MANUAL". + :keyword failover: Replica failover mode in availability group. Known values are: "Automatic" + and "Manual". :paramtype failover: str or ~azure.mgmt.sqlvirtualmachine.models.Failover :keyword readable_secondary: Replica readable secondary mode in availability group. Known - values are: "NO", "ALL", and "READ_ONLY". + values are: "No", "All", and "Read_Only". :paramtype readable_secondary: str or ~azure.mgmt.sqlvirtualmachine.models.ReadableSecondary """ super().__init__(**kwargs) @@ -161,8 +161,8 @@ def __init__( enable: Optional[bool] = None, run_immediately: Optional[bool] = None, schedule: Optional["_models.Schedule"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enable: Enable or disable SQL best practices Assessment feature on SQL virtual machine. @@ -249,8 +249,8 @@ def __init__( full_backup_start_time: Optional[int] = None, full_backup_window_hours: Optional[int] = None, log_backup_frequency: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enable: Enable or disable autobackup on SQL virtual machine. :paramtype enable: bool @@ -333,8 +333,8 @@ def __init__( day_of_week: Optional[Union[str, "_models.DayOfWeek"]] = None, maintenance_window_starting_hour: Optional[int] = None, maintenance_window_duration: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enable: Enable or disable autopatching on SQL virtual machine. :paramtype enable: bool @@ -379,7 +379,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -412,7 +412,7 @@ class ProxyResource(Resource): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -494,8 +494,8 @@ def __init__( create_default_availability_group_if_not_exist: Optional[bool] = None, port: Optional[int] = None, availability_group_configuration: Optional["_models.AgConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword availability_group_name: Name of the availability group. :paramtype availability_group_name: str @@ -548,7 +548,7 @@ class AvailabilityGroupListenerListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -576,7 +576,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -616,7 +616,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -627,7 +627,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.sqlvirtualmachine.models.ErrorDetail @@ -637,7 +638,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.sqlvirtualmachine.models.ErrorDetail @@ -677,8 +678,8 @@ def __init__( azure_key_vault_url: Optional[str] = None, service_principal_name: Optional[str] = None, service_principal_secret: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enable: Enable or disable key vault credential setting. :paramtype enable: bool @@ -731,8 +732,8 @@ def __init__( load_balancer_resource_id: Optional[str] = None, probe_port: Optional[int] = None, sql_virtual_machine_instances: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_ip_address: Private IP address. :paramtype private_ip_address: ~azure.mgmt.sqlvirtualmachine.models.PrivateIPAddress @@ -776,7 +777,9 @@ class MultiSubnetIpConfiguration(_serialization.Model): "sql_virtual_machine_instance": {"key": "sqlVirtualMachineInstance", "type": "str"}, } - def __init__(self, *, private_ip_address: "_models.PrivateIPAddress", sql_virtual_machine_instance: str, **kwargs): + def __init__( + self, *, private_ip_address: "_models.PrivateIPAddress", sql_virtual_machine_instance: str, **kwargs: Any + ) -> None: """ :keyword private_ip_address: Private IP address. Required. :paramtype private_ip_address: ~azure.mgmt.sqlvirtualmachine.models.PrivateIPAddress @@ -818,7 +821,7 @@ class Operation(_serialization.Model): "properties": {"key": "properties", "type": "{object}"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -857,7 +860,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -887,7 +890,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -908,7 +911,9 @@ class PrivateIPAddress(_serialization.Model): "subnet_resource_id": {"key": "subnetResourceId", "type": "str"}, } - def __init__(self, *, ip_address: Optional[str] = None, subnet_resource_id: Optional[str] = None, **kwargs): + def __init__( + self, *, ip_address: Optional[str] = None, subnet_resource_id: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword ip_address: Private IP address bound to the availability group listener. :paramtype ip_address: str @@ -946,7 +951,7 @@ class ResourceIdentity(_serialization.Model): "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.IdentityType"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.IdentityType"]] = None, **kwargs: Any) -> None: """ :keyword type: The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource. Known values are: "None" and @@ -993,8 +998,8 @@ def __init__( monthly_occurrence: Optional[int] = None, day_of_week: Optional[Union[str, "_models.AssessmentDayOfWeek"]] = None, start_time: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enable: Enable or disable assessment schedule on SQL virtual machine. :paramtype enable: bool @@ -1070,8 +1075,8 @@ def __init__( additional_features_server_configurations: Optional["_models.AdditionalFeaturesServerConfigurations"] = None, sql_instance_settings: Optional["_models.SQLInstanceSettings"] = None, azure_ad_authentication_settings: Optional["_models.AADAuthenticationSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sql_connectivity_update_settings: SQL connectivity type settings. :paramtype sql_connectivity_update_settings: @@ -1128,8 +1133,8 @@ def __init__( port: Optional[int] = None, sql_auth_update_user_name: Optional[str] = None, sql_auth_update_password: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connectivity_type: SQL Server connectivity option. Known values are: "LOCAL", "PRIVATE", and "PUBLIC". @@ -1187,8 +1192,8 @@ def __init__( max_server_memory_mb: Optional[int] = None, is_lpim_enabled: Optional[bool] = None, is_ifi_enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword collation: SQL Server Collation. :paramtype collation: str @@ -1222,23 +1227,36 @@ class SQLStorageSettings(_serialization.Model): :vartype luns: list[int] :ivar default_file_path: SQL Server default file path. :vartype default_file_path: str + :ivar use_storage_pool: Use storage pool to build a drive if true or not provided. + :vartype use_storage_pool: bool """ _attribute_map = { "luns": {"key": "luns", "type": "[int]"}, "default_file_path": {"key": "defaultFilePath", "type": "str"}, + "use_storage_pool": {"key": "useStoragePool", "type": "bool"}, } - def __init__(self, *, luns: Optional[List[int]] = None, default_file_path: Optional[str] = None, **kwargs): + def __init__( + self, + *, + luns: Optional[List[int]] = None, + default_file_path: Optional[str] = None, + use_storage_pool: Optional[bool] = None, + **kwargs: Any + ) -> None: """ :keyword luns: Logical Unit Numbers for the disks. :paramtype luns: list[int] :keyword default_file_path: SQL Server default file path. :paramtype default_file_path: str + :keyword use_storage_pool: Use storage pool to build a drive if true or not provided. + :paramtype use_storage_pool: bool """ super().__init__(**kwargs) self.luns = luns self.default_file_path = default_file_path + self.use_storage_pool = use_storage_pool class SqlStorageUpdateSettings(_serialization.Model): @@ -1266,8 +1284,8 @@ def __init__( disk_count: Optional[int] = None, starting_device_id: Optional[int] = None, disk_configuration_type: Optional[Union[str, "_models.DiskConfigurationType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword disk_count: Virtual machine disk count. :paramtype disk_count: int @@ -1305,6 +1323,8 @@ class SQLTempDbSettings(_serialization.Model): :vartype luns: list[int] :ivar default_file_path: SQL Server default file path. :vartype default_file_path: str + :ivar use_storage_pool: Use storage pool to build a drive if true or not provided. + :vartype use_storage_pool: bool """ _attribute_map = { @@ -1317,6 +1337,7 @@ class SQLTempDbSettings(_serialization.Model): "persist_folder_path": {"key": "persistFolderPath", "type": "str"}, "luns": {"key": "luns", "type": "[int]"}, "default_file_path": {"key": "defaultFilePath", "type": "str"}, + "use_storage_pool": {"key": "useStoragePool", "type": "bool"}, } def __init__( @@ -1331,8 +1352,9 @@ def __init__( persist_folder_path: Optional[str] = None, luns: Optional[List[int]] = None, default_file_path: Optional[str] = None, - **kwargs - ): + use_storage_pool: Optional[bool] = None, + **kwargs: Any + ) -> None: """ :keyword data_file_size: SQL Server tempdb data file size. :paramtype data_file_size: int @@ -1352,6 +1374,8 @@ def __init__( :paramtype luns: list[int] :keyword default_file_path: SQL Server default file path. :paramtype default_file_path: str + :keyword use_storage_pool: Use storage pool to build a drive if true or not provided. + :paramtype use_storage_pool: bool """ super().__init__(**kwargs) self.data_file_size = data_file_size @@ -1363,6 +1387,7 @@ def __init__( self.persist_folder_path = persist_folder_path self.luns = luns self.default_file_path = default_file_path + self.use_storage_pool = use_storage_pool class TrackedResource(Resource): @@ -1399,7 +1424,7 @@ class TrackedResource(Resource): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. Required. :paramtype location: str @@ -1443,8 +1468,9 @@ class SqlVirtualMachine(TrackedResource): # pylint: disable=too-many-instance-a "DR". :vartype sql_server_license_type: str or ~azure.mgmt.sqlvirtualmachine.models.SqlServerLicenseType - :ivar sql_management: SQL Server Management type. Known values are: "Full", "LightWeight", and - "NoAgent". + :ivar sql_management: SQL Server Management type. NOTE: This parameter is not used anymore. API + will automatically detect the Sql Management, refrain from using it. Known values are: "Full", + "LightWeight", and "NoAgent". :vartype sql_management: str or ~azure.mgmt.sqlvirtualmachine.models.SqlManagementMode :ivar least_privilege_mode: SQL IaaS Agent least privilege mode. Known values are: "Enabled" and "NotSet". @@ -1552,8 +1578,8 @@ def __init__( # pylint: disable=too-many-locals storage_configuration_settings: Optional["_models.StorageConfigurationSettings"] = None, assessment_settings: Optional["_models.AssessmentSettings"] = None, enable_automatic_upgrade: bool = False, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. Required. :paramtype location: str @@ -1570,8 +1596,9 @@ def __init__( # pylint: disable=too-many-locals and "DR". :paramtype sql_server_license_type: str or ~azure.mgmt.sqlvirtualmachine.models.SqlServerLicenseType - :keyword sql_management: SQL Server Management type. Known values are: "Full", "LightWeight", - and "NoAgent". + :keyword sql_management: SQL Server Management type. NOTE: This parameter is not used anymore. + API will automatically detect the Sql Management, refrain from using it. Known values are: + "Full", "LightWeight", and "NoAgent". :paramtype sql_management: str or ~azure.mgmt.sqlvirtualmachine.models.SqlManagementMode :keyword least_privilege_mode: SQL IaaS Agent least privilege mode. Known values are: "Enabled" and "NotSet". @@ -1704,8 +1731,8 @@ def __init__( sql_image_offer: Optional[str] = None, sql_image_sku: Optional[Union[str, "_models.SqlVmGroupImageSku"]] = None, wsfc_domain_profile: Optional["_models.WsfcDomainProfile"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. Required. :paramtype location: str @@ -1750,7 +1777,7 @@ class SqlVirtualMachineGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1768,7 +1795,7 @@ class SqlVirtualMachineGroupUpdate(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -1798,7 +1825,7 @@ class SqlVirtualMachineListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1816,7 +1843,7 @@ class SqlVirtualMachineUpdate(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -1862,8 +1889,8 @@ def __init__( end_time_utc: Optional[datetime.datetime] = None, troubleshooting_scenario: Optional[Union[str, "_models.TroubleshootingScenario"]] = None, properties: Optional["_models.TroubleshootingAdditionalProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start_time_utc: Start time in UTC timezone. :paramtype start_time_utc: ~datetime.datetime @@ -1895,7 +1922,9 @@ class SqlWorkloadTypeUpdateSettings(_serialization.Model): "sql_workload_type": {"key": "sqlWorkloadType", "type": "str"}, } - def __init__(self, *, sql_workload_type: Optional[Union[str, "_models.SqlWorkloadType"]] = None, **kwargs): + def __init__( + self, *, sql_workload_type: Optional[Union[str, "_models.SqlWorkloadType"]] = None, **kwargs: Any + ) -> None: """ :keyword sql_workload_type: SQL Server workload type. Known values are: "GENERAL", "OLTP", and "DW". @@ -1923,6 +1952,9 @@ class StorageConfigurationSettings(_serialization.Model): :ivar storage_workload_type: Storage workload type. Known values are: "GENERAL", "OLTP", and "DW". :vartype storage_workload_type: str or ~azure.mgmt.sqlvirtualmachine.models.StorageWorkloadType + :ivar enable_storage_config_blade: Enable SQL IaaS Agent storage configuration blade in Azure + Portal. + :vartype enable_storage_config_blade: bool """ _attribute_map = { @@ -1932,6 +1964,7 @@ class StorageConfigurationSettings(_serialization.Model): "sql_system_db_on_data_disk": {"key": "sqlSystemDbOnDataDisk", "type": "bool"}, "disk_configuration_type": {"key": "diskConfigurationType", "type": "str"}, "storage_workload_type": {"key": "storageWorkloadType", "type": "str"}, + "enable_storage_config_blade": {"key": "enableStorageConfigBlade", "type": "bool"}, } def __init__( @@ -1943,8 +1976,9 @@ def __init__( sql_system_db_on_data_disk: Optional[bool] = None, disk_configuration_type: Optional[Union[str, "_models.DiskConfigurationType"]] = None, storage_workload_type: Optional[Union[str, "_models.StorageWorkloadType"]] = None, - **kwargs - ): + enable_storage_config_blade: bool = False, + **kwargs: Any + ) -> None: """ :keyword sql_data_settings: SQL Server Data Storage Settings. :paramtype sql_data_settings: ~azure.mgmt.sqlvirtualmachine.models.SQLStorageSettings @@ -1962,6 +1996,9 @@ def __init__( "DW". :paramtype storage_workload_type: str or ~azure.mgmt.sqlvirtualmachine.models.StorageWorkloadType + :keyword enable_storage_config_blade: Enable SQL IaaS Agent storage configuration blade in + Azure Portal. + :paramtype enable_storage_config_blade: bool """ super().__init__(**kwargs) self.sql_data_settings = sql_data_settings @@ -1970,6 +2007,7 @@ def __init__( self.sql_system_db_on_data_disk = sql_system_db_on_data_disk self.disk_configuration_type = disk_configuration_type self.storage_workload_type = storage_workload_type + self.enable_storage_config_blade = enable_storage_config_blade class SystemData(_serialization.Model): @@ -2009,8 +2047,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -2047,7 +2085,9 @@ class TroubleshootingAdditionalProperties(_serialization.Model): "unhealthy_replica_info": {"key": "unhealthyReplicaInfo", "type": "UnhealthyReplicaInfo"}, } - def __init__(self, *, unhealthy_replica_info: Optional["_models.UnhealthyReplicaInfo"] = None, **kwargs): + def __init__( + self, *, unhealthy_replica_info: Optional["_models.UnhealthyReplicaInfo"] = None, **kwargs: Any + ) -> None: """ :keyword unhealthy_replica_info: The unhealthy replica information. :paramtype unhealthy_replica_info: ~azure.mgmt.sqlvirtualmachine.models.UnhealthyReplicaInfo @@ -2094,7 +2134,7 @@ class TroubleshootingStatus(_serialization.Model): "properties": {"key": "properties", "type": "TroubleshootingAdditionalProperties"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.root_cause = None @@ -2116,7 +2156,7 @@ class UnhealthyReplicaInfo(_serialization.Model): "availability_group_name": {"key": "availabilityGroupName", "type": "str"}, } - def __init__(self, *, availability_group_name: Optional[str] = None, **kwargs): + def __init__(self, *, availability_group_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword availability_group_name: The name of the availability group. :paramtype availability_group_name: str @@ -2148,8 +2188,8 @@ def __init__( cluster_bootstrap_account_password: Optional[str] = None, cluster_operator_account_password: Optional[str] = None, sql_service_account_password: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword cluster_bootstrap_account_password: Cluster bootstrap account password. :paramtype cluster_bootstrap_account_password: str @@ -2180,6 +2220,8 @@ class WsfcDomainProfile(_serialization.Model): :ivar sql_service_account: Account name under which SQL service will run on all participating SQL virtual machines in the cluster. :vartype sql_service_account: str + :ivar is_sql_service_account_gmsa: The flag to check if SQL service account is GMSA. + :vartype is_sql_service_account_gmsa: bool :ivar file_share_witness_path: Optional path for fileshare witness. :vartype file_share_witness_path: str :ivar storage_account_url: Fully qualified ARM resource id of the witness storage account. @@ -2197,6 +2239,7 @@ class WsfcDomainProfile(_serialization.Model): "cluster_bootstrap_account": {"key": "clusterBootstrapAccount", "type": "str"}, "cluster_operator_account": {"key": "clusterOperatorAccount", "type": "str"}, "sql_service_account": {"key": "sqlServiceAccount", "type": "str"}, + "is_sql_service_account_gmsa": {"key": "isSqlServiceAccountGmsa", "type": "bool"}, "file_share_witness_path": {"key": "fileShareWitnessPath", "type": "str"}, "storage_account_url": {"key": "storageAccountUrl", "type": "str"}, "storage_account_primary_key": {"key": "storageAccountPrimaryKey", "type": "str"}, @@ -2211,12 +2254,13 @@ def __init__( cluster_bootstrap_account: Optional[str] = None, cluster_operator_account: Optional[str] = None, sql_service_account: Optional[str] = None, + is_sql_service_account_gmsa: Optional[bool] = None, 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 - ): + **kwargs: Any + ) -> None: """ :keyword domain_fqdn: Fully qualified name of the domain. :paramtype domain_fqdn: str @@ -2231,6 +2275,8 @@ def __init__( :keyword sql_service_account: Account name under which SQL service will run on all participating SQL virtual machines in the cluster. :paramtype sql_service_account: str + :keyword is_sql_service_account_gmsa: The flag to check if SQL service account is GMSA. + :paramtype is_sql_service_account_gmsa: bool :keyword file_share_witness_path: Optional path for fileshare witness. :paramtype file_share_witness_path: str :keyword storage_account_url: Fully qualified ARM resource id of the witness storage account. @@ -2247,6 +2293,7 @@ def __init__( self.cluster_bootstrap_account = cluster_bootstrap_account self.cluster_operator_account = cluster_operator_account self.sql_service_account = sql_service_account + self.is_sql_service_account_gmsa = is_sql_service_account_gmsa 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 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 cd67e5d00632..e63b23df48a9 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 @@ -65,8 +65,8 @@ class ClusterSubnetType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class Commit(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Replica commit mode in availability group.""" - SYNCHRONOUS_COMMIT = "SYNCHRONOUS_COMMIT" - ASYNCHRONOUS_COMMIT = "ASYNCHRONOUS_COMMIT" + SYNCHRONOUS_COMMIT = "Synchronous_Commit" + ASYNCHRONOUS_COMMIT = "Asynchronous_Commit" class ConnectivityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -110,8 +110,8 @@ class DiskConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class Failover(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Replica failover mode in availability group.""" - AUTOMATIC = "AUTOMATIC" - MANUAL = "MANUAL" + AUTOMATIC = "Automatic" + MANUAL = "Manual" class FullBackupFrequencyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -149,16 +149,16 @@ class OperationOrigin(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ReadableSecondary(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Replica readable secondary mode in availability group.""" - NO = "NO" - ALL = "ALL" - READ_ONLY = "READ_ONLY" + NO = "No" + ALL = "All" + READ_ONLY = "Read_Only" class Role(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Replica Role in availability group.""" - PRIMARY = "PRIMARY" - SECONDARY = "SECONDARY" + PRIMARY = "Primary" + SECONDARY = "Secondary" class ScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -178,7 +178,9 @@ class SqlImageSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): class SqlManagementMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """SQL Server Management type.""" + """SQL Server Management type. NOTE: This parameter is not used anymore. API will automatically + detect the Sql Management, refrain from using it. + """ FULL = "Full" LIGHT_WEIGHT = "LightWeight" 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 9eb47a7f793e..140c6a54a168 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. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,9 +51,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,9 +93,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -144,9 +136,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -182,9 +172,7 @@ def build_list_by_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -266,9 +254,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilityGroupListener] = kwargs.pop("cls", None) request = build_get_request( @@ -285,8 +271,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -326,16 +313,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailabilityGroupListener] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AvailabilityGroupListener") @@ -356,8 +341,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -480,8 +466,8 @@ def begin_create_or_update( :type sql_virtual_machine_group_name: str :param availability_group_listener_name: Name of the availability group listener. Required. :type availability_group_listener_name: str - :param parameters: The availability group listener. Is either a model type or a IO type. - Required. + :param parameters: The availability group listener. Is either a AvailabilityGroupListener type + or a IO type. Required. :type parameters: ~azure.mgmt.sqlvirtualmachine.models.AvailabilityGroupListener or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -503,9 +489,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailabilityGroupListener] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -571,9 +555,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -589,8 +571,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -643,9 +626,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -709,9 +690,7 @@ def list_by_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilityGroupListenerListResult] = kwargs.pop("cls", None) error_map = { @@ -765,8 +744,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 72d813204d85..edeb11b5d29f 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,9 +86,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -146,8 +137,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 096f9850d546..97a191ede1b0 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. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,9 +78,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -122,9 +114,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,9 +147,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -193,9 +181,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -223,9 +209,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -293,9 +277,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlVirtualMachineGroup] = kwargs.pop("cls", None) request = build_get_request( @@ -310,8 +292,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -350,16 +333,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SqlVirtualMachineGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SqlVirtualMachineGroup") @@ -379,8 +360,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -494,8 +476,8 @@ def begin_create_or_update( :type resource_group_name: str :param sql_virtual_machine_group_name: Name of the SQL virtual machine group. Required. :type sql_virtual_machine_group_name: str - :param parameters: The SQL virtual machine group. Is either a model type or a IO type. - Required. + :param parameters: The SQL virtual machine group. Is either a SqlVirtualMachineGroup type or a + IO type. Required. :type parameters: ~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -517,9 +499,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SqlVirtualMachineGroup] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -580,9 +560,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -597,8 +575,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -645,9 +624,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -707,16 +684,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SqlVirtualMachineGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SqlVirtualMachineGroupUpdate") @@ -736,8 +711,9 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -847,8 +823,8 @@ def begin_update( :type resource_group_name: str :param sql_virtual_machine_group_name: Name of the SQL virtual machine group. Required. :type sql_virtual_machine_group_name: str - :param parameters: The SQL virtual machine group. Is either a model type or a IO type. - Required. + :param parameters: The SQL virtual machine group. Is either a SqlVirtualMachineGroupUpdate type + or a IO type. Required. :type parameters: ~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineGroupUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -870,9 +846,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SqlVirtualMachineGroup] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -938,9 +912,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlVirtualMachineGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -993,8 +965,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1025,9 +998,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SqlVirtualMachineGroup"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlVirtualMachineGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -1079,8 +1050,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_sql_virtual_machine_troubleshoot_operations.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_sql_virtual_machine_troubleshoot_operations.py index f76e1b64d857..ca8757ba191c 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_sql_virtual_machine_troubleshoot_operations.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/operations/_sql_virtual_machine_troubleshoot_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. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -30,10 +30,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_troubleshoot_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -121,16 +115,14 @@ def _troubleshoot_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.SqlVmTroubleshooting]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SqlVmTroubleshooting") @@ -150,8 +142,9 @@ def _troubleshoot_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -267,8 +260,8 @@ def begin_troubleshoot( :type resource_group_name: str :param sql_virtual_machine_name: Name of the SQL virtual machine. Required. :type sql_virtual_machine_name: str - :param parameters: The SQL virtual machine troubleshooting entity. Is either a model type or a - IO type. Required. + :param parameters: The SQL virtual machine troubleshooting entity. Is either a + SqlVmTroubleshooting type or a IO type. Required. :type parameters: ~azure.mgmt.sqlvirtualmachine.models.SqlVmTroubleshooting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -290,9 +283,7 @@ def begin_troubleshoot( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SqlVmTroubleshooting] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) 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 8fe0a9b715d3..d2e75c73e91b 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. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_sql_vm_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,9 +76,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,26 +98,19 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - resource_group_name: str, - sql_virtual_machine_name: str, - subscription_id: str, - *, - expand: Optional[str] = None, - **kwargs: Any +def build_start_assessment_request( + resource_group_name: str, sql_virtual_machine_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/startAssessment", ) # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -143,32 +128,27 @@ def build_get_request( _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request( +def build_redeploy_request( resource_group_name: str, sql_virtual_machine_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}", + "/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"), @@ -189,22 +169,23 @@ def build_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( - resource_group_name: str, sql_virtual_machine_name: str, subscription_id: str, **kwargs: Any +def build_get_request( + resource_group_name: str, + sql_virtual_machine_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -228,23 +209,23 @@ def build_delete_request( _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request( +def build_create_or_update_request( resource_group_name: str, sql_virtual_machine_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -276,25 +257,33 @@ def build_update_request( _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_delete_request( + resource_group_name: str, sql_virtual_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}", ) # 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", + max_length=64, + min_length=1, + pattern=r'^((?!_)[^\\/"\'\[\]:|<>+=;,?*@&]{1,64}(? HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/startAssessment", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}", ) # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -344,37 +332,27 @@ def build_start_assessment_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_redeploy_request( - resource_group_name: str, sql_virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-08-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines", ) # 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", - max_length=64, - min_length=1, - pattern=r'^((?!_)[^\\/"\'\[\]:|<>+=;,?*@&]{1,64}(? Iterable["_models.SqlVirtualMachine"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlVirtualMachineListResult] = kwargs.pop("cls", None) error_map = { @@ -567,8 +542,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -581,7 +557,245 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines"} + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines"} + + 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, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_start_assessment_request( + 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._start_assessment_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _start_assessment_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/startAssessment" + } + + @distributed_trace + def begin_start_assessment( + self, resource_group_name: str, sql_virtual_machine_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Starts SQL best practices Assessment on SQL virtual machine. + + :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. Required. + :type resource_group_name: str + :param sql_virtual_machine_name: Name of the SQL virtual machine. Required. + :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_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) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.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) # type: ignore + + begin_start_assessment.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/startAssessment" + } + + 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, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_redeploy_request( + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _redeploy_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy" + } + + @distributed_trace + def begin_redeploy(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. Required. + :type resource_group_name: str + :param sql_virtual_machine_name: Name of the SQL virtual machine. Required. + :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._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): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.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) # type: ignore + + begin_redeploy.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy" + } @distributed_trace def get( @@ -612,9 +826,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlVirtualMachine] = kwargs.pop("cls", None) request = build_get_request( @@ -630,8 +842,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -670,16 +883,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SqlVirtualMachine] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SqlVirtualMachine") @@ -699,8 +910,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -812,7 +1024,8 @@ def begin_create_or_update( :type resource_group_name: str :param sql_virtual_machine_name: Name of the SQL virtual machine. Required. :type sql_virtual_machine_name: str - :param parameters: The SQL virtual machine. Is either a model type or a IO type. Required. + :param parameters: The SQL virtual machine. Is either a SqlVirtualMachine type or a IO type. + Required. :type parameters: ~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachine or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -833,9 +1046,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SqlVirtualMachine] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -896,9 +1107,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -913,8 +1122,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -959,9 +1169,7 @@ def begin_delete(self, resource_group_name: str, sql_virtual_machine_name: str, _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1021,16 +1229,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SqlVirtualMachine] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SqlVirtualMachineUpdate") @@ -1050,8 +1256,9 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1159,7 +1366,8 @@ def begin_update( :type resource_group_name: str :param sql_virtual_machine_name: Name of the SQL virtual machine. Required. :type sql_virtual_machine_name: str - :param parameters: The SQL virtual machine. Is either a model type or a IO type. Required. + :param parameters: The SQL virtual machine. Is either a SqlVirtualMachineUpdate type or a IO + type. Required. :type parameters: ~azure.mgmt.sqlvirtualmachine.models.SqlVirtualMachineUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1180,9 +1388,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SqlVirtualMachine] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1244,9 +1450,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlVirtualMachineListResult] = kwargs.pop("cls", None) error_map = { @@ -1299,8 +1503,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1316,247 +1521,3 @@ def get_next(next_link=None): list_by_resource_group.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines" } - - 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, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_start_assessment_request( - 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._start_assessment_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _start_assessment_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/startAssessment" - } - - @distributed_trace - def begin_start_assessment( - self, resource_group_name: str, sql_virtual_machine_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Starts SQL best practices Assessment on SQL virtual machine. - - :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. Required. - :type resource_group_name: str - :param sql_virtual_machine_name: Name of the SQL virtual machine. Required. - :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: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_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) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.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) # type: ignore - - begin_start_assessment.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/startAssessment" - } - - 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, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_redeploy_request( - 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) - - pipeline_response: PipelineResponse = 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _redeploy_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy" - } - - @distributed_trace - def begin_redeploy(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. Required. - :type resource_group_name: str - :param sql_virtual_machine_name: Name of the SQL virtual machine. Required. - :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: Literal["2022-08-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.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) # type: ignore - - begin_redeploy.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy" - } diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_availability_group_listener.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_availability_group_listener.py index 9293fb5e8a88..a65b37d97dbe 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_availability_group_listener.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_availability_group_listener.py @@ -57,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/CreateOrUpdateAvailabilityGroupListener.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/CreateOrUpdateAvailabilityGroupListener.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_availability_group_listener_with_multi_subnet.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_availability_group_listener_with_multi_subnet.py index 8c4e58d0d6c1..844c4476c24a 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_availability_group_listener_with_multi_subnet.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_availability_group_listener_with_multi_subnet.py @@ -59,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/CreateOrUpdateAvailabilityGroupListenerWithMultiSubnet.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/CreateOrUpdateAvailabilityGroupListenerWithMultiSubnet.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_automated_backup_weekly.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_automated_backup_weekly.py index 8496758dc585..170c9829795d 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_automated_backup_weekly.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_automated_backup_weekly.py @@ -70,7 +70,6 @@ def main(): "sqlWorkloadTypeUpdateSettings": {"sqlWorkloadType": "OLTP"}, }, "sqlImageSku": "Enterprise", - "sqlManagement": "Full", "sqlServerLicenseType": "PAYG", "virtualMachineResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm", }, @@ -79,6 +78,6 @@ def main(): print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/CreateOrUpdateSqlVirtualMachineAutomatedBackupWeekly.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/CreateOrUpdateSqlVirtualMachineAutomatedBackupWeekly.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_group.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_group.py index 98fa17323b53..2ae2efdd2f02 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_group.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_group.py @@ -42,6 +42,7 @@ def main(): "clusterOperatorAccount": "testrp@testdomain.com", "clusterSubnetType": "MultiSubnet", "domainFqdn": "testdomain.com", + "isSqlServiceAccountGmsa": False, "ouPath": "OU=WSCluster,DC=testdomain,DC=com", "sqlServiceAccount": "sqlservice@testdomain.com", "storageAccountPrimaryKey": "", @@ -54,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/CreateOrUpdateSqlVirtualMachineGroup.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/CreateOrUpdateSqlVirtualMachineGroup.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_max.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_max.py index c2d20f6995b9..6b65bf4cc82e 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_max.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_max.py @@ -92,8 +92,25 @@ def main(): "sqlWorkloadTypeUpdateSettings": {"sqlWorkloadType": "OLTP"}, }, "sqlImageSku": "Enterprise", - "sqlManagement": "Full", "sqlServerLicenseType": "PAYG", + "storageConfigurationSettings": { + "diskConfigurationType": "NEW", + "enableStorageConfigBlade": True, + "sqlDataSettings": {"defaultFilePath": "F:\\folderpath\\", "luns": [0], "useStoragePool": False}, + "sqlLogSettings": {"defaultFilePath": "G:\\folderpath\\", "luns": [1], "useStoragePool": False}, + "sqlSystemDbOnDataDisk": True, + "sqlTempDbSettings": { + "dataFileCount": 8, + "dataFileSize": 256, + "dataGrowth": 512, + "defaultFilePath": "D:\\TEMP", + "logFileSize": 256, + "logGrowth": 512, + "luns": [2], + "useStoragePool": False, + }, + "storageWorkloadType": "OLTP", + }, "virtualMachineResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm", }, }, @@ -101,6 +118,6 @@ def main(): print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/CreateOrUpdateSqlVirtualMachineMAX.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/CreateOrUpdateSqlVirtualMachineMAX.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_min.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_min.py index ac6bd7897afb..dd831d25e6ed 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_min.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_min.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/CreateOrUpdateSqlVirtualMachineMIN.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/CreateOrUpdateSqlVirtualMachineMIN.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_storage_configuration_extend.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_storage_configuration_extend.py index e69c41ab8a7e..4c5e74c65ad3 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_storage_configuration_extend.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_storage_configuration_extend.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/CreateOrUpdateSqlVirtualMachineStorageConfigurationEXTEND.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/CreateOrUpdateSqlVirtualMachineStorageConfigurationEXTEND.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_storage_configuration_new.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_storage_configuration_new.py index 7be15439be7a..3ebf2415b16b 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_storage_configuration_new.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_sql_virtual_machine_storage_configuration_new.py @@ -57,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/CreateOrUpdateSqlVirtualMachineStorageConfigurationNEW.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/CreateOrUpdateSqlVirtualMachineStorageConfigurationNEW.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_virtual_machine_with_vm_group.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_virtual_machine_with_vm_group.py index de8a1b8f8b40..5eb99f89673e 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_virtual_machine_with_vm_group.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/create_or_update_virtual_machine_with_vm_group.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/CreateOrUpdateVirtualMachineWithVMGroup.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/CreateOrUpdateVirtualMachineWithVMGroup.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/delete_availability_group_listener.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/delete_availability_group_listener.py index 516b60cec822..a6e573e158d6 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/delete_availability_group_listener.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/delete_availability_group_listener.py @@ -29,14 +29,13 @@ def main(): subscription_id="00000000-1111-2222-3333-444444444444", ) - response = client.availability_group_listeners.begin_delete( + client.availability_group_listeners.begin_delete( resource_group_name="testrg", sql_virtual_machine_group_name="testvmgroup", availability_group_listener_name="agl-test", ).result() - print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/DeleteAvailabilityGroupListener.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/DeleteAvailabilityGroupListener.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/delete_sql_virtual_machine.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/delete_sql_virtual_machine.py index 4e851a261621..00657c9885e2 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/delete_sql_virtual_machine.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/delete_sql_virtual_machine.py @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-1111-2222-3333-444444444444", ) - response = client.sql_virtual_machines.begin_delete( + client.sql_virtual_machines.begin_delete( resource_group_name="testrg", sql_virtual_machine_name="testvm1", ).result() - print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/DeleteSqlVirtualMachine.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/DeleteSqlVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/delete_sql_virtual_machine_group.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/delete_sql_virtual_machine_group.py index be5b5bb35f55..c3a4f213151d 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/delete_sql_virtual_machine_group.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/delete_sql_virtual_machine_group.py @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-1111-2222-3333-444444444444", ) - response = client.sql_virtual_machine_groups.begin_delete( + client.sql_virtual_machine_groups.begin_delete( resource_group_name="testrg", sql_virtual_machine_group_name="testvmgroup", ).result() - print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/DeleteSqlVirtualMachineGroup.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/DeleteSqlVirtualMachineGroup.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/get_availability_group_listener.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/get_availability_group_listener.py index e5bac1142f17..ff7ee004b4ac 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/get_availability_group_listener.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/get_availability_group_listener.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/GetAvailabilityGroupListener.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/GetAvailabilityGroupListener.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/get_sql_virtual_machine.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/get_sql_virtual_machine.py index 1c6899f8e5e8..0dd6a391eb82 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/get_sql_virtual_machine.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/get_sql_virtual_machine.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/GetSqlVirtualMachine.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/GetSqlVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/get_sql_virtual_machine_group.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/get_sql_virtual_machine_group.py index ca95050bce1e..3294cd03c42a 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/get_sql_virtual_machine_group.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/get_sql_virtual_machine_group.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/GetSqlVirtualMachineGroup.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/GetSqlVirtualMachineGroup.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_by_group_availability_group_listener.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_by_group_availability_group_listener.py index 10266719a7e8..1e5f5375eb8a 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_by_group_availability_group_listener.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_by_group_availability_group_listener.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/ListByGroupAvailabilityGroupListener.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/ListByGroupAvailabilityGroupListener.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_by_resource_group_sql_virtual_machine.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_by_resource_group_sql_virtual_machine.py index fa18c78792a2..5e2e63eeaca2 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_by_resource_group_sql_virtual_machine.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_by_resource_group_sql_virtual_machine.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/ListByResourceGroupSqlVirtualMachine.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/ListByResourceGroupSqlVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_by_resource_group_sql_virtual_machine_group.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_by_resource_group_sql_virtual_machine_group.py index e76fadbb6855..44a3ed25dc5f 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_by_resource_group_sql_virtual_machine_group.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_by_resource_group_sql_virtual_machine_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/ListByResourceGroupSqlVirtualMachineGroup.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/ListByResourceGroupSqlVirtualMachineGroup.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_by_sql_virtual_machine_group_sql_virtual_machine.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_by_sql_virtual_machine_group_sql_virtual_machine.py index 63c45b9e3f6d..f0707e61012f 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_by_sql_virtual_machine_group_sql_virtual_machine.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_by_sql_virtual_machine_group_sql_virtual_machine.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/ListBySqlVirtualMachineGroupSqlVirtualMachine.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/ListBySqlVirtualMachineGroupSqlVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_operation.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_operation.py index b7d6ddaa3c97..14d36e2775c6 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_operation.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_operation.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/ListOperation.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/ListOperation.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_subscription_sql_virtual_machine.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_subscription_sql_virtual_machine.py index 2b21453d4e11..a1622f06143a 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_subscription_sql_virtual_machine.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_subscription_sql_virtual_machine.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/ListSubscriptionSqlVirtualMachine.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/ListSubscriptionSqlVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_subscription_sql_virtual_machine_group.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_subscription_sql_virtual_machine_group.py index 8c6d85bb426b..cf4df0331cec 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_subscription_sql_virtual_machine_group.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/list_subscription_sql_virtual_machine_group.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/ListSubscriptionSqlVirtualMachineGroup.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/ListSubscriptionSqlVirtualMachineGroup.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/redeploy_sql_virtual_machine.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/redeploy_sql_virtual_machine.py index b3f53688cefa..56df7f52354d 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/redeploy_sql_virtual_machine.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/redeploy_sql_virtual_machine.py @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-1111-2222-3333-444444444444", ) - response = client.sql_virtual_machines.begin_redeploy( + client.sql_virtual_machines.begin_redeploy( resource_group_name="testrg", sql_virtual_machine_name="testvm", ).result() - print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/RedeploySqlVirtualMachine.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/RedeploySqlVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/start_assessment_on_sql_virtual_machine.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/start_assessment_on_sql_virtual_machine.py index 332305c8180c..ee75918f25e0 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/start_assessment_on_sql_virtual_machine.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/start_assessment_on_sql_virtual_machine.py @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-1111-2222-3333-444444444444", ) - response = client.sql_virtual_machines.begin_start_assessment( + client.sql_virtual_machines.begin_start_assessment( resource_group_name="testrg", sql_virtual_machine_name="testvm", ).result() - print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/StartAssessmentOnSqlVirtualMachine.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/StartAssessmentOnSqlVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/troubleshoot_sql_virtual_machine.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/troubleshoot_sql_virtual_machine.py index 04fa624f64db..30c4a34fa3f7 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/troubleshoot_sql_virtual_machine.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/troubleshoot_sql_virtual_machine.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/TroubleshootSqlVirtualMachine.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/TroubleshootSqlVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/update_sql_virtual_machine.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/update_sql_virtual_machine.py index d8eff4e52da9..637e23647dfb 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/update_sql_virtual_machine.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/update_sql_virtual_machine.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/UpdateSqlVirtualMachine.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/UpdateSqlVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/update_sql_virtual_machine_group.py b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/update_sql_virtual_machine_group.py index edb2826f8d93..59c2111627b4 100644 --- a/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/update_sql_virtual_machine_group.py +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/generated_samples/update_sql_virtual_machine_group.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-08-01-preview/examples/UpdateSqlVirtualMachineGroup.json +# x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2023-01-01-preview/examples/UpdateSqlVirtualMachineGroup.json if __name__ == "__main__": main()