diff --git a/sdk/rdbms/azure-mgmt-rdbms/_meta.json b/sdk/rdbms/azure-mgmt-rdbms/_meta.json index 775c53f68770..99f892874b30 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/_meta.json +++ b/sdk/rdbms/azure-mgmt-rdbms/_meta.json @@ -1,11 +1,11 @@ { - "commit": "4f2b947e69be7eb813b048c815f879101ee2bf2a", + "commit": "0535fc85dd165092f3f0463caa398b0b39c70cd1", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.1", + "@autorest/python@6.2.7", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/mysql/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.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", - "readme": "specification/mysql/resource-manager/readme.md" + "autorest_command": "autorest specification/postgresql/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.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "readme": "specification/postgresql/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/__init__.py index 473b3c5678d9..d13a655142e5 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_configuration.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_configuration.py index 170069720193..c79a7430b4af 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_configuration.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_configuration.py @@ -44,10 +44,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-rdbms/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_postgre_sql_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_postgre_sql_management_client.py index 40b1ad165ada..25c04726495a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_postgre_sql_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_postgre_sql_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import PostgreSQLManagementClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -113,7 +113,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -178,15 +178,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> PostgreSQLManagementClient + def __enter__(self) -> "PostgreSQLManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_serialization.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_serialization.py index 7c1dedb5133d..2c170e28dbca 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_serialization.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,24 +38,22 @@ import re import sys import codecs +from typing import Optional, Union, AnyStr, IO, Mapping try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate +import isodate # type: ignore -from typing import Dict, Any, cast, TYPE_CHECKING +from typing import Dict, Any, cast from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping - class RawDeserializer: @@ -65,8 +64,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +130,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +157,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +185,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +216,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,9 +273,9 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs): self.additional_properties = {} @@ -310,7 +307,7 @@ def enable_additional_properties_sending(cls): @classmethod def is_xml_model(cls): try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,7 +316,7 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} @@ -453,7 +450,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -606,13 +603,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,23 +618,23 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): + for k in reversed(keys): # type: ignore unflattened = {k: new_attr} new_attr = unflattened _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue @@ -675,7 +672,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -843,7 +840,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -1001,10 +998,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1416,7 +1413,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1441,7 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1543,7 +1540,7 @@ def _unpack_content(raw_data, content_type=None): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1562,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1744,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1795,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1807,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1823,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1838,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1868,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1886,7 +1883,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1898,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1921,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1957,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_version.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_version.py index cecdf950a4a9..e5754a47ce68 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_version.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.2.0b5" +VERSION = "1.0.0b1" diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/__init__.py index a3ea1a85dcd9..7668cabb316d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/_postgre_sql_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/_postgre_sql_management_client.py index 59ffbae0b95b..34f6a510d4b3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/_postgre_sql_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/_postgre_sql_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import PostgreSQLManagementClientConfiguration from .operations import ( @@ -114,7 +114,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/__init__.py index 8c27a8a6a8b9..9919fdbfb4ba 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/__init__.py @@ -26,7 +26,7 @@ from ._server_keys_operations import ServerKeysOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_check_name_availability_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_check_name_availability_operations.py index 3a61a1be7fa1..6a70094d9ba0 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_check_name_availability_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_check_name_availability_operations.py @@ -124,9 +124,9 @@ async def execute( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NameAvailability] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -147,9 +147,9 @@ async def execute( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -166,4 +166,6 @@ async def execute( return deserialized - execute.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability"} # type: ignore + execute.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_configurations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_configurations_operations.py index 2ea9a07bd620..206e6ccf9756 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_configurations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_configurations_operations.py @@ -82,9 +82,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Configuration]] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -108,9 +108,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -129,7 +129,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}" + } @overload async def begin_create_or_update( @@ -249,14 +251,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Configuration] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, configuration_name=configuration_name, @@ -277,7 +279,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -289,9 +291,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}" + } @distributed_trace_async async def get( @@ -322,8 +326,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Configuration] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -336,9 +340,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -355,7 +359,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}" + } @distributed_trace def list_by_server( @@ -377,8 +383,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConfigurationListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.ConfigurationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -401,12 +407,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -414,13 +420,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ConfigurationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -433,4 +439,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_databases_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_databases_operations.py index 041da9e3fe2a..2b95ee4b044d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_databases_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_databases_operations.py @@ -83,9 +83,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Database]] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -109,9 +109,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -133,7 +133,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" + } @overload async def begin_create_or_update( @@ -253,14 +255,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Database] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Database] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, @@ -281,7 +283,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -293,9 +295,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any @@ -311,8 +315,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -325,9 +329,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -340,7 +344,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" + } @distributed_trace_async async def begin_delete( @@ -370,11 +376,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -393,7 +399,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -405,9 +411,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" + } @distributed_trace_async async def get( @@ -438,8 +446,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Database] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.Database] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -452,9 +460,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -471,7 +479,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" + } @distributed_trace def list_by_server( @@ -492,8 +502,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -516,12 +526,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -529,13 +539,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DatabaseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -548,4 +558,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_firewall_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_firewall_rules_operations.py index d7a3e3d82155..349da2aed2ac 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_firewall_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_firewall_rules_operations.py @@ -83,9 +83,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.FirewallRule]] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.FirewallRule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -109,9 +109,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -133,7 +133,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" + } @overload async def begin_create_or_update( @@ -253,14 +255,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FirewallRule] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, @@ -281,7 +283,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -293,9 +295,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any @@ -311,8 +315,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -325,9 +329,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -340,7 +344,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" + } @distributed_trace_async async def begin_delete( @@ -370,11 +376,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -393,7 +399,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -405,9 +411,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" + } @distributed_trace_async async def get( @@ -438,8 +446,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FirewallRule] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -452,9 +460,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -471,7 +479,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" + } @distributed_trace def list_by_server( @@ -493,8 +503,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FirewallRuleListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.FirewallRuleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -517,12 +527,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -530,13 +540,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("FirewallRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -549,4 +559,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_location_based_performance_tier_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_location_based_performance_tier_operations.py index f6a8a7102947..7c40d778638d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_location_based_performance_tier_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_location_based_performance_tier_operations.py @@ -72,8 +72,8 @@ def list(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.Perf _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PerformanceTierListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.PerformanceTierListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -95,12 +95,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -108,13 +108,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PerformanceTierListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -127,4 +127,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/performanceTiers"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/performanceTiers" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_log_files_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_log_files_operations.py index 67c17ab44aac..b1317f3c562c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_log_files_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_log_files_operations.py @@ -75,8 +75,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LogFileListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.LogFileListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -99,12 +99,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -112,13 +112,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("LogFileListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,4 +131,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/logFiles"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/logFiles" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_operations.py index 2a57b555de34..230004b4ce67 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_operations.py @@ -75,8 +75,8 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) request = build_list_request( api_version=api_version, @@ -85,9 +85,9 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -104,4 +104,4 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: return deserialized - list.metadata = {"url": "/providers/Microsoft.DBforPostgreSQL/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.DBforPostgreSQL/operations"} diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_private_endpoint_connections_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_private_endpoint_connections_operations.py index 43fa61506c8a..94bbf5a15b59 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_private_endpoint_connections_operations.py @@ -94,8 +94,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -108,9 +108,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -127,7 +127,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _create_or_update_initial( self, @@ -148,9 +150,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -174,9 +176,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -195,7 +197,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload async def begin_create_or_update( @@ -317,14 +321,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -345,7 +349,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -357,9 +361,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -375,8 +381,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -389,9 +395,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -404,7 +410,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def begin_delete( @@ -434,11 +442,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -457,7 +465,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -469,9 +477,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _update_tags_initial( self, @@ -492,9 +502,9 @@ async def _update_tags_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -518,9 +528,9 @@ async def _update_tags_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -537,7 +547,9 @@ async def _update_tags_initial( return deserialized - _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _update_tags_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload async def begin_update_tags( @@ -668,14 +680,14 @@ async def begin_update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_tags_initial( # type: ignore + raw_result = await self._update_tags_initial( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -696,7 +708,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -708,9 +720,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def list_by_server( @@ -733,8 +747,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -757,12 +771,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -770,13 +784,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -789,4 +803,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_private_link_resources_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_private_link_resources_operations.py index 62bef64c238f..4783f9e99b3c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_private_link_resources_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_private_link_resources_operations.py @@ -77,8 +77,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourceListResult] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -101,12 +101,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -114,13 +114,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -133,7 +133,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources" + } @distributed_trace_async async def get( @@ -164,8 +166,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -178,9 +180,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -197,4 +199,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources/{groupName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources/{groupName}" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_recoverable_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_recoverable_servers_operations.py index b7f4e0408e48..f380a6a91e4a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_recoverable_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_recoverable_servers_operations.py @@ -80,8 +80,8 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoverableServerResource] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.RecoverableServerResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -93,9 +93,9 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,4 +112,6 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/recoverableServers"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/recoverableServers" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_replicas_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_replicas_operations.py index 8e2a2771bb70..340f17ff0ca9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_replicas_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_replicas_operations.py @@ -75,8 +75,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -99,12 +99,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -112,13 +112,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,4 +131,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/replicas"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/replicas" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_administrators_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_administrators_operations.py index eb758b6a0a1a..39c12a22c752 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_administrators_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_administrators_operations.py @@ -91,8 +91,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerAdministratorResource] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.ServerAdministratorResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -104,9 +104,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -123,7 +123,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" + } async def _create_or_update_initial( self, @@ -143,9 +145,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerAdministratorResource] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServerAdministratorResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -168,9 +170,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -187,11 +189,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("ServerAdministratorResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" + } @overload async def begin_create_or_update( @@ -310,14 +314,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerAdministratorResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServerAdministratorResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, properties=properties, @@ -337,7 +341,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -349,9 +353,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, **kwargs: Any @@ -367,8 +373,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -380,9 +386,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -395,7 +401,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" + } @distributed_trace_async async def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -421,11 +429,11 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -443,7 +451,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -455,9 +463,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" + } @distributed_trace def list( @@ -480,8 +490,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerAdministratorResourceListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.ServerAdministratorResourceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -504,12 +514,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -517,13 +527,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ServerAdministratorResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -536,4 +546,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_based_performance_tier_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_based_performance_tier_operations.py index 3aca60a3cb1b..57862c63e520 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_based_performance_tier_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_based_performance_tier_operations.py @@ -77,8 +77,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PerformanceTierListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.PerformanceTierListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -101,12 +101,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -114,13 +114,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PerformanceTierListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -133,4 +133,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/performanceTiers"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/performanceTiers" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_keys_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_keys_operations.py index 268a9d59a8e0..40efce15bac6 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_keys_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_keys_operations.py @@ -81,8 +81,8 @@ def list(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerKeyListResult] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ServerKeyListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -105,12 +105,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,13 +118,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ServerKeyListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -137,7 +137,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys" + } @distributed_trace_async async def get(self, resource_group_name: str, server_name: str, key_name: str, **kwargs: Any) -> _models.ServerKey: @@ -166,8 +168,8 @@ async def get(self, resource_group_name: str, server_name: str, key_name: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerKey] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ServerKey] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -180,9 +182,9 @@ async def get(self, resource_group_name: str, server_name: str, key_name: str, * params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -199,7 +201,9 @@ async def get(self, resource_group_name: str, server_name: str, key_name: str, * return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" + } async def _create_or_update_initial( self, @@ -220,9 +224,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerKey] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServerKey] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -246,9 +250,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -265,11 +269,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("ServerKey", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" + } @overload async def begin_create_or_update( @@ -392,14 +398,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerKey] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServerKey] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( server_name=server_name, key_name=key_name, resource_group_name=resource_group_name, @@ -420,7 +426,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -432,9 +438,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, server_name: str, key_name: str, resource_group_name: str, **kwargs: Any @@ -450,8 +458,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( server_name=server_name, @@ -464,9 +472,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -479,7 +487,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" + } @distributed_trace_async async def begin_delete( @@ -509,11 +519,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore server_name=server_name, @@ -532,7 +542,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -544,6 +554,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_parameters_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_parameters_operations.py index f093d1ae896d..ac0a6810a241 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_parameters_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_parameters_operations.py @@ -75,9 +75,9 @@ async def _list_update_configurations_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ConfigurationListResult]] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ConfigurationListResult]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -100,9 +100,9 @@ async def _list_update_configurations_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -121,7 +121,9 @@ async def _list_update_configurations_initial( return deserialized - _list_update_configurations_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/updateConfigurations"} # type: ignore + _list_update_configurations_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/updateConfigurations" + } @overload async def begin_list_update_configurations( @@ -235,14 +237,14 @@ async def begin_list_update_configurations( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConfigurationListResult] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationListResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._list_update_configurations_initial( # type: ignore + raw_result = await self._list_update_configurations_initial( resource_group_name=resource_group_name, server_name=server_name, value=value, @@ -262,10 +264,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -277,6 +279,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_list_update_configurations.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/updateConfigurations"} # type: ignore + begin_list_update_configurations.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/updateConfigurations" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_security_alert_policies_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_security_alert_policies_operations.py index 83246eff038d..f46cffd8bd74 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_security_alert_policies_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_security_alert_policies_operations.py @@ -97,8 +97,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerSecurityAlertPolicy] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.ServerSecurityAlertPolicy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -111,9 +111,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -130,7 +130,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" + } async def _create_or_update_initial( self, @@ -151,9 +153,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ServerSecurityAlertPolicy]] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ServerSecurityAlertPolicy]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -177,9 +179,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -198,7 +200,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" + } @overload async def begin_create_or_update( @@ -324,14 +328,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerSecurityAlertPolicy] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServerSecurityAlertPolicy] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, security_alert_policy_name=security_alert_policy_name, @@ -352,7 +356,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -364,9 +368,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" + } @distributed_trace def list_by_server( @@ -389,8 +395,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerSecurityAlertPolicyListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.ServerSecurityAlertPolicyListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -413,12 +419,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -426,13 +432,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ServerSecurityAlertPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -445,4 +451,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_servers_operations.py index 36c2541e7cab..3a05c7312bdb 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_servers_operations.py @@ -81,9 +81,9 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Server]] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -106,9 +106,9 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -130,7 +130,9 @@ async def _create_initial( return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" + } @overload async def begin_create( @@ -237,14 +239,14 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Server] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Server] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -264,7 +266,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -276,9 +278,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" + } async def _update_initial( self, @@ -298,9 +302,9 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Server]] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -323,9 +327,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -344,7 +348,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" + } @overload async def begin_update( @@ -458,14 +464,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Server] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Server] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -485,7 +491,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -497,9 +503,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, **kwargs: Any @@ -515,8 +523,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -528,9 +536,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -543,7 +551,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" + } @distributed_trace_async async def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -569,11 +579,11 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -591,7 +601,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -603,9 +613,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" + } @distributed_trace_async async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _models.Server: @@ -632,8 +644,8 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Server] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.Server] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -645,9 +657,9 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -664,7 +676,9 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" + } @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Server"]: @@ -681,8 +695,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -704,12 +718,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -717,13 +731,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -736,7 +750,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers" + } @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Server"]: @@ -750,8 +766,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Server"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -772,12 +788,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -785,13 +801,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -804,7 +820,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/servers"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/servers"} async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, **kwargs: Any @@ -820,8 +836,8 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_restart_request( resource_group_name=resource_group_name, @@ -833,9 +849,9 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -848,7 +864,9 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/restart"} # type: ignore + _restart_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/restart" + } @distributed_trace_async async def begin_restart(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -874,11 +892,11 @@ async def begin_restart(self, resource_group_name: str, server_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._restart_initial( # type: ignore resource_group_name=resource_group_name, @@ -896,7 +914,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -908,6 +926,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_restart.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/restart"} # type: ignore + begin_restart.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/restart" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_virtual_network_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_virtual_network_rules_operations.py index e849707431a0..a786830950fa 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_virtual_network_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_virtual_network_rules_operations.py @@ -93,8 +93,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VirtualNetworkRule] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.VirtualNetworkRule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -107,9 +107,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -126,7 +126,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" + } async def _create_or_update_initial( self, @@ -147,9 +149,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.VirtualNetworkRule]] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VirtualNetworkRule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -173,9 +175,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -197,7 +199,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" + } @overload async def begin_create_or_update( @@ -320,14 +324,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VirtualNetworkRule] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkRule] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, @@ -348,7 +352,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -360,9 +364,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, virtual_network_rule_name: str, **kwargs: Any @@ -378,8 +384,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -392,9 +398,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -407,7 +413,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" + } @distributed_trace_async async def begin_delete( @@ -437,11 +445,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -460,7 +468,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -472,9 +480,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" + } @distributed_trace def list_by_server( @@ -496,8 +506,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VirtualNetworkRuleListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.VirtualNetworkRuleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -520,12 +530,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -533,13 +543,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("VirtualNetworkRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -552,4 +562,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/__init__.py index 5aab218cf147..29f857be42d2 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/__init__.py @@ -80,7 +80,7 @@ from ._postgre_sql_management_client_enums import StorageAutogrow from ._postgre_sql_management_client_enums import VirtualNetworkRuleState from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_models_py3.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_models_py3.py index 84f5668a38b7..651bb2dc2b24 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_models_py3.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_models_py3.py @@ -1892,7 +1892,7 @@ def __init__( self.infrastructure_encryption = infrastructure_encryption self.public_network_access = public_network_access self.storage_profile = storage_profile - self.create_mode = None # type: Optional[str] + self.create_mode: Optional[str] = None class ServerPropertiesForDefaultCreate(ServerPropertiesForCreate): @@ -1997,7 +1997,7 @@ def __init__( storage_profile=storage_profile, **kwargs ) - self.create_mode = "Default" # type: str + self.create_mode: str = "Default" self.administrator_login = administrator_login self.administrator_login_password = administrator_login_password @@ -2095,7 +2095,7 @@ def __init__( storage_profile=storage_profile, **kwargs ) - self.create_mode = "GeoRestore" # type: str + self.create_mode: str = "GeoRestore" self.source_server_id = source_server_id @@ -2192,7 +2192,7 @@ def __init__( storage_profile=storage_profile, **kwargs ) - self.create_mode = "Replica" # type: str + self.create_mode: str = "Replica" self.source_server_id = source_server_id @@ -2298,7 +2298,7 @@ def __init__( storage_profile=storage_profile, **kwargs ) - self.create_mode = "PointInTimeRestore" # type: str + self.create_mode: str = "PointInTimeRestore" self.source_server_id = source_server_id self.restore_point_in_time = restore_point_in_time diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/__init__.py index 8c27a8a6a8b9..9919fdbfb4ba 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/__init__.py @@ -26,7 +26,7 @@ from ._server_keys_operations import ServerKeysOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_check_name_availability_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_check_name_availability_operations.py index 5d80ebde7c6e..eb2d8c9192a6 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_check_name_availability_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_check_name_availability_operations.py @@ -43,8 +43,8 @@ def build_execute_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 = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +55,7 @@ def build_execute_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -156,9 +156,9 @@ def execute( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NameAvailability] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -179,9 +179,9 @@ def execute( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -198,4 +198,6 @@ def execute( return deserialized - execute.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability"} # type: ignore + execute.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_configurations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_configurations_operations.py index f11fbae53bbe..47cb47914d90 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_configurations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_configurations_operations.py @@ -48,8 +48,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +66,7 @@ def build_create_or_update_request( "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,7 +85,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +102,7 @@ def build_get_request( "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,7 +119,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +135,7 @@ def build_list_by_server_request( "serverName": _SERIALIZER.url("server_name", server_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,9 +184,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Configuration]] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -210,9 +210,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -231,7 +231,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}" + } @overload def begin_create_or_update( @@ -351,14 +353,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Configuration] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, configuration_name=configuration_name, @@ -379,7 +381,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -391,9 +393,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}" + } @distributed_trace def get( @@ -424,8 +428,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Configuration] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -438,9 +442,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -457,7 +461,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}" + } @distributed_trace def list_by_server( @@ -478,8 +484,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConfigurationListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.ConfigurationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -502,12 +508,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -515,13 +521,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ConfigurationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -534,4 +540,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_databases_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_databases_operations.py index 1e84e87addde..a00107332d22 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_databases_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_databases_operations.py @@ -48,8 +48,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +66,7 @@ def build_create_or_update_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,7 +85,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +102,7 @@ def build_delete_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,7 +119,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,7 +136,7 @@ def build_get_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -153,7 +153,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -169,7 +169,7 @@ def build_list_by_server_request( "serverName": _SERIALIZER.url("server_name", server_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -218,9 +218,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Database]] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -244,9 +244,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -268,7 +268,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" + } @overload def begin_create_or_update( @@ -385,14 +387,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Database] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Database] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, @@ -413,7 +415,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -425,9 +427,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any @@ -443,8 +447,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -457,9 +461,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -472,7 +476,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" + } @distributed_trace def begin_delete( @@ -502,11 +508,11 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -525,7 +531,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -537,9 +543,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" + } @distributed_trace def get(self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any) -> _models.Database: @@ -568,8 +576,8 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Database] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.Database] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -582,9 +590,9 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -601,7 +609,9 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" + } @distributed_trace def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterable["_models.Database"]: @@ -620,8 +630,8 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -644,12 +654,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -657,13 +667,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DatabaseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -676,4 +686,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_firewall_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_firewall_rules_operations.py index b9ad87b4255f..8a57b8ef5c94 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_firewall_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_firewall_rules_operations.py @@ -48,8 +48,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +66,7 @@ def build_create_or_update_request( "firewallRuleName": _SERIALIZER.url("firewall_rule_name", firewall_rule_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,7 +85,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +102,7 @@ def build_delete_request( "firewallRuleName": _SERIALIZER.url("firewall_rule_name", firewall_rule_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,7 +119,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,7 +136,7 @@ def build_get_request( "firewallRuleName": _SERIALIZER.url("firewall_rule_name", firewall_rule_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -153,7 +153,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -169,7 +169,7 @@ def build_list_by_server_request( "serverName": _SERIALIZER.url("server_name", server_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -218,9 +218,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.FirewallRule]] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.FirewallRule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -244,9 +244,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -268,7 +268,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" + } @overload def begin_create_or_update( @@ -388,14 +390,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FirewallRule] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, @@ -416,7 +418,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -428,9 +430,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any @@ -446,8 +450,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -460,9 +464,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -475,7 +479,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" + } @distributed_trace def begin_delete( @@ -505,11 +511,11 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -528,7 +534,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -540,9 +546,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" + } @distributed_trace def get( @@ -573,8 +581,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FirewallRule] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -587,9 +595,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -606,7 +614,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" + } @distributed_trace def list_by_server( @@ -627,8 +637,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FirewallRuleListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.FirewallRuleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -651,12 +661,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -664,13 +674,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("FirewallRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -683,4 +693,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_location_based_performance_tier_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_location_based_performance_tier_operations.py index bd36552c90f3..4f2dc3522baa 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_location_based_performance_tier_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_location_based_performance_tier_operations.py @@ -44,7 +44,7 @@ def build_list_request(location_name: str, subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +57,7 @@ def build_list_request(location_name: str, subscription_id: str, **kwargs: Any) "locationName": _SERIALIZER.url("location_name", location_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -103,8 +103,8 @@ def list(self, location_name: str, **kwargs: Any) -> Iterable["_models.Performan _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PerformanceTierListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.PerformanceTierListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -126,12 +126,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -139,13 +139,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PerformanceTierListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -158,4 +158,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/performanceTiers"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/performanceTiers" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_log_files_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_log_files_operations.py index 03cd319f3012..d7a9a0b032f5 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_log_files_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_log_files_operations.py @@ -46,7 +46,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +62,7 @@ def build_list_by_server_request( "serverName": _SERIALIZER.url("server_name", server_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,8 +109,8 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LogFileListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.LogFileListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -133,12 +133,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -146,13 +146,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("LogFileListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -165,4 +165,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/logFiles"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/logFiles" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_operations.py index bb32d236b8b7..333063c1068f 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_operations.py @@ -43,7 +43,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 = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,8 +97,8 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) request = build_list_request( api_version=api_version, @@ -107,9 +107,9 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -126,4 +126,4 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: return deserialized - list.metadata = {"url": "/providers/Microsoft.DBforPostgreSQL/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.DBforPostgreSQL/operations"} diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_private_endpoint_connections_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_private_endpoint_connections_operations.py index 2c62fa2d3145..adb0e82f5fd4 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_private_endpoint_connections_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_private_endpoint_connections_operations.py @@ -52,7 +52,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +71,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -92,8 +92,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +112,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -135,7 +135,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +154,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -175,8 +175,8 @@ def build_update_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -195,7 +195,7 @@ def build_update_tags_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -214,7 +214,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -230,7 +230,7 @@ def build_list_by_server_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -289,8 +289,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -303,9 +303,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -322,7 +322,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _create_or_update_initial( self, @@ -343,9 +345,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -369,9 +371,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -390,7 +392,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload def begin_create_or_update( @@ -512,14 +516,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -540,7 +544,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -552,9 +556,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -570,8 +576,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -584,9 +590,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -599,7 +605,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def begin_delete( @@ -629,11 +637,11 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -652,7 +660,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -664,9 +672,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _update_tags_initial( self, @@ -687,9 +697,9 @@ def _update_tags_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -713,9 +723,9 @@ def _update_tags_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -732,7 +742,9 @@ def _update_tags_initial( return deserialized - _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _update_tags_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload def begin_update_tags( @@ -863,14 +875,14 @@ def begin_update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_tags_initial( # type: ignore + raw_result = self._update_tags_initial( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -891,7 +903,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -903,9 +915,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def list_by_server( @@ -928,8 +942,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -952,12 +966,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -965,13 +979,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -984,4 +998,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_private_link_resources_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_private_link_resources_operations.py index 8db0777ace78..391cb10798fb 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_private_link_resources_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_private_link_resources_operations.py @@ -46,7 +46,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +62,7 @@ def build_list_by_server_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +79,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +96,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,8 +145,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourceListResult] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -169,12 +169,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -182,13 +182,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -201,7 +201,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources" + } @distributed_trace def get( @@ -232,8 +234,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] + api_version: Literal["2018-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -246,9 +248,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -265,4 +267,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources/{groupName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources/{groupName}" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_recoverable_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_recoverable_servers_operations.py index 7199a0074cab..8e6ceb71be10 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_recoverable_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_recoverable_servers_operations.py @@ -43,7 +43,7 @@ def build_get_request(resource_group_name: str, server_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_get_request(resource_group_name: str, server_name: str, subscription_i "serverName": _SERIALIZER.url("server_name", server_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,8 +114,8 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoverableServerResource] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.RecoverableServerResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -127,9 +127,9 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -146,4 +146,6 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/recoverableServers"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/recoverableServers" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_replicas_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_replicas_operations.py index 0bb13ecf5c8b..60f976d2184b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_replicas_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_replicas_operations.py @@ -46,7 +46,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +62,7 @@ def build_list_by_server_request( "serverName": _SERIALIZER.url("server_name", server_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,8 +109,8 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -133,12 +133,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -146,13 +146,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -165,4 +165,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/replicas"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/replicas" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_administrators_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_administrators_operations.py index c2e583089fbe..ec55a34e80a5 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_administrators_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_administrators_operations.py @@ -46,7 +46,7 @@ def build_get_request(resource_group_name: str, server_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +62,7 @@ def build_get_request(resource_group_name: str, server_name: str, subscription_i "serverName": _SERIALIZER.url("server_name", server_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,8 +79,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +96,7 @@ def build_create_or_update_request( "serverName": _SERIALIZER.url("server_name", server_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -115,7 +115,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +131,7 @@ def build_delete_request( "serverName": _SERIALIZER.url("server_name", server_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,7 +146,7 @@ def build_list_request(resource_group_name: str, server_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +162,7 @@ def build_list_request(resource_group_name: str, server_name: str, subscription_ "serverName": _SERIALIZER.url("server_name", server_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -217,8 +217,8 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerAdministratorResource] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.ServerAdministratorResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -230,9 +230,9 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -249,7 +249,9 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" + } def _create_or_update_initial( self, @@ -269,9 +271,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerAdministratorResource] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServerAdministratorResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -294,9 +296,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -313,11 +315,13 @@ def _create_or_update_initial( deserialized = self._deserialize("ServerAdministratorResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" + } @overload def begin_create_or_update( @@ -436,14 +440,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerAdministratorResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServerAdministratorResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, properties=properties, @@ -463,7 +467,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -475,9 +479,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, **kwargs: Any @@ -493,8 +499,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -506,9 +512,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -521,7 +527,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" + } @distributed_trace def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -547,11 +555,11 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -569,7 +577,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -581,9 +589,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" + } @distributed_trace def list( @@ -606,8 +616,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerAdministratorResourceListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.ServerAdministratorResourceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -630,12 +640,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -643,13 +653,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ServerAdministratorResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -662,4 +672,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_based_performance_tier_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_based_performance_tier_operations.py index 42e6e0589e56..7c4467807cd8 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_based_performance_tier_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_based_performance_tier_operations.py @@ -44,7 +44,7 @@ def build_list_request(resource_group_name: str, server_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +60,7 @@ def build_list_request(resource_group_name: str, server_name: str, subscription_ "serverName": _SERIALIZER.url("server_name", server_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,8 +111,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PerformanceTierListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.PerformanceTierListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -135,12 +135,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -148,13 +148,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PerformanceTierListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -167,4 +167,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/performanceTiers"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/performanceTiers" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_keys_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_keys_operations.py index a6c41522f81b..d0dd1a7c02c1 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_keys_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_keys_operations.py @@ -46,7 +46,7 @@ def build_list_request(resource_group_name: str, server_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +62,7 @@ def build_list_request(resource_group_name: str, server_name: str, subscription_ "serverName": _SERIALIZER.url("server_name", server_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +79,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +96,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -113,8 +113,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +131,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -150,7 +150,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +167,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -214,8 +214,8 @@ def list(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerKeyListResult] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ServerKeyListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -238,12 +238,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -251,13 +251,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ServerKeyListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -270,7 +270,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys" + } @distributed_trace def get(self, resource_group_name: str, server_name: str, key_name: str, **kwargs: Any) -> _models.ServerKey: @@ -299,8 +301,8 @@ def get(self, resource_group_name: str, server_name: str, key_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerKey] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[_models.ServerKey] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -313,9 +315,9 @@ def get(self, resource_group_name: str, server_name: str, key_name: str, **kwarg params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -332,7 +334,9 @@ def get(self, resource_group_name: str, server_name: str, key_name: str, **kwarg return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" + } def _create_or_update_initial( self, @@ -353,9 +357,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerKey] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServerKey] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -379,9 +383,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -398,11 +402,13 @@ def _create_or_update_initial( deserialized = self._deserialize("ServerKey", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" + } @overload def begin_create_or_update( @@ -522,14 +528,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerKey] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServerKey] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( server_name=server_name, key_name=key_name, resource_group_name=resource_group_name, @@ -550,7 +556,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -562,9 +568,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, server_name: str, key_name: str, resource_group_name: str, **kwargs: Any @@ -580,8 +588,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( server_name=server_name, @@ -594,9 +602,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -609,7 +617,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" + } @distributed_trace def begin_delete(self, server_name: str, key_name: str, resource_group_name: str, **kwargs: Any) -> LROPoller[None]: @@ -637,11 +647,11 @@ def begin_delete(self, server_name: str, key_name: str, resource_group_name: str _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2020-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore server_name=server_name, @@ -660,7 +670,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -672,6 +682,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_parameters_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_parameters_operations.py index 95a753476dcd..e47690bb0330 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_parameters_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_parameters_operations.py @@ -47,8 +47,8 @@ def build_list_update_configurations_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +64,7 @@ def build_list_update_configurations_request( "serverName": _SERIALIZER.url("server_name", server_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,9 +114,9 @@ def _list_update_configurations_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ConfigurationListResult]] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ConfigurationListResult]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -139,9 +139,9 @@ def _list_update_configurations_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -160,7 +160,9 @@ def _list_update_configurations_initial( return deserialized - _list_update_configurations_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/updateConfigurations"} # type: ignore + _list_update_configurations_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/updateConfigurations" + } @overload def begin_list_update_configurations( @@ -274,14 +276,14 @@ def begin_list_update_configurations( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConfigurationListResult] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationListResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._list_update_configurations_initial( # type: ignore + raw_result = self._list_update_configurations_initial( resource_group_name=resource_group_name, server_name=server_name, value=value, @@ -301,9 +303,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -315,6 +317,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_list_update_configurations.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/updateConfigurations"} # type: ignore + begin_list_update_configurations.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/updateConfigurations" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_security_alert_policies_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_security_alert_policies_operations.py index 73a4d7f0c0a5..47480166b0af 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_security_alert_policies_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_security_alert_policies_operations.py @@ -52,7 +52,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,8 +90,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +108,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -127,7 +127,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +143,7 @@ def build_list_by_server_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -207,8 +207,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerSecurityAlertPolicy] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.ServerSecurityAlertPolicy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -221,9 +221,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -240,7 +240,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" + } def _create_or_update_initial( self, @@ -261,9 +263,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ServerSecurityAlertPolicy]] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ServerSecurityAlertPolicy]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -287,9 +289,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -308,7 +310,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" + } @overload def begin_create_or_update( @@ -434,14 +438,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerSecurityAlertPolicy] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServerSecurityAlertPolicy] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, security_alert_policy_name=security_alert_policy_name, @@ -462,7 +466,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -474,9 +478,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" + } @distributed_trace def list_by_server( @@ -499,8 +505,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerSecurityAlertPolicyListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.ServerSecurityAlertPolicyListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -523,12 +529,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -536,13 +542,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ServerSecurityAlertPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -555,4 +561,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_servers_operations.py index d2cce7ea5dd0..4da53ce26bdf 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_servers_operations.py @@ -48,8 +48,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +65,7 @@ def build_create_request( "serverName": _SERIALIZER.url("server_name", server_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,8 +84,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +101,7 @@ def build_update_request( "serverName": _SERIALIZER.url("server_name", server_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -120,7 +120,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,7 +136,7 @@ def build_delete_request( "serverName": _SERIALIZER.url("server_name", server_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,7 +151,7 @@ def build_get_request(resource_group_name: str, server_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +167,7 @@ def build_get_request(resource_group_name: str, server_name: str, subscription_i "serverName": _SERIALIZER.url("server_name", server_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -182,7 +182,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 = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -197,7 +197,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -212,7 +212,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 = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -221,7 +221,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -238,7 +238,7 @@ def build_restart_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -254,7 +254,7 @@ def build_restart_request( "serverName": _SERIALIZER.url("server_name", server_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -298,9 +298,9 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Server]] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -323,9 +323,9 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -347,7 +347,9 @@ def _create_initial( return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" + } @overload def begin_create( @@ -451,14 +453,14 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Server] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Server] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -478,7 +480,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -490,9 +492,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" + } def _update_initial( self, @@ -512,9 +516,9 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Server]] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -537,9 +541,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -558,7 +562,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" + } @overload def begin_update( @@ -669,14 +675,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Server] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Server] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -696,7 +702,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -708,9 +714,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, **kwargs: Any @@ -726,8 +734,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -739,9 +747,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -754,7 +762,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" + } @distributed_trace def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -780,11 +790,11 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -802,7 +812,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -814,9 +824,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" + } @distributed_trace def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _models.Server: @@ -843,8 +855,8 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Server] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.Server] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -856,9 +868,9 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -875,7 +887,9 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" + } @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Server"]: @@ -892,8 +906,8 @@ 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 = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -915,12 +929,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -928,13 +942,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -947,7 +961,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers" + } @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Server"]: @@ -961,8 +977,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Server"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -983,12 +999,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -996,13 +1012,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1015,7 +1031,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/servers"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/servers"} def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, **kwargs: Any @@ -1031,8 +1047,8 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_restart_request( resource_group_name=resource_group_name, @@ -1044,9 +1060,9 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1059,7 +1075,9 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/restart"} # type: ignore + _restart_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/restart" + } @distributed_trace def begin_restart(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1085,11 +1103,11 @@ def begin_restart(self, resource_group_name: str, server_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._restart_initial( # type: ignore resource_group_name=resource_group_name, @@ -1107,7 +1125,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1119,6 +1137,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_restart.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/restart"} # type: ignore + begin_restart.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/restart" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_virtual_network_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_virtual_network_rules_operations.py index c40aebcb595b..5489daf85076 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_virtual_network_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_virtual_network_rules_operations.py @@ -48,7 +48,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +65,7 @@ def build_get_request( "virtualNetworkRuleName": _SERIALIZER.url("virtual_network_rule_name", virtual_network_rule_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,8 +82,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +100,7 @@ def build_create_or_update_request( "virtualNetworkRuleName": _SERIALIZER.url("virtual_network_rule_name", virtual_network_rule_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,7 +118,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -133,7 +133,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -147,7 +147,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -163,7 +163,7 @@ def build_list_by_server_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -222,8 +222,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VirtualNetworkRule] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.VirtualNetworkRule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -236,9 +236,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -255,7 +255,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" + } def _create_or_update_initial( self, @@ -276,9 +278,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.VirtualNetworkRule]] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VirtualNetworkRule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -302,9 +304,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -326,7 +328,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" + } @overload def begin_create_or_update( @@ -446,14 +450,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VirtualNetworkRule] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkRule] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, @@ -474,7 +478,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -486,9 +490,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, virtual_network_rule_name: str, **kwargs: Any @@ -504,8 +510,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -518,9 +524,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -533,7 +539,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" + } @distributed_trace def begin_delete( @@ -563,11 +571,11 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -586,7 +594,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -598,9 +606,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" + } @distributed_trace def list_by_server( @@ -621,8 +631,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) # type: Literal["2017-12-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VirtualNetworkRuleListResult] + api_version: Literal["2017-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) + cls: ClsType[_models.VirtualNetworkRuleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -645,12 +655,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -658,13 +668,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("VirtualNetworkRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -677,4 +687,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/__init__.py index 473b3c5678d9..d13a655142e5 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_configuration.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_configuration.py index e8f3d2ca05cd..4685a14961e8 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_configuration.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_configuration.py @@ -42,7 +42,7 @@ class PostgreSQLManagementClientConfiguration(Configuration): # pylint: disable def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(PostgreSQLManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-03-08-preview") # type: Literal["2022-03-08-preview"] + api_version: Literal["2022-03-08-preview"] = kwargs.pop("api_version", "2022-03-08-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-rdbms/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_postgre_sql_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_postgre_sql_management_client.py index ddb62f9eecb1..26c031aab0c6 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_postgre_sql_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_postgre_sql_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import PostgreSQLManagementClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -101,7 +101,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -151,15 +151,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> PostgreSQLManagementClient + def __enter__(self) -> "PostgreSQLManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_serialization.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_serialization.py index 7c1dedb5133d..2c170e28dbca 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_serialization.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,24 +38,22 @@ import re import sys import codecs +from typing import Optional, Union, AnyStr, IO, Mapping try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate +import isodate # type: ignore -from typing import Dict, Any, cast, TYPE_CHECKING +from typing import Dict, Any, cast from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping - class RawDeserializer: @@ -65,8 +64,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +130,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +157,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +185,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +216,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,9 +273,9 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs): self.additional_properties = {} @@ -310,7 +307,7 @@ def enable_additional_properties_sending(cls): @classmethod def is_xml_model(cls): try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,7 +316,7 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} @@ -453,7 +450,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -606,13 +603,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,23 +618,23 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): + for k in reversed(keys): # type: ignore unflattened = {k: new_attr} new_attr = unflattened _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue @@ -675,7 +672,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -843,7 +840,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -1001,10 +998,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1416,7 +1413,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1441,7 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1543,7 +1540,7 @@ def _unpack_content(raw_data, content_type=None): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1562,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1744,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1795,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1807,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1823,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1838,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1868,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1886,7 +1883,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1898,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1921,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1957,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_version.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_version.py index cecdf950a4a9..e5754a47ce68 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_version.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.2.0b5" +VERSION = "1.0.0b1" diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/__init__.py index a3ea1a85dcd9..7668cabb316d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_configuration.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_configuration.py index e597f50533d7..93912a63d824 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_configuration.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_configuration.py @@ -42,7 +42,7 @@ class PostgreSQLManagementClientConfiguration(Configuration): # pylint: disable def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(PostgreSQLManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-03-08-preview") # type: Literal["2022-03-08-preview"] + api_version: Literal["2022-03-08-preview"] = kwargs.pop("api_version", "2022-03-08-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_postgre_sql_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_postgre_sql_management_client.py index acf0963179b2..8c4d4858d9e6 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_postgre_sql_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_postgre_sql_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import PostgreSQLManagementClientConfiguration from .operations import ( @@ -103,7 +103,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/__init__.py index c2fb3205a36f..2bb2626b6162 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/__init__.py @@ -21,7 +21,7 @@ from ._virtual_network_subnet_usage_operations import VirtualNetworkSubnetUsageOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_administrators_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_administrators_operations.py index 899b1ca8820d..8345ec4ae397 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_administrators_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_administrators_operations.py @@ -84,11 +84,11 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ActiveDirectoryAdministrator]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ActiveDirectoryAdministrator]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -112,9 +112,9 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -137,7 +137,9 @@ async def _create_initial( return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}" + } @overload async def begin_create( @@ -264,16 +266,16 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ActiveDirectoryAdministrator] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ActiveDirectoryAdministrator] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, server_name=server_name, object_id=object_id, @@ -294,10 +296,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -309,9 +311,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, object_id: str, **kwargs: Any @@ -327,10 +331,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -343,9 +347,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -363,7 +367,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}" + } @distributed_trace_async async def begin_delete( @@ -393,13 +399,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -418,9 +424,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -432,9 +438,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}" + } @distributed_trace_async async def get( @@ -465,10 +473,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ActiveDirectoryAdministrator] + ) + cls: ClsType[_models.ActiveDirectoryAdministrator] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -481,9 +489,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -501,7 +509,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}" + } @distributed_trace def list_by_server( @@ -524,10 +534,10 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdministratorListResult] + ) + cls: ClsType[_models.AdministratorListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -550,7 +560,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -566,7 +576,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -574,13 +584,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AdministratorListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -594,4 +604,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_backups_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_backups_operations.py index 061adfa9ed51..0bf890f682e6 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_backups_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_backups_operations.py @@ -87,10 +87,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerBackup] + ) + cls: ClsType[_models.ServerBackup] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -103,9 +103,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -123,7 +123,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups/{backupName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups/{backupName}" + } @distributed_trace def list_by_server( @@ -145,10 +147,10 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerBackupListResult] + ) + cls: ClsType[_models.ServerBackupListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -171,7 +173,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -187,7 +189,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -195,13 +197,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ServerBackupListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -215,4 +217,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_check_name_availability_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_check_name_availability_operations.py index 92e3612801ed..17f28520de5d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_check_name_availability_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_check_name_availability_operations.py @@ -125,11 +125,11 @@ async def execute( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NameAvailability] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -150,9 +150,9 @@ async def execute( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -170,4 +170,6 @@ async def execute( return deserialized - execute.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability"} # type: ignore + execute.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_check_name_availability_with_location_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_check_name_availability_with_location_operations.py index 894fe1199d74..b8dc7365e484 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_check_name_availability_with_location_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_check_name_availability_with_location_operations.py @@ -140,11 +140,11 @@ async def execute( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NameAvailability] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -166,9 +166,9 @@ async def execute( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -186,4 +186,6 @@ async def execute( return deserialized - execute.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkNameAvailability"} # type: ignore + execute.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkNameAvailability" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_configurations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_configurations_operations.py index a9f588bb8fe2..ac78b621e0c2 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_configurations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_configurations_operations.py @@ -85,10 +85,10 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConfigurationListResult] + ) + cls: ClsType[_models.ConfigurationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -111,7 +111,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -127,7 +127,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -135,13 +135,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ConfigurationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -155,7 +155,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations" + } @distributed_trace_async async def get( @@ -186,10 +188,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Configuration] + ) + cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -202,9 +204,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -222,7 +224,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}" + } async def _update_initial( self, @@ -243,11 +247,11 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Configuration]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -271,9 +275,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -300,7 +304,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}" + } @overload async def begin_update( @@ -424,16 +430,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Configuration] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, server_name=server_name, configuration_name=configuration_name, @@ -454,10 +460,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -469,9 +475,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}" + } async def _put_initial( self, @@ -492,11 +500,11 @@ async def _put_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Configuration]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -520,9 +528,9 @@ async def _put_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -549,7 +557,9 @@ async def _put_initial( return deserialized - _put_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}"} # type: ignore + _put_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}" + } @overload async def begin_put( @@ -672,16 +682,16 @@ async def begin_put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Configuration] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._put_initial( # type: ignore + raw_result = await self._put_initial( resource_group_name=resource_group_name, server_name=server_name, configuration_name=configuration_name, @@ -702,9 +712,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -716,6 +726,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}"} # type: ignore + begin_put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_databases_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_databases_operations.py index c04bbe954af4..8b72bfea2cb7 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_databases_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_databases_operations.py @@ -84,11 +84,11 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Database]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -112,9 +112,9 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -141,7 +141,9 @@ async def _create_initial( return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}" + } @overload async def begin_create( @@ -264,16 +266,16 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Database] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Database] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, @@ -294,10 +296,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -309,9 +311,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any @@ -327,10 +331,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -343,9 +347,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -363,7 +367,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}" + } @distributed_trace_async async def begin_delete( @@ -393,13 +399,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -418,9 +424,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -432,9 +438,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}" + } @distributed_trace_async async def get( @@ -465,10 +473,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Database] + ) + cls: ClsType[_models.Database] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -481,9 +489,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -501,7 +509,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}" + } @distributed_trace def list_by_server( @@ -523,10 +533,10 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseListResult] + ) + cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -549,7 +559,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -565,7 +575,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -573,13 +583,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DatabaseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -593,4 +603,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_firewall_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_firewall_rules_operations.py index 1d6188688617..5d5eefde5b2c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_firewall_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_firewall_rules_operations.py @@ -84,11 +84,11 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.FirewallRule]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.FirewallRule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -112,9 +112,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -141,7 +141,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}" + } @overload async def begin_create_or_update( @@ -264,16 +266,16 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FirewallRule] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, @@ -294,10 +296,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -309,9 +311,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any @@ -327,10 +331,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -343,9 +347,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -363,7 +367,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}" + } @distributed_trace_async async def begin_delete( @@ -393,13 +399,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -418,9 +424,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -432,9 +438,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}" + } @distributed_trace_async async def get( @@ -465,10 +473,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FirewallRule] + ) + cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -481,9 +489,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -501,7 +509,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}" + } @distributed_trace def list_by_server( @@ -523,10 +533,10 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FirewallRuleListResult] + ) + cls: ClsType[_models.FirewallRuleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -549,7 +559,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -565,7 +575,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -573,13 +583,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("FirewallRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -593,4 +603,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_get_private_dns_zone_suffix_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_get_private_dns_zone_suffix_operations.py index fdbe477ed672..99ef4f762993 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_get_private_dns_zone_suffix_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_get_private_dns_zone_suffix_operations.py @@ -75,10 +75,10 @@ async def execute(self, **kwargs: Any) -> str: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[str] + ) + cls: ClsType[str] = kwargs.pop("cls", None) request = build_execute_request( api_version=api_version, @@ -87,9 +87,9 @@ async def execute(self, **kwargs: Any) -> str: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -107,4 +107,4 @@ async def execute(self, **kwargs: Any) -> str: return deserialized - execute.metadata = {"url": "/providers/Microsoft.DBforPostgreSQL/getPrivateDnsZoneSuffix"} # type: ignore + execute.metadata = {"url": "/providers/Microsoft.DBforPostgreSQL/getPrivateDnsZoneSuffix"} diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_location_based_capabilities_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_location_based_capabilities_operations.py index b4f74690c4f9..8608d2608c7a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_location_based_capabilities_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_location_based_capabilities_operations.py @@ -73,10 +73,10 @@ def execute(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.C _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CapabilitiesListResult] + ) + cls: ClsType[_models.CapabilitiesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -98,7 +98,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -114,7 +114,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -122,13 +122,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CapabilitiesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -142,4 +142,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - execute.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/capabilities"} # type: ignore + execute.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/capabilities" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_operations.py index bdc0e9b7d83a..1b9aee0f8083 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_operations.py @@ -75,10 +75,10 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) request = build_list_request( api_version=api_version, @@ -87,9 +87,9 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -107,4 +107,4 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: return deserialized - list.metadata = {"url": "/providers/Microsoft.DBforPostgreSQL/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.DBforPostgreSQL/operations"} diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_replicas_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_replicas_operations.py index 7dd3ae780a19..2c8fdfc2cf01 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_replicas_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_replicas_operations.py @@ -77,10 +77,10 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerListResult] + ) + cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +103,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +119,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -147,4 +147,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/replicas"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/replicas" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_servers_operations.py index 0a0729140b79..8a2db36217b3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_servers_operations.py @@ -84,11 +84,11 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Server]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -111,9 +111,9 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -136,7 +136,9 @@ async def _create_initial( return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}" + } @overload async def begin_create( @@ -246,16 +248,16 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Server] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Server] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -275,10 +277,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -290,9 +292,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}" + } async def _update_initial( self, resource_group_name: str, server_name: str, parameters: Union[_models.ServerForUpdate, IO], **kwargs: Any @@ -308,11 +312,11 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Server]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -335,9 +339,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -361,7 +365,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}" + } @overload async def begin_update( @@ -474,16 +480,16 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Server] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Server] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -503,10 +509,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -518,9 +524,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, **kwargs: Any @@ -536,10 +544,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -551,9 +559,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -571,7 +579,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}" + } @distributed_trace_async async def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -597,13 +607,13 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -621,9 +631,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -635,9 +645,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}" + } @distributed_trace_async async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _models.Server: @@ -664,10 +676,10 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Server] + ) + cls: ClsType[_models.Server] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -679,9 +691,9 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -699,7 +711,9 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}" + } @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Server"]: @@ -717,10 +731,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerListResult] + ) + cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -742,7 +756,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -758,7 +772,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -766,13 +780,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -786,7 +800,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers" + } @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Server"]: @@ -801,10 +817,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Server"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerListResult] + ) + cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -825,7 +841,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -841,7 +857,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -849,13 +865,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -869,7 +885,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/flexibleServers"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/flexibleServers"} async def _restart_initial( # pylint: disable=inconsistent-return-statements self, @@ -889,11 +905,11 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -919,9 +935,9 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -939,7 +955,9 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _restart_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/restart"} # type: ignore + _restart_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/restart" + } @overload async def begin_restart( @@ -1047,14 +1065,14 @@ async def begin_restart( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._restart_initial( # type: ignore resource_group_name=resource_group_name, @@ -1074,9 +1092,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1088,9 +1106,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_restart.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/restart"} # type: ignore + begin_restart.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/restart" + } async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, **kwargs: Any @@ -1106,10 +1126,10 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( resource_group_name=resource_group_name, @@ -1121,9 +1141,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1141,7 +1161,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/start"} # type: ignore + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/start" + } @distributed_trace_async async def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1167,13 +1189,13 @@ async def begin_start(self, resource_group_name: str, server_name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, @@ -1191,9 +1213,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1205,9 +1227,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/start"} # type: ignore + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/start" + } async def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, **kwargs: Any @@ -1223,10 +1247,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( resource_group_name=resource_group_name, @@ -1238,9 +1262,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1258,7 +1282,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/stop"} # type: ignore + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/stop" + } @distributed_trace_async async def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1284,13 +1310,13 @@ async def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, @@ -1308,9 +1334,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1322,6 +1348,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/stop"} # type: ignore + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/stop" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_virtual_network_subnet_usage_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_virtual_network_subnet_usage_operations.py index b0be8523c862..405225484e03 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_virtual_network_subnet_usage_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_virtual_network_subnet_usage_operations.py @@ -130,11 +130,11 @@ async def execute( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VirtualNetworkSubnetUsageResult] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkSubnetUsageResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -156,9 +156,9 @@ async def execute( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -176,4 +176,6 @@ async def execute( return deserialized - execute.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkVirtualNetworkSubnetUsage"} # type: ignore + execute.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkVirtualNetworkSubnetUsage" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/models/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/models/__init__.py index a25b8177f4ac..7fbb77907ea7 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/models/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/models/__init__.py @@ -80,7 +80,7 @@ from ._postgre_sql_management_client_enums import ServerVersion from ._postgre_sql_management_client_enums import SkuTier from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/__init__.py index c2fb3205a36f..2bb2626b6162 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/__init__.py @@ -21,7 +21,7 @@ from ._virtual_network_subnet_usage_operations import VirtualNetworkSubnetUsageOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_administrators_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_administrators_operations.py index fd8b7bd8f64f..9404943e1ba7 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_administrators_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_administrators_operations.py @@ -49,10 +49,10 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +71,7 @@ def build_create_request( "objectId": _SERIALIZER.url("object_id", object_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,9 +90,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +111,7 @@ def build_delete_request( "objectId": _SERIALIZER.url("object_id", object_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,9 +128,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +149,7 @@ def build_get_request( "objectId": _SERIALIZER.url("object_id", object_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -166,9 +166,9 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -186,7 +186,7 @@ def build_list_by_server_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -235,11 +235,11 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ActiveDirectoryAdministrator]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ActiveDirectoryAdministrator]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -263,9 +263,9 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -288,7 +288,9 @@ def _create_initial( return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}" + } @overload def begin_create( @@ -415,16 +417,16 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ActiveDirectoryAdministrator] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ActiveDirectoryAdministrator] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, server_name=server_name, object_id=object_id, @@ -445,9 +447,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -459,9 +461,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, object_id: str, **kwargs: Any @@ -477,10 +481,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -493,9 +497,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -513,7 +517,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}" + } @distributed_trace def begin_delete( @@ -543,13 +549,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -568,9 +574,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -582,9 +588,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}" + } @distributed_trace def get( @@ -615,10 +623,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ActiveDirectoryAdministrator] + ) + cls: ClsType[_models.ActiveDirectoryAdministrator] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -631,9 +639,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -651,7 +659,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}" + } @distributed_trace def list_by_server( @@ -674,10 +684,10 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdministratorListResult] + ) + cls: ClsType[_models.AdministratorListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -700,7 +710,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -716,7 +726,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -724,13 +734,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AdministratorListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -744,4 +754,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_backups_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_backups_operations.py index 7134469a789b..f2d4bf01e1e4 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_backups_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_backups_operations.py @@ -47,9 +47,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +68,7 @@ def build_get_request( "backupName": _SERIALIZER.url("backup_name", backup_name, "str", min_length=1, pattern=r"^[-\w\._]+$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,9 +85,9 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +105,7 @@ def build_list_by_server_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -162,10 +162,10 @@ def get(self, resource_group_name: str, server_name: str, backup_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerBackup] + ) + cls: ClsType[_models.ServerBackup] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -178,9 +178,9 @@ def get(self, resource_group_name: str, server_name: str, backup_name: str, **kw params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -198,7 +198,9 @@ def get(self, resource_group_name: str, server_name: str, backup_name: str, **kw return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups/{backupName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups/{backupName}" + } @distributed_trace def list_by_server( @@ -220,10 +222,10 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerBackupListResult] + ) + cls: ClsType[_models.ServerBackupListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -246,7 +248,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -262,7 +264,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -270,13 +272,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ServerBackupListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -290,4 +292,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_operations.py index 2220cc110d66..280625dcea73 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_operations.py @@ -43,10 +43,10 @@ def build_execute_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 = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +57,7 @@ def build_execute_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,11 +159,11 @@ def execute( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NameAvailability] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -184,9 +184,9 @@ def execute( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -204,4 +204,6 @@ def execute( return deserialized - execute.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability"} # type: ignore + execute.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_with_location_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_with_location_operations.py index d2865fc1ef72..57a01b1c86ce 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_with_location_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_with_location_operations.py @@ -43,10 +43,10 @@ def build_execute_request(location_name: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_execute_request(location_name: str, subscription_id: str, **kwargs: An "locationName": _SERIALIZER.url("location_name", location_name, "str", min_length=1, pattern=r"^[-\w\._]+$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -176,11 +176,11 @@ def execute( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NameAvailability] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -202,9 +202,9 @@ def execute( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -222,4 +222,6 @@ def execute( return deserialized - execute.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkNameAvailability"} # type: ignore + execute.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkNameAvailability" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_configurations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_configurations_operations.py index c58d11d7600a..b896e96eec28 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_configurations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_configurations_operations.py @@ -49,9 +49,9 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,7 @@ def build_list_by_server_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,9 +86,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,10 +126,10 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +150,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -169,10 +169,10 @@ def build_put_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -193,7 +193,7 @@ def build_put_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -245,10 +245,10 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConfigurationListResult] + ) + cls: ClsType[_models.ConfigurationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -271,7 +271,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -287,7 +287,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -295,13 +295,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ConfigurationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -315,7 +315,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations" + } @distributed_trace def get( @@ -346,10 +348,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Configuration] + ) + cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -362,9 +364,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -382,7 +384,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}" + } def _update_initial( self, @@ -403,11 +407,11 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Configuration]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -431,9 +435,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -460,7 +464,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}" + } @overload def begin_update( @@ -584,16 +590,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Configuration] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, server_name=server_name, configuration_name=configuration_name, @@ -614,9 +620,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -628,9 +634,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}" + } def _put_initial( self, @@ -651,11 +659,11 @@ def _put_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Configuration]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -679,9 +687,9 @@ def _put_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -708,7 +716,9 @@ def _put_initial( return deserialized - _put_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}"} # type: ignore + _put_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}" + } @overload def begin_put( @@ -831,16 +841,16 @@ def begin_put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Configuration] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._put_initial( # type: ignore + raw_result = self._put_initial( resource_group_name=resource_group_name, server_name=server_name, configuration_name=configuration_name, @@ -861,9 +871,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -875,6 +885,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}"} # type: ignore + begin_put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_databases_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_databases_operations.py index 41530449fce6..740e72998069 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_databases_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_databases_operations.py @@ -49,10 +49,10 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +71,7 @@ def build_create_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str", min_length=1, pattern=r"^[-\w\._]+$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,9 +90,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +111,7 @@ def build_delete_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str", min_length=1, pattern=r"^[-\w\._]+$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,9 +128,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +149,7 @@ def build_get_request( "databaseName": _SERIALIZER.url("database_name", database_name, "str", min_length=1, pattern=r"^[-\w\._]+$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -166,9 +166,9 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -186,7 +186,7 @@ def build_list_by_server_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -235,11 +235,11 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Database]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -263,9 +263,9 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -292,7 +292,9 @@ def _create_initial( return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}" + } @overload def begin_create( @@ -412,16 +414,16 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Database] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Database] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, @@ -442,9 +444,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -456,9 +458,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any @@ -474,10 +478,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -490,9 +494,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -510,7 +514,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}" + } @distributed_trace def begin_delete( @@ -540,13 +546,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -565,9 +571,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -579,9 +585,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}" + } @distributed_trace def get(self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any) -> _models.Database: @@ -610,10 +618,10 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Database] + ) + cls: ClsType[_models.Database] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -626,9 +634,9 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -646,7 +654,9 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}" + } @distributed_trace def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterable["_models.Database"]: @@ -666,10 +676,10 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatabaseListResult] + ) + cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -692,7 +702,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -708,7 +718,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -716,13 +726,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DatabaseListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -736,4 +746,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_firewall_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_firewall_rules_operations.py index bba68160b574..8d7e67890d92 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_firewall_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_firewall_rules_operations.py @@ -49,10 +49,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +73,7 @@ def build_create_or_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -92,9 +92,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +115,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -132,9 +132,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -155,7 +155,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -172,9 +172,9 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +192,7 @@ def build_list_by_server_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -241,11 +241,11 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.FirewallRule]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.FirewallRule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -269,9 +269,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -298,7 +298,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}" + } @overload def begin_create_or_update( @@ -421,16 +423,16 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FirewallRule] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, @@ -451,9 +453,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -465,9 +467,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any @@ -483,10 +487,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -499,9 +503,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -519,7 +523,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}" + } @distributed_trace def begin_delete( @@ -549,13 +555,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -574,9 +580,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -588,9 +594,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}" + } @distributed_trace def get( @@ -621,10 +629,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FirewallRule] + ) + cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -637,9 +645,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -657,7 +665,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}" + } @distributed_trace def list_by_server( @@ -679,10 +689,10 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FirewallRuleListResult] + ) + cls: ClsType[_models.FirewallRuleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -705,7 +715,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -721,7 +731,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -729,13 +739,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("FirewallRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -749,4 +759,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_get_private_dns_zone_suffix_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_get_private_dns_zone_suffix_operations.py index 9e5302a26a00..fdb3e5cd9b51 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_get_private_dns_zone_suffix_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_get_private_dns_zone_suffix_operations.py @@ -43,9 +43,9 @@ def build_execute_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,10 +99,10 @@ def execute(self, **kwargs: Any) -> str: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[str] + ) + cls: ClsType[str] = kwargs.pop("cls", None) request = build_execute_request( api_version=api_version, @@ -111,9 +111,9 @@ def execute(self, **kwargs: Any) -> str: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -131,4 +131,4 @@ def execute(self, **kwargs: Any) -> str: return deserialized - execute.metadata = {"url": "/providers/Microsoft.DBforPostgreSQL/getPrivateDnsZoneSuffix"} # type: ignore + execute.metadata = {"url": "/providers/Microsoft.DBforPostgreSQL/getPrivateDnsZoneSuffix"} diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_location_based_capabilities_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_location_based_capabilities_operations.py index bfea773e7934..c91845422178 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_location_based_capabilities_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_location_based_capabilities_operations.py @@ -45,9 +45,9 @@ def build_execute_request(location_name: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +60,7 @@ def build_execute_request(location_name: str, subscription_id: str, **kwargs: An "locationName": _SERIALIZER.url("location_name", location_name, "str", min_length=1, pattern=r"^[-\w\._]+$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -106,10 +106,10 @@ def execute(self, location_name: str, **kwargs: Any) -> Iterable["_models.Capabi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CapabilitiesListResult] + ) + cls: ClsType[_models.CapabilitiesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -131,7 +131,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -147,7 +147,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -155,13 +155,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("CapabilitiesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -175,4 +175,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - execute.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/capabilities"} # type: ignore + execute.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/capabilities" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_operations.py index dbe7b31192a5..fce43c388534 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_operations.py @@ -43,9 +43,9 @@ 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 = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,10 +99,10 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) request = build_list_request( api_version=api_version, @@ -111,9 +111,9 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -131,4 +131,4 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: return deserialized - list.metadata = {"url": "/providers/Microsoft.DBforPostgreSQL/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.DBforPostgreSQL/operations"} diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_replicas_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_replicas_operations.py index 129da18fc6aa..4ac3d6874867 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_replicas_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_replicas_operations.py @@ -47,9 +47,9 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +67,7 @@ def build_list_by_server_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -115,10 +115,10 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerListResult] + ) + cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -141,7 +141,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -157,7 +157,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -165,13 +165,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -185,4 +185,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_server.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/replicas"} # type: ignore + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/replicas" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_servers_operations.py index 4dc244c9996d..a204f6bd41a3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_servers_operations.py @@ -49,10 +49,10 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +70,7 @@ def build_create_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,10 +89,10 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +110,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -129,9 +129,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +149,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,9 +164,9 @@ def build_get_request(resource_group_name: str, server_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +184,7 @@ def build_get_request(resource_group_name: str, server_name: str, subscription_i ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,9 +199,9 @@ 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 = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -216,7 +216,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -231,9 +231,9 @@ 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 = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -244,7 +244,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -261,10 +261,10 @@ def build_restart_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -282,7 +282,7 @@ def build_restart_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -299,9 +299,9 @@ def build_start_request(resource_group_name: str, server_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -319,7 +319,7 @@ def build_start_request(resource_group_name: str, server_name: str, subscription ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -334,9 +334,9 @@ def build_stop_request(resource_group_name: str, server_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -354,7 +354,7 @@ def build_stop_request(resource_group_name: str, server_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -398,11 +398,11 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Server]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -425,9 +425,9 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -450,7 +450,9 @@ def _create_initial( return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}" + } @overload def begin_create( @@ -557,16 +559,16 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Server] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Server] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -586,9 +588,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -600,9 +602,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}" + } def _update_initial( self, resource_group_name: str, server_name: str, parameters: Union[_models.ServerForUpdate, IO], **kwargs: Any @@ -618,11 +622,11 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Server]] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -645,9 +649,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -671,7 +675,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}" + } @overload def begin_update( @@ -781,16 +787,16 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Server] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Server] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -810,9 +816,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -824,9 +830,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, **kwargs: Any @@ -842,10 +850,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -857,9 +865,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -877,7 +885,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}" + } @distributed_trace def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -903,13 +913,13 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -927,9 +937,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -941,9 +951,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}" + } @distributed_trace def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _models.Server: @@ -970,10 +982,10 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Server] + ) + cls: ClsType[_models.Server] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -985,9 +997,9 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1005,7 +1017,9 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}" + } @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Server"]: @@ -1023,10 +1037,10 @@ 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 = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerListResult] + ) + cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1048,7 +1062,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1064,7 +1078,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1072,13 +1086,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1092,7 +1106,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers" + } @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Server"]: @@ -1107,10 +1123,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Server"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerListResult] + ) + cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1131,7 +1147,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1147,7 +1163,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1155,13 +1171,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1175,7 +1191,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/flexibleServers"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/flexibleServers"} def _restart_initial( # pylint: disable=inconsistent-return-statements self, @@ -1195,11 +1211,11 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1225,9 +1241,9 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1245,7 +1261,9 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _restart_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/restart"} # type: ignore + _restart_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/restart" + } @overload def begin_restart( @@ -1353,14 +1371,14 @@ def begin_restart( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._restart_initial( # type: ignore resource_group_name=resource_group_name, @@ -1380,9 +1398,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1394,9 +1412,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_restart.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/restart"} # type: ignore + begin_restart.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/restart" + } def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, **kwargs: Any @@ -1412,10 +1432,10 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( resource_group_name=resource_group_name, @@ -1427,9 +1447,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1447,7 +1467,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/start"} # type: ignore + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/start" + } @distributed_trace def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1473,13 +1495,13 @@ def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, @@ -1497,9 +1519,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1511,9 +1533,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/start"} # type: ignore + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/start" + } def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, **kwargs: Any @@ -1529,10 +1553,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( resource_group_name=resource_group_name, @@ -1544,9 +1568,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1564,7 +1588,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/stop"} # type: ignore + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/stop" + } @distributed_trace def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1590,13 +1616,13 @@ def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, @@ -1614,9 +1640,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1628,6 +1654,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/stop"} # type: ignore + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/stop" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_network_subnet_usage_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_network_subnet_usage_operations.py index 5123bdba31cd..b93368d3d5ff 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_network_subnet_usage_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_network_subnet_usage_operations.py @@ -43,10 +43,10 @@ def build_execute_request(location_name: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", "2022-03-08-preview") - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_execute_request(location_name: str, subscription_id: str, **kwargs: An "locationName": _SERIALIZER.url("location_name", location_name, "str", min_length=1, pattern=r"^[-\w\._]+$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -166,11 +166,11 @@ def execute( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-03-08-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-03-08-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VirtualNetworkSubnetUsageResult] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkSubnetUsageResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -192,9 +192,9 @@ def execute( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -212,4 +212,6 @@ def execute( return deserialized - execute.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkVirtualNetworkSubnetUsage"} # type: ignore + execute.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkVirtualNetworkSubnetUsage" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/administrator_add.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/administrator_add.py new file mode 100644 index 000000000000..f96688d4dde1 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/administrator_add.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.rdbms import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python administrator_add.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.administrators.begin_create( + resource_group_name="testrg", + server_name="testserver", + object_id="oooooooo-oooo-oooo-oooo-oooooooooooo", + parameters={ + "properties": { + "principalName": "testuser1@microsoft.com", + "principalType": "User", + "tenantId": "tttttttt-tttt-tttt-tttt-tttttttttttt", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/AdministratorAdd.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/delete_an_azure_ad_administrator.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/administrator_delete.py similarity index 74% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/delete_an_azure_ad_administrator.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/administrator_delete.py index d1816d929c0f..1afeadaf9ed3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/delete_an_azure_ad_administrator.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/administrator_delete.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python delete_an_azure_ad_administrator.py + python administrator_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,19 +24,19 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.azure_ad_administrators.begin_delete( + response = client.administrators.begin_delete( resource_group_name="testrg", - server_name="mysqltestsvc4", - administrator_name="ActiveDirectory", + server_name="testserver", + object_id="oooooooo-oooo-oooo-oooo-oooooooooooo", ).result() print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/AzureADAdministratorDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/AdministratorDelete.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_an_azure_ad_administrator.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/administrator_get.py similarity index 74% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_an_azure_ad_administrator.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/administrator_get.py index f842b3fec67a..23e21ec8b1b8 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_an_azure_ad_administrator.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/administrator_get.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python get_an_azure_ad_administrator.py + python administrator_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,19 +24,19 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.azure_ad_administrators.get( + response = client.administrators.get( resource_group_name="testrg", - server_name="mysqltestsvc4", - administrator_name="ActiveDirectory", + server_name="pgtestsvc1", + object_id="oooooooo-oooo-oooo-oooo-oooooooooooo", ) print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/AzureADAdministratorGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/AdministratorGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_all_configurations_for_a_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/administrators_list_by_server.py similarity index 76% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_all_configurations_for_a_server.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/administrators_list_by_server.py index ae4b33b9bf17..110502f45160 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_all_configurations_for_a_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/administrators_list_by_server.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python list_all_configurations_for_a_server.py + python administrators_list_by_server.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,19 +24,19 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.configurations.list_by_server( + response = client.administrators.list_by_server( resource_group_name="testrg", - server_name="mysqltestserver", + server_name="pgtestsvc1", ) for item in response: print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/ConfigurationsListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/AdministratorsListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/advisors_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/advisors_get.py deleted file mode 100644 index a4d5d552deb6..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/advisors_get.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python advisors_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.advisors.get( - resource_group_name="testResourceGroupName", - server_name="testServerName", - advisor_name="Index", - ) - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/AdvisorsGet.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/advisors_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/advisors_list_by_server.py deleted file mode 100644 index 7dc917da18bb..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/advisors_list_by_server.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python advisors_list_by_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.advisors.list_by_server( - resource_group_name="testResourceGroupName", - server_name="testServerName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/AdvisorsListByServer.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_backup_for_a_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/backup_get.py similarity index 80% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_backup_for_a_server.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/backup_get.py index 6556b82dfb6d..a14e79d134c2 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_backup_for_a_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/backup_get.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python get_a_backup_for_a_server.py + python backup_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,19 +24,19 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.backups.get( resource_group_name="TestGroup", - server_name="mysqltestserver", + server_name="postgresqltestserver", backup_name="daily_20210615T160516", ) print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/BackupGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/BackupGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_backups_for_a_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/backup_list_by_server.py similarity index 79% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_backups_for_a_server.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/backup_list_by_server.py index 75d5ff7fd729..d82e8191ca9e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_backups_for_a_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/backup_list_by_server.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python list_backups_for_a_server.py + python backup_list_by_server.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,19 +24,19 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.backups.list_by_server( resource_group_name="TestGroup", - server_name="mysqltestserver", + server_name="postgresqltestserver", ) for item in response: print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/BackupsListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/BackupListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_servers_in_a_resource_group.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/capabilities_by_location.py similarity index 75% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_servers_in_a_resource_group.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/capabilities_by_location.py index a6707b069e10..47b282f3a763 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_servers_in_a_resource_group.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/capabilities_by_location.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python list_servers_in_a_resource_group.py + python capabilities_by_location.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,18 +24,18 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.servers.list_by_resource_group( - resource_group_name="TestGroup", + response = client.location_based_capabilities.execute( + location_name="westus", ) for item in response: print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/ServersListByResourceGroup.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/CapabilitiesByLocation.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/check_name_availability.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/check_name_availability.py index d0fc373d683b..0921ec893978 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/check_name_availability.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/check_name_availability.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,18 +24,17 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.check_name_availability.execute( - location_name="SouthEastAsia", - name_availability_request={"name": "name1", "type": "Microsoft.DBforMySQL/flexibleServers"}, + name_availability_request={"name": "name1", "type": "Microsoft.DBforPostgreSQL"}, ) print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/CheckNameAvailability.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/name_availability.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/check_name_availability_location_based.py similarity index 72% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/name_availability.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/check_name_availability_location_based.py index b16dd4237b6d..f2d12dd0c90f 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/name_availability.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/check_name_availability_location_based.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python name_availability.py + python check_name_availability_location_based.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,17 +24,18 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.check_name_availability.execute( - name_availability_request={"name": "name1", "type": "Microsoft.DBforMySQL"}, + response = client.check_name_availability_with_location.execute( + location_name="westus", + name_availability_request={"name": "name1", "type": "Microsoft.DBforPostgreSQL/flexibleServers"}, ) print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/CheckNameAvailability.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/CheckNameAvailabilityLocationBased.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/configuration_create_or_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/configuration_create_or_update.py index 1a189ad4da47..c99866042768 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/configuration_create_or_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/configuration_create_or_update.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -32,12 +32,12 @@ def main(): response = client.configurations.begin_create_or_update( resource_group_name="TestGroup", server_name="testserver", - configuration_name="event_scheduler", + configuration_name="array_nulls", parameters={"properties": {"source": "user-override", "value": "off"}}, ).result() print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ConfigurationCreateOrUpdate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/configuration_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/configuration_get.py index 6e77e372fc2e..6d88d709bfe5 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/configuration_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/configuration_get.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -32,11 +32,11 @@ def main(): response = client.configurations.get( resource_group_name="TestGroup", server_name="testserver", - configuration_name="event_scheduler", + configuration_name="array_nulls", ) print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ConfigurationGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/configuration_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/configuration_list.py deleted file mode 100644 index 84e3f61a3fc3..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/configuration_list.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python configuration_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.configurations.list_by_server( - resource_group_name="testrg", - server_name="mysqltestsvc1", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ConfigurationListByServer.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_all_firewall_rules_in_a_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/configuration_list_by_server.py similarity index 78% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_all_firewall_rules_in_a_server.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/configuration_list_by_server.py index 704ee3dcbe43..bd8dcabf2dd2 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_all_firewall_rules_in_a_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/configuration_list_by_server.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python list_all_firewall_rules_in_a_server.py + python configuration_list_by_server.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,12 +24,12 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.firewall_rules.list_by_server( + response = client.configurations.list_by_server( resource_group_name="TestGroup", server_name="testserver", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/FirewallRulesListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_a_user_configuration.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/configuration_update.py similarity index 83% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_a_user_configuration.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/configuration_update.py index efe30e3752ab..608874a71459 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_a_user_configuration.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/configuration_update.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python update_a_user_configuration.py + python configuration_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/ConfigurationUpdate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/ConfigurationUpdate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/delete_a_database.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/configurations_update_by_server.py similarity index 70% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/delete_a_database.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/configurations_update_by_server.py index ce9aba75e09f..fd68770d08b3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/delete_a_database.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/configurations_update_by_server.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python delete_a_database.py + python configurations_update_by_server.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,19 +24,22 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.databases.begin_delete( + response = client.server_parameters.begin_list_update_configurations( resource_group_name="TestGroup", server_name="testserver", - database_name="db1", + value=[ + {"name": "array_nulls", "properties": {"value": "on"}}, + {"name": "backslash_quote", "properties": {"value": "on"}}, + ], ).result() print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/DatabaseDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationsUpdateByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_database.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_database.py deleted file mode 100644 index 940b0c1bbe1d..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_database.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python create_a_database.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.databases.begin_create_or_update( - resource_group_name="TestGroup", - server_name="testserver", - database_name="db1", - parameters={"properties": {"charset": "utf8", "collation": "utf8_general_ci"}}, - ).result() - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/DatabaseCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_firewall_rule.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_firewall_rule.py deleted file mode 100644 index 914d4a38afb7..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_firewall_rule.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python create_a_firewall_rule.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.firewall_rules.begin_create_or_update( - resource_group_name="TestGroup", - server_name="testserver", - firewall_rule_name="rule1", - parameters={"properties": {"endIpAddress": "255.255.255.255", "startIpAddress": "0.0.0.0"}}, - ).result() - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/FirewallRuleCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_server_as_a_point_in_time_restore.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_server_as_a_point_in_time_restore.py deleted file mode 100644 index 31101e12424f..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_server_as_a_point_in_time_restore.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python create_a_server_as_a_point_in_time_restore.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.servers.begin_create( - resource_group_name="TargetResourceGroup", - server_name="targetserver", - parameters={ - "location": "SoutheastAsia", - "properties": { - "createMode": "PointInTimeRestore", - "restorePointInTime": "2021-06-24T00:00:37.467Z", - "sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforMySQL/flexibleServers/sourceserver", - }, - "sku": {"name": "Standard_D14_v2", "tier": "GeneralPurpose"}, - "tags": {"num": "1"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/ServerCreateWithPointInTimeRestore.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_an_azure_ad_administrator.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_an_azure_ad_administrator.py deleted file mode 100644 index 5a9af12ca480..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_an_azure_ad_administrator.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python create_an_azure_ad_administrator.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.azure_ad_administrators.begin_create_or_update( - resource_group_name="testrg", - server_name="mysqltestsvc4", - administrator_name="ActiveDirectory", - parameters={ - "properties": { - "administratorType": "ActiveDirectory", - "identityResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/test-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-umi", - "login": "bob@contoso.com", - "sid": "c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c", - "tenantId": "c12b7025-bfe2-46c1-b463-993b5e4cd467", - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/AzureADAdministratorCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_backup_for_a_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_backup_for_a_server.py deleted file mode 100644 index f4c6740cb7b3..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_backup_for_a_server.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python create_backup_for_a_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.backups.put( - resource_group_name="TestGroup", - server_name="mysqltestserver", - backup_name="mybackup", - ) - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/BackupPut.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/database_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/database_create.py index 2e3608d32238..770ec8060aed 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/database_create.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/database_create.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -33,11 +33,11 @@ def main(): resource_group_name="TestGroup", server_name="testserver", database_name="db1", - parameters={"properties": {"charset": "utf8", "collation": "utf8_general_ci"}}, + parameters={"properties": {"charset": "UTF8", "collation": "English_United States.1252"}}, ).result() print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/DatabaseCreate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseCreate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/database_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/database_delete.py index 04a07b88106b..110bdb9953e7 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/database_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/database_delete.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/DatabaseDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseDelete.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/database_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/database_get.py index aebf72bcbf98..d054c6b475d3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/database_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/database_get.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/DatabaseGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_databases_in_a_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/database_list_by_server.py similarity index 83% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_databases_in_a_server.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/database_list_by_server.py index 39257339d002..454818759b47 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_databases_in_a_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/database_list_by_server.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python list_databases_in_a_server.py + python database_list_by_server.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/DatabasesListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/database_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/databases_list_by_server.py similarity index 82% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/database_list.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/databases_list_by_server.py index cf98cc73f6cb..8bfd5869567e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/database_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/databases_list_by_server.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python database_list.py + python databases_list_by_server.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/DatabaseListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/DatabasesListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/delete_a_firewall_rule.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/delete_a_firewall_rule.py deleted file mode 100644 index e00dd2db7cb1..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/delete_a_firewall_rule.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python delete_a_firewall_rule.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.firewall_rules.begin_delete( - resource_group_name="TestGroup", - server_name="testserver", - firewall_rule_name="rule1", - ).result() - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/FirewallRuleDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/delete_a_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/delete_a_server.py deleted file mode 100644 index 38c5c89edf22..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/delete_a_server.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python delete_a_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.servers.begin_delete( - resource_group_name="TestGroup", - server_name="testserver", - ).result() - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/ServerDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/firewall_rule_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/firewall_rule_create.py index ca77c04c5967..74fae897a3b9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/firewall_rule_create.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/firewall_rule_create.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/FirewallRuleCreate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleCreate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/firewall_rule_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/firewall_rule_delete.py index 109dbbdfc156..baab444017db 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/firewall_rule_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/firewall_rule_delete.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/FirewallRuleDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleDelete.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/firewall_rule_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/firewall_rule_get.py index 5f5cfe6d233d..15057f6dda11 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/firewall_rule_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/firewall_rule_get.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/FirewallRuleGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/firewall_rule_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/firewall_rule_list_by_server.py similarity index 82% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/firewall_rule_list.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/firewall_rule_list_by_server.py index 8becb6312803..426b086fb1bd 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/firewall_rule_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/firewall_rule_list_by_server.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python firewall_rule_list.py + python firewall_rule_list_by_server.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/FirewallRuleListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_configuration.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_configuration.py deleted file mode 100644 index 7dba1549d669..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_configuration.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python get_a_configuration.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.configurations.get( - resource_group_name="TestGroup", - server_name="testserver", - configuration_name="event_scheduler", - ) - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/ConfigurationGet.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_database.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_database.py deleted file mode 100644 index 84abc60f7f66..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_database.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python get_a_database.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.databases.get( - resource_group_name="TestGroup", - server_name="testserver", - database_name="db1", - ) - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/DatabaseGet.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_firewall_rule.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_firewall_rule.py deleted file mode 100644 index 24e34f4def86..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_firewall_rule.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python get_a_firewall_rule.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.firewall_rules.get( - resource_group_name="TestGroup", - server_name="testserver", - firewall_rule_name="rule1", - ) - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/FirewallRuleGet.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_private_dns_zone_suffix.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_private_dns_zone_suffix.py index a6b1e2743bfd..c042ae84a944 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_private_dns_zone_suffix.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_private_dns_zone_suffix.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,15 +24,15 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.get_private_dns_zone_suffix.execute() print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/GetPrivateDnsZoneSuffix.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/GetPrivateDnsZoneSuffix.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_all_server_log_files_for_a_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_all_server_log_files_for_a_server.py deleted file mode 100644 index 2dcc9d95082a..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_all_server_log_files_for_a_server.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python list_all_server_log_files_for_a_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.log_files.list_by_server( - resource_group_name="testrg", - server_name="mysqltestsvc1", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/LogFilesListByServer.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_azure_ad_administrators_in_a_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_azure_ad_administrators_in_a_server.py deleted file mode 100644 index 871be8f5d94e..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_azure_ad_administrators_in_a_server.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python list_azure_ad_administrators_in_a_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.azure_ad_administrators.list_by_server( - resource_group_name="testrg", - server_name="mysqltestsvc4", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/AzureADAdministratorsListByServer.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_replicas_for_a_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_replicas_for_a_server.py deleted file mode 100644 index dd54c4f68674..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_replicas_for_a_server.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python list_replicas_for_a_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.replicas.list_by_server( - resource_group_name="TestGroup", - server_name="mysqltestserver", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/ReplicasListByServer.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_servers_in_a_subscription.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_servers_in_a_subscription.py deleted file mode 100644 index 8e26744d80df..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_servers_in_a_subscription.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python list_servers_in_a_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.servers.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/ServersList.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/log_file_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/log_file_list_by_server.py similarity index 82% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/log_file_list.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/log_file_list_by_server.py index 00a5a64f15be..877b0de52027 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/log_file_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/log_file_list_by_server.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python log_file_list.py + python log_file_list_by_server.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/LogFileListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/LogFileListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/operation_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/operation_list.py index a13d286429c2..30fd17d192dd 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/operation_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/operation_list.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -33,6 +33,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/OperationList.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/OperationList.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/performance_tiers_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/performance_tiers_list.py deleted file mode 100644 index cd51e170e2c6..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/performance_tiers_list.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python performance_tiers_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.server_based_performance_tier.list( - resource_group_name="testrg", - server_name="mysqltestsvc1", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/PerformanceTiersListByServer.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/capabilities_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/performance_tiers_list_by_location.py similarity index 77% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/capabilities_list.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/performance_tiers_list_by_location.py index 8225236f91ce..fa9932529812 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/capabilities_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/performance_tiers_list_by_location.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python capabilities_list.py + python performance_tiers_list_by_location.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,18 +24,18 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.location_based_capabilities.list( + response = client.location_based_performance_tier.list( location_name="WestUS", ) for item in response: print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/CapabilitiesByLocationList.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/PerformanceTiersListByLocation.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/performance_tiers_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/performance_tiers_list_by_server.py new file mode 100644 index 000000000000..d91d761ed47e --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/performance_tiers_list_by_server.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.rdbms import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python performance_tiers_list_by_server.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.server_based_performance_tier.list( + resource_group_name="TestGroup", + server_name="testserver", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/PerformanceTiersListByServer.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/deletes_a_private_endpoint_connection_with_a_given_name..py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_endpoint_connection_delete.py similarity index 82% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/deletes_a_private_endpoint_connection_with_a_given_name..py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_endpoint_connection_delete.py index 6c344b40eac9..5a1580957d5a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/deletes_a_private_endpoint_connection_with_a_given_name..py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_endpoint_connection_delete.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python deletes_a_private_endpoint_connection_with_a_given_name..py + python private_endpoint_connection_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="00000000-1111-2222-3333-444444444444", ) @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/gets_private_endpoint_connection..py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_endpoint_connection_get.py similarity index 82% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/gets_private_endpoint_connection..py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_endpoint_connection_get.py index 8df970e2bab7..b3e1a5b3b9a5 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/gets_private_endpoint_connection..py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_endpoint_connection_get.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python gets_private_endpoint_connection..py + python private_endpoint_connection_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="00000000-1111-2222-3333-444444444444", ) @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/gets_list_of_private_endpoint_connections_on_a_server..py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_endpoint_connection_list.py similarity index 81% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/gets_list_of_private_endpoint_connections_on_a_server..py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_endpoint_connection_list.py index 13a9f80a85e5..e874a4b180fe 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/gets_list_of_private_endpoint_connections_on_a_server..py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_endpoint_connection_list.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python gets_list_of_private_endpoint_connections_on_a_server..py + python private_endpoint_connection_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="00000000-1111-2222-3333-444444444444", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionList.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionList.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/approve_or_reject_a_private_endpoint_connection_with_a_given_name..py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_endpoint_connection_update.py similarity index 84% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/approve_or_reject_a_private_endpoint_connection_with_a_given_name..py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_endpoint_connection_update.py index 3f714f6adb26..db4d5ea7fe3c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/approve_or_reject_a_private_endpoint_connection_with_a_given_name..py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_endpoint_connection_update.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python approve_or_reject_a_private_endpoint_connection_with_a_given_name..py + python private_endpoint_connection_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="00000000-1111-2222-3333-444444444444", ) @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_private_endpoint_connection_tags.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_endpoint_connection_update_tags.py similarity index 78% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_private_endpoint_connection_tags.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_endpoint_connection_update_tags.py index d085c1cb8bd3..25a364ffa1d6 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_private_endpoint_connection_tags.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_endpoint_connection_update_tags.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python update_private_endpoint_connection_tags.py + python private_endpoint_connection_update_tags.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="00000000-1111-2222-3333-444444444444", ) @@ -33,11 +33,11 @@ def main(): resource_group_name="Default", server_name="test-svr", private_endpoint_connection_name="private-endpoint-connection-name", - parameters={"tags": {"key1": "val1", "key2": "val2"}}, + parameters={"tags": {"key1": "val1", "key2": "val2", "key3": "val3"}}, ).result() print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdateTags.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/gets_a_private_link_resource_for_my_sql..py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_link_resources_get.py similarity index 82% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/gets_a_private_link_resource_for_my_sql..py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_link_resources_get.py index a69ce55a10af..4c35923893d4 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/gets_a_private_link_resource_for_my_sql..py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_link_resources_get.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python gets_a_private_link_resource_for_my_sql..py + python private_link_resources_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="00000000-1111-2222-3333-444444444444", ) @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateLinkResourcesGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateLinkResourcesGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/gets_private_link_resources_for_my_sql..py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_link_resources_list.py similarity index 82% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/gets_private_link_resources_for_my_sql..py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_link_resources_list.py index 7ead750ac95d..a8703cecc24e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/gets_private_link_resources_for_my_sql..py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/private_link_resources_list.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python gets_private_link_resources_for_my_sql..py + python private_link_resources_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="00000000-1111-2222-3333-444444444444", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateLinkResourcesList.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateLinkResourcesList.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/query_performance_insight_reset_data.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/query_performance_insight_reset_data.py deleted file mode 100644 index b82ddd568c51..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/query_performance_insight_reset_data.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python query_performance_insight_reset_data.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.reset_query_performance_insight_data( - resource_group_name="testResourceGroupName", - server_name="testServerName", - ) - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/QueryPerformanceInsightResetData.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/query_texts_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/query_texts_get.py deleted file mode 100644 index 229a59727d3a..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/query_texts_get.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python query_texts_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.query_texts.get( - resource_group_name="testResourceGroupName", - server_name="testServerName", - query_id="1", - ) - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/QueryTextsGet.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/query_texts_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/query_texts_list_by_server.py deleted file mode 100644 index ef7b38524c99..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/query_texts_list_by_server.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python query_texts_list_by_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.query_texts.list_by_server( - resource_group_name="testResourceGroupName", - server_name="testServerName", - query_ids=["1", "2"], - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/QueryTextsListByServer.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/recommended_action_session_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/recommended_action_session_create.py deleted file mode 100644 index e556e6a4d791..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/recommended_action_session_create.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python recommended_action_session_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.begin_create_recommended_action_session( - resource_group_name="testResourceGroupName", - server_name="testServerName", - advisor_name="Index", - database_name="someDatabaseName", - ).result() - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionSessionCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/recommended_action_session_operation_status.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/recommended_action_session_operation_status.py deleted file mode 100644 index bb6a524b6031..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/recommended_action_session_operation_status.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python recommended_action_session_operation_status.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.location_based_recommended_action_sessions_operation_status.get( - location_name="WestUS", - operation_id="aaaabbbb-cccc-dddd-0000-111122223333", - ) - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionSessionOperationStatus.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/recommended_action_session_result.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/recommended_action_session_result.py deleted file mode 100644 index e81360ba827f..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/recommended_action_session_result.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python recommended_action_session_result.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.location_based_recommended_action_sessions_result.list( - location_name="WestUS", - operation_id="aaaabbbb-cccc-dddd-0000-111122223333", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionSessionResult.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/recommended_actions_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/recommended_actions_get.py deleted file mode 100644 index d4bbf8c7abc4..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/recommended_actions_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python recommended_actions_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.recommended_actions.get( - resource_group_name="testResourceGroupName", - server_name="testServerName", - advisor_name="Index", - recommended_action_name="Index-1", - ) - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionsGet.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/recommended_actions_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/recommended_actions_list_by_server.py deleted file mode 100644 index 621f4d56ff02..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/recommended_actions_list_by_server.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python recommended_actions_list_by_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.recommended_actions.list_by_server( - resource_group_name="testResourceGroupName", - server_name="testServerName", - advisor_name="Index", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionsListByServer.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_server_with_vnet.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/recoverable_servers_get.py similarity index 77% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_server_with_vnet.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/recoverable_servers_get.py index 936fa089728f..42276e352d24 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_server_with_vnet.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/recoverable_servers_get.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python get_a_server_with_vnet.py + python recoverable_servers_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,18 +24,18 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.servers.get( + response = client.recoverable_servers.get( resource_group_name="testrg", - server_name="mysqltestserver", + server_name="pgtestsvc4", ) print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/ServerGetWithVnet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/RecoverableServersGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/replicas_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/replicas_list_by_server.py index 48cd12a912c8..d6b340648809 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/replicas_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/replicas_list_by_server.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,19 +24,19 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.replicas.list_by_server( - resource_group_name="TestGroup", - server_name="testmaster", + resource_group_name="TestGroup_WestCentralUS", + server_name="testserver-master", ) for item in response: print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ReplicasListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ReplicasListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/restart_a_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/restart_a_server.py deleted file mode 100644 index b59eb08dd652..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/restart_a_server.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python restart_a_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.servers.begin_failover( - resource_group_name="TestGroup", - server_name="testserver", - ).result() - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/ServerFailover.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_administrator_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_admin_create_update.py similarity index 83% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_administrator_create.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_admin_create_update.py index 099ed7cb233c..1cd20f1bc552 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_administrator_create.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_admin_create_update.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python server_administrator_create.py + python server_admin_create_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,14 +24,14 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.server_administrators.begin_create_or_update( resource_group_name="testrg", - server_name="mysqltestsvc4", + server_name="pgtestsvc4", properties={ "properties": { "administratorType": "ActiveDirectory", @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerAdminCreateUpdate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_administrators_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_admin_delete.py similarity index 80% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_administrators_delete.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_admin_delete.py index 0e6c2d25bee9..59ee3edd8a66 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_administrators_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_admin_delete.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python server_administrators_delete.py + python server_admin_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,18 +24,18 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.server_administrators.begin_delete( resource_group_name="testrg", - server_name="mysqltestsvc4", + server_name="pgtestsvc4", ).result() print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerAdminDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminDelete.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_administrator_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_admin_get.py similarity index 80% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_administrator_get.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_admin_get.py index b5fbdde2d6cf..86f8c77de383 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_administrator_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_admin_get.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python server_administrator_get.py + python server_admin_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,18 +24,18 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.server_administrators.get( resource_group_name="testrg", - server_name="mysqltestsvc4", + server_name="pgtestsvc4", ) print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerAdminGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_list_of_server_administrators.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_admin_list.py similarity index 80% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_list_of_server_administrators.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_admin_list.py index 8bf0d37c5ed8..23e93a15ff9b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_list_of_server_administrators.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_admin_list.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python get_a_list_of_server_administrators.py + python server_admin_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,19 +24,19 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.server_administrators.list( resource_group_name="testrg", - server_name="mysqltestsvc4", + server_name="pgtestsvc4", ) for item in response: print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerAdminList.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminList.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_new_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create.py similarity index 75% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_new_server.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create.py index 2615392d8671..e0bdc86b98f7 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_new_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python create_a_new_server.py + python server_create.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,30 +24,31 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.servers.begin_create( - resource_group_name="testrg", - server_name="mysqltestsvc4", + resource_group_name="TestGroup", + server_name="pgtestsvc4", parameters={ "location": "westus", "properties": { "administratorLogin": "cloudsa", "administratorLoginPassword": "", "createMode": "Default", + "minimalTlsVersion": "TLS1_2", "sslEnforcement": "Enabled", - "storageProfile": {"backupRetentionDays": 7, "geoRedundantBackup": "Enabled", "storageMB": 128000}, + "storageProfile": {"backupRetentionDays": 7, "geoRedundantBackup": "Disabled", "storageMB": 128000}, }, - "sku": {"capacity": 2, "family": "Gen5", "name": "GP_Gen5_2", "tier": "GeneralPurpose"}, + "sku": {"capacity": 2, "family": "Gen5", "name": "B_Gen5_2", "tier": "Basic"}, "tags": {"ElasticServer": "1"}, }, ).result() print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_geo_restore.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_geo_restore.py new file mode 100644 index 000000000000..89f320b694e5 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_geo_restore.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.rdbms import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python server_create_geo_restore.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.servers.begin_create( + resource_group_name="testrg", + server_name="pgtestsvc5geo", + parameters={ + "location": "eastus", + "properties": { + "createMode": "GeoRestore", + "pointInTimeUTC": "2021-06-27T00:04:59.4078005+00:00", + "sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/ServerCreateGeoRestore.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_server_as_a_geo_restore_.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_geo_restore_mode.py similarity index 83% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_server_as_a_geo_restore_.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_geo_restore_mode.py index 41d5bdee0bbb..0df1bd90a35e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_server_as_a_geo_restore_.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_geo_restore_mode.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python create_a_server_as_a_geo_restore_.py + python server_create_geo_restore_mode.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -36,7 +36,7 @@ def main(): "location": "westus", "properties": { "createMode": "GeoRestore", - "sourceServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforMySQL/servers/sourceserver", + "sourceServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver", }, "sku": {"capacity": 2, "family": "Gen5", "name": "GP_Gen5_2", "tier": "GeneralPurpose"}, "tags": {"ElasticServer": "1"}, @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreateGeoRestoreMode.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateGeoRestoreMode.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_database_as_a_point_in_time_restore.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_point_in_time_restore.py similarity index 79% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_database_as_a_point_in_time_restore.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_point_in_time_restore.py index a6d6f4718eb0..69a0a1528e5e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_database_as_a_point_in_time_restore.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_point_in_time_restore.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python create_a_database_as_a_point_in_time_restore.py + python server_create_point_in_time_restore.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -37,15 +37,15 @@ def main(): "properties": { "createMode": "PointInTimeRestore", "restorePointInTime": "2017-12-14T00:00:37.467Z", - "sourceServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforMySQL/servers/sourceserver", + "sourceServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver", }, - "sku": {"capacity": 2, "family": "Gen5", "name": "GP_Gen5_2", "tier": "GeneralPurpose"}, + "sku": {"capacity": 2, "family": "Gen5", "name": "B_Gen5_2", "tier": "Basic"}, "tags": {"ElasticServer": "1"}, }, ).result() print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreatePointInTimeRestore.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreatePointInTimeRestore.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_replica_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_replica.py similarity index 68% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_replica_server.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_replica.py index e593d8cc0afc..88664ba42ce1 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_replica_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_replica.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python create_a_replica_server.py + python server_create_replica.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,25 +24,26 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.servers.begin_create( - resource_group_name="TargetResourceGroup", - server_name="targetserver", + resource_group_name="testrg", + server_name="pgtestsvc5rep", parameters={ "location": "westus", "properties": { "createMode": "Replica", - "sourceServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/MasterResourceGroup/providers/Microsoft.DBforMySQL/servers/masterserver", + "pointInTimeUTC": "2021-06-27T00:04:59.4078005+00:00", + "sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername", }, }, ).result() print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/ServerCreateReplica.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_replica_mode.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_replica_mode.py new file mode 100644 index 000000000000..1cf8d6f03057 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_replica_mode.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.rdbms import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python server_create_replica_mode.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.servers.begin_create( + resource_group_name="TestGroup_WestCentralUS", + server_name="testserver-replica1", + parameters={ + "location": "westcentralus", + "properties": { + "createMode": "Replica", + "sourceServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master", + }, + "sku": {"capacity": 2, "family": "Gen5", "name": "GP_Gen5_2", "tier": "GeneralPurpose"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_with_aad_auth_enabled.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_with_aad_auth_enabled.py new file mode 100644 index 000000000000..f1da024a0208 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_with_aad_auth_enabled.py @@ -0,0 +1,62 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.rdbms import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python server_create_with_aad_auth_enabled.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.servers.begin_create( + resource_group_name="testrg", + server_name="pgtestsvc4", + parameters={ + "location": "westus", + "properties": { + "administratorLogin": "cloudsa", + "administratorLoginPassword": "password", + "authConfig": {"activeDirectoryAuthEnabled": True, "tenantId": "tttttt-tttt-tttt-tttt-tttttttttttt"}, + "availabilityZone": "1", + "backup": {"backupRetentionDays": 7, "geoRedundantBackup": "Disabled"}, + "createMode": "Create", + "dataEncryption": {"type": "SystemManaged"}, + "highAvailability": {"mode": "ZoneRedundant"}, + "network": { + "delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet", + "privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com", + }, + "storage": {"storageSizeGB": 512}, + "version": "12", + }, + "sku": {"name": "Standard_D4s_v3", "tier": "GeneralPurpose"}, + "tags": {"ElasticServer": "1"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/ServerCreateWithAadAuthEnabled.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_server_with_byok.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_with_data_encryption_enabled.py similarity index 53% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_server_with_byok.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_with_data_encryption_enabled.py index 2b2a16ed2daa..430702b93fc4 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_a_server_with_byok.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_create_with_data_encryption_enabled.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python create_a_server_with_byok.py + python server_create_with_data_encryption_enabled.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,46 +24,48 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.servers.begin_create( resource_group_name="testrg", - server_name="mysqltestserver", + server_name="pgtestsvc4", parameters={ "identity": { "type": "UserAssigned", "userAssignedIdentities": { - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity": {} + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity": {} }, }, - "location": "southeastasia", + "location": "westus", "properties": { "administratorLogin": "cloudsa", - "administratorLoginPassword": "your_password", + "administratorLoginPassword": "password", "availabilityZone": "1", "backup": {"backupRetentionDays": 7, "geoRedundantBackup": "Disabled"}, - "createMode": "Default", + "createMode": "Create", "dataEncryption": { - "geoBackupKeyURI": "https://test-geo.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a", - "geoBackupUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-identity", - "primaryKeyURI": "https://test.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a", - "primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity", + "primaryKeyURI": "https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787", + "primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", "type": "AzureKeyVault", }, - "highAvailability": {"mode": "ZoneRedundant", "standbyAvailabilityZone": "3"}, - "storage": {"autoGrow": "Disabled", "iops": 600, "storageSizeGB": 100}, - "version": "5.7", + "highAvailability": {"mode": "ZoneRedundant"}, + "network": { + "delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet", + "privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com", + }, + "storage": {"storageSizeGB": 512}, + "version": "12", }, - "sku": {"name": "Standard_D2ds_v4", "tier": "GeneralPurpose"}, - "tags": {"num": "1"}, + "sku": {"name": "Standard_D4s_v3", "tier": "GeneralPurpose"}, + "tags": {"ElasticServer": "1"}, }, ).result() print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/ServerCreateWithBYOK.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/ServerCreateWithDataEncryptionEnabled.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_delete.py index 23be17edf874..ff8135cd93c3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_delete.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerDelete.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_get.py index 1d6cef9d8ace..497f58b435fe 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_get.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,18 +24,18 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.servers.get( resource_group_name="testrg", - server_name="mysqltestsvc4", + server_name="pgtestsvc1", ) print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_get_with_vnet.py similarity index 79% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_server.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_get_with_vnet.py index aebc97a0aea0..71c659fe7723 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_get_with_vnet.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python get_a_server.py + python server_get_with_vnet.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,18 +24,18 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.servers.get( resource_group_name="testrg", - server_name="mysqltestserver", + server_name="pgtestsvc4", ) print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/ServerGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/ServerGetWithVnet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/creates_or_updates_a_my_sql_server_key.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_key_create_or_update.py similarity index 84% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/creates_or_updates_a_my_sql_server_key.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_key_create_or_update.py index 6c6b506a54a3..ddc69f814bea 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/creates_or_updates_a_my_sql_server_key.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_key_create_or_update.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python creates_or_updates_a_my_sql_server_key.py + python server_key_create_or_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerKeyCreateOrUpdate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/delete_the_my_sql_server_key.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_key_delete.py similarity index 83% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/delete_the_my_sql_server_key.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_key_delete.py index 981e80a963b8..95650fdd65aa 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/delete_the_my_sql_server_key.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_key_delete.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python delete_the_my_sql_server_key.py + python server_key_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerKeyDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyDelete.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_the_my_sql_server_key.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_key_get.py similarity index 83% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_the_my_sql_server_key.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_key_get.py index e93be0e5e5ea..380f35e37603 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_the_my_sql_server_key.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_key_get.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python get_the_my_sql_server_key.py + python server_key_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerKeyGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_the_keys_for_a_my_sql_server..py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_key_list.py similarity index 83% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_the_keys_for_a_my_sql_server..py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_key_list.py index 19062c5fb7e2..284bc739a551 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_the_keys_for_a_my_sql_server..py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_key_list.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python list_the_keys_for_a_my_sql_server..py + python server_key_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerKeyList.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyList.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_list.py index 3218686fdc82..c720e67e1c27 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_list.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerList.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerList.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_list_by_resource_group.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_list_by_resource_group.py index 2593425ff438..f3bb05884d32 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_list_by_resource_group.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_list_by_resource_group.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,18 +24,18 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.servers.list_by_resource_group( - resource_group_name="testrg", + resource_group_name="TestGroup", ) for item in response: print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerListByResourceGroup.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_restart.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_restart.py index aa0d42486d9b..77458b850326 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_restart.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_restart.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerRestart.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerRestart.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_restart_with_failover.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_restart_with_failover.py new file mode 100644 index 000000000000..cf89970c8d40 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_restart_with_failover.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.rdbms import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python server_restart_with_failover.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.servers.begin_restart( + resource_group_name="testrg", + server_name="testserver", + ).result() + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/ServerRestartWithFailover.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_a_server's_threat_detection_policy_with_all_parameters.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_security_alerts_create_max.py similarity index 86% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_a_server's_threat_detection_policy_with_all_parameters.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_security_alerts_create_max.py index 5b405bf38909..027f44abad10 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_a_server's_threat_detection_policy_with_all_parameters.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_security_alerts_create_max.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python update_a_server's_threat_detection_policy_with_all_parameters.py + python server_security_alerts_create_max.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="00000000-1111-2222-3333-444444444444", ) @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMax.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMax.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_a_server's_threat_detection_policy_with_minimal_parameters.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_security_alerts_create_min.py similarity index 82% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_a_server's_threat_detection_policy_with_minimal_parameters.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_security_alerts_create_min.py index 6bbc76222c26..de88d9d359b2 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_a_server's_threat_detection_policy_with_minimal_parameters.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_security_alerts_create_min.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python update_a_server's_threat_detection_policy_with_minimal_parameters.py + python server_security_alerts_create_min.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="00000000-1111-2222-3333-444444444444", ) @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMin.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMin.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_server's_threat_detection_policy.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_security_alerts_get.py similarity index 82% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_server's_threat_detection_policy.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_security_alerts_get.py index 0034ff349dfc..e4d55c3cc0fe 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/get_a_server's_threat_detection_policy.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_security_alerts_get.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python get_a_server's_threat_detection_policy.py + python server_security_alerts_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="00000000-1111-2222-3333-444444444444", ) @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerSecurityAlertsGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_the_server's_threat_detection_policies.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_security_alerts_list_by_server.py similarity index 81% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_the_server's_threat_detection_policies.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_security_alerts_list_by_server.py index 8a93fd42d54b..b27d9d3217d0 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_the_server's_threat_detection_policies.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_security_alerts_list_by_server.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python list_the_server's_threat_detection_policies.py + python server_security_alerts_list_by_server.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="00000000-1111-2222-3333-444444444444", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerSecurityAlertsListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_start.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_start.py index 1654ee00dd4f..dd544781d2c1 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_start.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_start.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,18 +24,18 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.servers.begin_start( - resource_group_name="TestGroup", + resource_group_name="testrg", server_name="testserver", ).result() print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerStart.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/ServerStart.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_stop.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_stop.py index fc6d42138038..3dda8e5acf1d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_stop.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_stop.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,18 +24,18 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.servers.begin_stop( - resource_group_name="TestGroup", + resource_group_name="testrg", server_name="testserver", ).result() print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerStop.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/ServerStop.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_update.py index 325ae889b402..e2b1ae13a6e2 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_update.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES @@ -24,21 +24,25 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.servers.begin_update( resource_group_name="testrg", - server_name="mysqltestsvc4", + server_name="pgtestsvc4", parameters={ - "properties": {"administratorLoginPassword": "", "sslEnforcement": "Disabled"} + "properties": { + "administratorLoginPassword": "", + "minimalTlsVersion": "TLS1_2", + "sslEnforcement": "Enabled", + } }, ).result() print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerUpdate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerUpdate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_update_with_aad_auth_enabled.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_update_with_aad_auth_enabled.py new file mode 100644 index 000000000000..6f162bf4dca9 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_update_with_aad_auth_enabled.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.rdbms import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python server_update_with_aad_auth_enabled.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.servers.begin_update( + resource_group_name="TestGroup", + server_name="pgtestsvc4", + parameters={ + "properties": { + "administratorLoginPassword": "newpassword", + "authConfig": {"activeDirectoryAuthEnabled": True, "tenantId": "tttttt-tttt-tttt-tttt-tttttttttttt"}, + "backup": {"backupRetentionDays": 20}, + "createMode": "Update", + "storage": {"storageSizeGB": 1024}, + }, + "sku": {"name": "Standard_D8s_v3", "tier": "GeneralPurpose"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/ServerUpdateWithAadAuthEnabled.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_server_customer_maintenance_window.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_update_with_customer_maintenance_window.py similarity index 75% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_server_customer_maintenance_window.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_update_with_customer_maintenance_window.py index 1035dd8d8b11..3bb57191dea9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_server_customer_maintenance_window.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_update_with_customer_maintenance_window.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python update_server_customer_maintenance_window.py + python server_update_with_customer_maintenance_window.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,23 +24,24 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.servers.begin_update( resource_group_name="testrg", - server_name="mysqltestserver", + server_name="pgtestsvc4", parameters={ "properties": { - "maintenanceWindow": {"customWindow": "Enabled", "dayOfWeek": 1, "startHour": 8, "startMinute": 0} + "createMode": "Update", + "maintenanceWindow": {"customWindow": "Enabled", "dayOfWeek": 0, "startHour": 8, "startMinute": 0}, } }, ).result() print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/ServerUpdateWithCustomerMaintenanceWindow.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/ServerUpdateWithCustomerMaintenanceWindow.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_server_with_byok.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_update_with_data_encryption_enabled.py similarity index 59% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_server_with_byok.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_update_with_data_encryption_enabled.py index ade5ca1f88f6..268603eb021b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_server_with_byok.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_update_with_data_encryption_enabled.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python update_server_with_byok.py + python server_update_with_data_encryption_enabled.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,35 +24,38 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.servers.begin_update( - resource_group_name="testrg", - server_name="mysqltestserver", + resource_group_name="TestGroup", + server_name="pgtestsvc4", parameters={ "identity": { "type": "UserAssigned", "userAssignedIdentities": { - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity": {} + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity": {} }, }, "properties": { + "administratorLoginPassword": "newpassword", + "backup": {"backupRetentionDays": 20}, + "createMode": "Update", "dataEncryption": { - "geoBackupKeyURI": "https://test-geo.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a", - "geoBackupUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-identity", - "primaryKeyURI": "https://test.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a", - "primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity", + "primaryKeyURI": "https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787", + "primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", "type": "AzureKeyVault", - } + }, + "storage": {"storageSizeGB": 1024}, }, + "sku": {"name": "Standard_D8s_v3", "tier": "GeneralPurpose"}, }, ).result() print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/ServerUpdateWithBYOK.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/ServerUpdateWithDataEncryptionEnabled.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_a_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_update_with_major_version_upgrade.py similarity index 72% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_a_server.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_update_with_major_version_upgrade.py index 305020239fa2..b0332ebe0326 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/update_a_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_update_with_major_version_upgrade.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python update_a_server.py + python server_update_with_major_version_upgrade.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,23 +24,19 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) response = client.servers.begin_update( resource_group_name="testrg", - server_name="mysqltestserver", - parameters={ - "properties": { - "storage": {"autoGrow": "Disabled", "autoIoScaling": "Disabled", "iops": 200, "storageSizeGB": 30} - } - }, + server_name="pgtestsvc4", + parameters={"properties": {"createMode": "Update", "version": "14"}}, ).result() print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/ServerUpdate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/ServerUpdateWithMajorVersionUpgrade.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_upgrade.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_upgrade.py deleted file mode 100644 index 5ef564ccbc89..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/server_upgrade.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python server_upgrade.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.servers.begin_upgrade( - resource_group_name="TestGroup", - server_name="testserver", - parameters={"properties": {"targetServerVersion": "5.7"}}, - ).result() - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerUpgrade.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/start_a_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/start_a_server.py deleted file mode 100644 index 5be1fc9f7a9b..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/start_a_server.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python start_a_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.servers.begin_start( - resource_group_name="TestGroup", - server_name="testserver", - ).result() - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/ServerStart.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/stop_a_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/stop_a_server.py deleted file mode 100644 index b912e9a8f3f7..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/stop_a_server.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python stop_a_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.servers.begin_stop( - resource_group_name="TestGroup", - server_name="testserver", - ).result() - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/ServerStop.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/top_query_statistics_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/top_query_statistics_get.py deleted file mode 100644 index 320f4b42551e..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/top_query_statistics_get.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python top_query_statistics_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.top_query_statistics.get( - resource_group_name="testResourceGroupName", - server_name="testServerName", - query_statistic_id="66-636923268000000000-636923277000000000-avg-duration", - ) - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/TopQueryStatisticsGet.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/top_query_statistics_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/top_query_statistics_list_by_server.py deleted file mode 100644 index 92a4521881f5..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/top_query_statistics_list_by_server.py +++ /dev/null @@ -1,52 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python top_query_statistics_list_by_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.top_query_statistics.list_by_server( - resource_group_name="testResourceGroupName", - server_name="testServerName", - parameters={ - "properties": { - "aggregationFunction": "avg", - "aggregationWindow": "PT15M", - "numberOfTopQueries": 5, - "observationEndTime": "2019-05-07T20:00:00.000Z", - "observationStartTime": "2019-05-01T20:00:00.000Z", - "observedMetric": "duration", - } - }, - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/TopQueryStatisticsListByServer.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_or_update_a_virtual_network_rule.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/virtual_network_rules_create_or_update.py similarity index 84% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_or_update_a_virtual_network_rule.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/virtual_network_rules_create_or_update.py index 674ddeb0ca8e..99c3f4581e7c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/create_or_update_a_virtual_network_rule.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/virtual_network_rules_create_or_update.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python create_or_update_a_virtual_network_rule.py + python virtual_network_rules_create_or_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/VirtualNetworkRulesCreateOrUpdate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/delete_a_virtual_network_rule.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/virtual_network_rules_delete.py similarity index 82% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/delete_a_virtual_network_rule.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/virtual_network_rules_delete.py index 3b07ca13abfb..69bf59f6c31a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/delete_a_virtual_network_rule.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/virtual_network_rules_delete.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python delete_a_virtual_network_rule.py + python virtual_network_rules_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/VirtualNetworkRulesDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesDelete.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/gets_a_virtual_network_rule.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/virtual_network_rules_get.py similarity index 82% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/gets_a_virtual_network_rule.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/virtual_network_rules_get.py index 1f4231e6efee..aa0c97dd1d3b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/gets_a_virtual_network_rule.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/virtual_network_rules_get.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python gets_a_virtual_network_rule.py + python virtual_network_rules_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/VirtualNetworkRulesGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_virtual_network_rules.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/virtual_network_rules_list.py similarity index 82% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_virtual_network_rules.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/virtual_network_rules_list.py index 79b45f21c957..6f15fd3465af 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/list_virtual_network_rules.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/virtual_network_rules_list.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python list_virtual_network_rules.py + python virtual_network_rules_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,7 +24,7 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/VirtualNetworkRulesList.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesList.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/check_virtual_network_subnet_usage.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/virtual_network_subnet_usage.py similarity index 68% rename from sdk/rdbms/azure-mgmt-rdbms/generated_samples/check_virtual_network_subnet_usage.py rename to sdk/rdbms/azure-mgmt-rdbms/generated_samples/virtual_network_subnet_usage.py index 9fb65edc1b6b..2a79a1b71f5d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/check_virtual_network_subnet_usage.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/virtual_network_subnet_usage.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient +from azure.mgmt.rdbms import PostgreSQLManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-rdbms # USAGE - python check_virtual_network_subnet_usage.py + python virtual_network_subnet_usage.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,20 +24,20 @@ def main(): - client = MySQLManagementClient( + client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.check_virtual_network_subnet_usage.execute( - location_name="WestUS", + response = client.virtual_network_subnet_usage.execute( + location_name="westus", parameters={ - "virtualNetworkResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/testvnet" + "virtualNetworkArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/testvnet" }, ) print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/preview/2021-12-01-preview/examples/CheckVirtualNetworkSubnetUsage.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-03-08-preview/examples/VirtualNetworkSubnetUsage.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/wait_statistics_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/wait_statistics_get.py deleted file mode 100644 index 99458fd75577..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/wait_statistics_get.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python wait_statistics_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.wait_statistics.get( - resource_group_name="testResourceGroupName", - server_name="testServerName", - wait_statistics_id="636927606000000000-636927615000000000-send-wait/io/socket/sql/client_connection-2--0", - ) - print(response) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/WaitStatisticsGet.json -if __name__ == "__main__": - main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/wait_statistics_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/wait_statistics_list_by_server.py deleted file mode 100644 index 8077afe9c8fd..000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/wait_statistics_list_by_server.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.rdbms import MySQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-rdbms -# USAGE - python wait_statistics_list_by_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MySQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.wait_statistics.list_by_server( - resource_group_name="testResourceGroupName", - server_name="testServerName", - parameters={ - "properties": { - "aggregationWindow": "PT15M", - "observationEndTime": "2019-05-07T20:00:00.000Z", - "observationStartTime": "2019-05-01T20:00:00.000Z", - } - }, - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/WaitStatisticsListByServer.json -if __name__ == "__main__": - main()