diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json b/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json index 4ed77847eac8..41017755337e 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json +++ b/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json @@ -1,11 +1,11 @@ { - "commit": "84849e5293de3a8e01cbdde13b2d7086d3fb34d6", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "commit": "b5f1988becc51e03ce6cb0c7e393fcd7a8dc810d", + "repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs", "autorest": "3.9.7", "use": [ - "@autorest/python@6.7.1", - "@autorest/modelerfour@4.26.2" + "@autorest/python@6.13.7", + "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/servicelinker/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/servicelinker/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.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False", "readme": "specification/servicelinker/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py index 6a720fde399c..e47598d1ab53 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -19,7 +18,7 @@ from azure.core.credentials import TokenCredential -class ServiceLinkerManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class ServiceLinkerManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for ServiceLinkerManagementClient. Note that all parameters used to create this instance are saved as instance @@ -33,7 +32,6 @@ class ServiceLinkerManagementClientConfiguration(Configuration): # pylint: disa """ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: - super(ServiceLinkerManagementClientConfiguration, self).__init__(**kwargs) api_version: str = kwargs.pop("api_version", "2023-04-01-preview") if credential is None: @@ -43,6 +41,7 @@ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-servicelinker/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -51,9 +50,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_serialization.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_serialization.py index 4bae2292227b..2f781d740827 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_serialization.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_serialization.py @@ -63,8 +63,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +143,7 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -295,7 +288,7 @@ class Model(object): _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + self.additional_properties: Optional[Dict[str, Any]] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -340,7 +333,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +344,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore def as_dict( self, @@ -390,7 +383,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -415,7 +408,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -445,7 +438,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -545,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): 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) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -668,7 +661,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -710,7 +703,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -730,6 +723,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -744,7 +738,7 @@ def query(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :keyword bool skip_quote: Whether to skip quote the serialized result. Defaults to False. - :rtype: str + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -753,7 +747,7 @@ def query(self, name, data, data_type, **kwargs): if data_type.startswith("["): internal_data_type = data_type[1:-1] do_quote = not kwargs.get("skip_quote", False) - return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -804,7 +798,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -824,7 +818,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -993,7 +987,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1170,10 +1164,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1209,7 +1203,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1230,7 +1223,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1371,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1391,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1444,7 +1436,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1481,7 +1473,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1515,14 +1507,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1578,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1652,7 +1644,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1700,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1757,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1808,7 +1800,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1862,10 +1853,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1893,7 +1884,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1910,7 +1901,7 @@ def deserialize_date(attr): 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) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1945,7 +1936,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1982,7 +1973,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1998,9 +1989,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py index ade67153cd78..a668a7fe4ba0 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import ServiceLinkerManagementClientConfiguration @@ -56,7 +58,25 @@ def __init__( self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = ServiceLinkerManagementClientConfiguration(credential=credential, **kwargs) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -70,7 +90,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -90,7 +110,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py index 6f72e83fa148..e5754a47ce68 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.2.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py index fb896e18f25e..2f38370b4607 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -19,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class ServiceLinkerManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class ServiceLinkerManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for ServiceLinkerManagementClient. Note that all parameters used to create this instance are saved as instance @@ -33,7 +32,6 @@ class ServiceLinkerManagementClientConfiguration(Configuration): # pylint: disa """ def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: - super(ServiceLinkerManagementClientConfiguration, self).__init__(**kwargs) api_version: str = kwargs.pop("api_version", "2023-04-01-preview") if credential is None: @@ -43,6 +41,7 @@ def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-servicelinker/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -51,9 +50,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py index b90e9bcaa431..cf7f7a2561e4 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer @@ -57,7 +59,25 @@ def __init__( self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = ServiceLinkerManagementClientConfiguration(credential=credential, **kwargs) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -71,7 +91,9 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -91,7 +113,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_configuration_names_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_configuration_names_operations.py index 2121eb93cab3..bbf9862b4d06 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_configuration_names_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_configuration_names_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -63,7 +63,6 @@ def list( :type filter: str :param skip_token: OData skipToken option for pagination. Default value is None. :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ConfigurationNameItem or the result of cls(response) :rtype: @@ -87,16 +86,15 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( filter=filter, skip_token=skip_token, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -108,13 +106,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ConfigurationNameResult", pipeline_response) @@ -124,11 +122,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -140,5 +138,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ServiceLinker/configurationNames"} diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_connector_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_connector_operations.py index 951d8682e504..9029e79a7e7e 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_connector_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_connector_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -82,7 +82,6 @@ def list_dryrun( :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DryrunResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.DryrunResource] @@ -105,17 +104,16 @@ def list_dryrun( def prepare_request(next_link=None): if not next_link: - request = build_list_dryrun_request( + _request = build_list_dryrun_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, api_version=api_version, - template_url=self.list_dryrun.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -127,13 +125,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DryrunList", pipeline_response) @@ -143,11 +141,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -160,10 +158,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns" - } - @distributed_trace_async async def get_dryrun( self, subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any @@ -179,7 +173,6 @@ async def get_dryrun( :type location: str :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DryrunResource or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.DryrunResource :raises ~azure.core.exceptions.HttpResponseError: @@ -198,22 +191,21 @@ async def get_dryrun( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - request = build_get_dryrun_request( + _request = build_get_dryrun_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, dryrun_name=dryrun_name, api_version=api_version, - template_url=self.get_dryrun.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -226,13 +218,9 @@ async def get_dryrun( deserialized = self._deserialize("DryrunResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } + return deserialized # type: ignore async def _create_dryrun_initial( self, @@ -240,7 +228,7 @@ async def _create_dryrun_initial( resource_group_name: str, location: str, dryrun_name: str, - parameters: Union[_models.DryrunResource, IO], + parameters: Union[_models.DryrunResource, IO[bytes]], **kwargs: Any ) -> _models.DryrunResource: error_map = { @@ -266,7 +254,7 @@ async def _create_dryrun_initial( else: _json = self._serialize.body(parameters, "DryrunResource") - request = build_create_dryrun_request( + _request = build_create_dryrun_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, @@ -275,16 +263,15 @@ async def _create_dryrun_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_dryrun_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -305,10 +292,6 @@ async def _create_dryrun_initial( return deserialized # type: ignore - _create_dryrun_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - @overload async def begin_create_dryrun( self, @@ -337,14 +320,6 @@ async def begin_create_dryrun( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -358,7 +333,7 @@ async def begin_create_dryrun( resource_group_name: str, location: str, dryrun_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -375,18 +350,10 @@ async def begin_create_dryrun( :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str :param parameters: dryrun resource. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -400,7 +367,7 @@ async def begin_create_dryrun( resource_group_name: str, location: str, dryrun_name: str, - parameters: Union[_models.DryrunResource, IO], + parameters: Union[_models.DryrunResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DryrunResource]: """create a dryrun job to do necessary check before actual creation. @@ -414,19 +381,9 @@ async def begin_create_dryrun( :type location: str :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunResource type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: dryrun resource. Is either a DryrunResource type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -460,7 +417,7 @@ async def begin_create_dryrun( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DryrunResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -473,17 +430,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.DryrunResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } + return AsyncLROPoller[_models.DryrunResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_dryrun_initial( self, @@ -491,7 +446,7 @@ async def _update_dryrun_initial( resource_group_name: str, location: str, dryrun_name: str, - parameters: Union[_models.DryrunPatch, IO], + parameters: Union[_models.DryrunPatch, IO[bytes]], **kwargs: Any ) -> Optional[_models.DryrunResource]: error_map = { @@ -517,7 +472,7 @@ async def _update_dryrun_initial( else: _json = self._serialize.body(parameters, "DryrunPatch") - request = build_update_dryrun_request( + _request = build_update_dryrun_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, @@ -526,16 +481,15 @@ async def _update_dryrun_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_dryrun_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -550,13 +504,9 @@ async def _update_dryrun_initial( deserialized = self._deserialize("DryrunResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_dryrun_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } + return deserialized # type: ignore @overload async def begin_update_dryrun( @@ -586,14 +536,6 @@ async def begin_update_dryrun( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -607,7 +549,7 @@ async def begin_update_dryrun( resource_group_name: str, location: str, dryrun_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -624,18 +566,10 @@ async def begin_update_dryrun( :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str :param parameters: dryrun resource. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -649,7 +583,7 @@ async def begin_update_dryrun( resource_group_name: str, location: str, dryrun_name: str, - parameters: Union[_models.DryrunPatch, IO], + parameters: Union[_models.DryrunPatch, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DryrunResource]: """update a dryrun job to do necessary check before actual creation. @@ -663,19 +597,8 @@ async def begin_update_dryrun( :type location: str :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunPatch type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: dryrun resource. Is either a DryrunPatch type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch or IO[bytes] :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -709,7 +632,7 @@ async def begin_update_dryrun( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DryrunResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -722,17 +645,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.DryrunResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } + return AsyncLROPoller[_models.DryrunResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def delete_dryrun( # pylint: disable=inconsistent-return-statements @@ -749,7 +670,6 @@ async def delete_dryrun( # pylint: disable=inconsistent-return-statements :type location: str :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -768,22 +688,21 @@ async def delete_dryrun( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_dryrun_request( + _request = build_delete_dryrun_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, dryrun_name=dryrun_name, api_version=api_version, - template_url=self.delete_dryrun.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -794,11 +713,7 @@ async def delete_dryrun( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list( @@ -814,7 +729,6 @@ def list( :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LinkerResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.LinkerResource] @@ -837,17 +751,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -859,13 +772,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ResourceList", pipeline_response) @@ -875,11 +788,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -892,10 +805,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors" - } - @distributed_trace_async async def get( self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any @@ -911,7 +820,6 @@ async def get( :type location: str :param connector_name: The name of resource. Required. :type connector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LinkerResource or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.LinkerResource :raises ~azure.core.exceptions.HttpResponseError: @@ -930,22 +838,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, connector_name=connector_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -958,13 +865,9 @@ async def get( deserialized = self._deserialize("LinkerResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, @@ -972,7 +875,7 @@ async def _create_or_update_initial( resource_group_name: str, location: str, connector_name: str, - parameters: Union[_models.LinkerResource, IO], + parameters: Union[_models.LinkerResource, IO[bytes]], **kwargs: Any ) -> _models.LinkerResource: error_map = { @@ -998,7 +901,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "LinkerResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, @@ -1007,16 +910,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1037,10 +939,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - @overload async def begin_create_or_update( self, @@ -1069,14 +967,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -1090,7 +980,7 @@ async def begin_create_or_update( resource_group_name: str, location: str, connector_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1107,18 +997,10 @@ async def begin_create_or_update( :param connector_name: The name of resource. Required. :type connector_name: str :param parameters: Connector details. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -1132,7 +1014,7 @@ async def begin_create_or_update( resource_group_name: str, location: str, connector_name: str, - parameters: Union[_models.LinkerResource, IO], + parameters: Union[_models.LinkerResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.LinkerResource]: """Create or update Connector resource. @@ -1146,19 +1028,9 @@ async def begin_create_or_update( :type location: str :param connector_name: The name of resource. Required. :type connector_name: str - :param parameters: Connector details. Is either a LinkerResource type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Connector details. Is either a LinkerResource type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -1192,7 +1064,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("LinkerResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1205,17 +1077,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.LinkerResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } + return AsyncLROPoller[_models.LinkerResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any @@ -1234,22 +1104,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, connector_name=connector_name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1260,11 +1129,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -1281,14 +1146,6 @@ async def begin_delete( :type location: str :param connector_name: The name of resource. Required. :type connector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1317,7 +1174,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -1329,17 +1186,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _update_initial( self, @@ -1347,7 +1200,7 @@ async def _update_initial( resource_group_name: str, location: str, connector_name: str, - parameters: Union[_models.LinkerPatch, IO], + parameters: Union[_models.LinkerPatch, IO[bytes]], **kwargs: Any ) -> _models.LinkerResource: error_map = { @@ -1373,7 +1226,7 @@ async def _update_initial( else: _json = self._serialize.body(parameters, "LinkerPatch") - request = build_update_request( + _request = build_update_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, @@ -1382,16 +1235,15 @@ async def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1412,10 +1264,6 @@ async def _update_initial( return deserialized # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - @overload async def begin_update( self, @@ -1444,14 +1292,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -1465,7 +1305,7 @@ async def begin_update( resource_group_name: str, location: str, connector_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1482,18 +1322,10 @@ async def begin_update( :param connector_name: The name of resource. Required. :type connector_name: str :param parameters: Connector details. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -1507,7 +1339,7 @@ async def begin_update( resource_group_name: str, location: str, connector_name: str, - parameters: Union[_models.LinkerPatch, IO], + parameters: Union[_models.LinkerPatch, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.LinkerResource]: """Operation to update an existing Connector. @@ -1521,19 +1353,9 @@ async def begin_update( :type location: str :param connector_name: The name of resource. Required. :type connector_name: str - :param parameters: Connector details. Is either a LinkerPatch type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Connector details. Is either a LinkerPatch type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO[bytes] :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -1567,7 +1389,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("LinkerResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1580,17 +1402,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.LinkerResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } + return AsyncLROPoller[_models.LinkerResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _validate_initial( self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any @@ -1609,22 +1429,21 @@ async def _validate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ValidateOperationResult]] = kwargs.pop("cls", None) - request = build_validate_request( + _request = build_validate_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, connector_name=connector_name, api_version=api_version, - template_url=self._validate_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1639,13 +1458,9 @@ async def _validate_initial( deserialized = self._deserialize("ValidateOperationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _validate_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate" - } + return deserialized # type: ignore @distributed_trace_async async def begin_validate( @@ -1662,14 +1477,6 @@ async def begin_validate( :type location: str :param connector_name: The name of resource. Required. :type connector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ValidateOperationResult or the result of cls(response) :rtype: @@ -1701,7 +1508,7 @@ async def begin_validate( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ValidateOperationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1713,17 +1520,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ValidateOperationResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_validate.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate" - } + return AsyncLROPoller[_models.ValidateOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def generate_configurations( @@ -1753,7 +1558,6 @@ async def generate_configurations( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConfigurationResult or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: @@ -1766,7 +1570,7 @@ async def generate_configurations( resource_group_name: str, location: str, connector_name: str, - parameters: Optional[IO] = None, + parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -1783,11 +1587,10 @@ async def generate_configurations( :param connector_name: The name of resource. Required. :type connector_name: str :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConfigurationResult or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: @@ -1800,7 +1603,7 @@ async def generate_configurations( resource_group_name: str, location: str, connector_name: str, - parameters: Optional[Union[_models.ConfigurationInfo, IO]] = None, + parameters: Optional[Union[_models.ConfigurationInfo, IO[bytes]]] = None, **kwargs: Any ) -> _models.ConfigurationResult: """Generate configurations for a Connector. @@ -1815,12 +1618,8 @@ async def generate_configurations( :param connector_name: The name of resource. Required. :type connector_name: str :param parameters: Connection Info, including format, secret store, etc. Is either a - ConfigurationInfo type or a IO type. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ConfigurationInfo type or a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo or IO[bytes] :return: ConfigurationResult or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: @@ -1851,7 +1650,7 @@ async def generate_configurations( else: _json = None - request = build_generate_configurations_request( + _request = build_generate_configurations_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, @@ -1860,16 +1659,15 @@ async def generate_configurations( content_type=content_type, json=_json, content=_content, - template_url=self.generate_configurations.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1882,10 +1680,6 @@ async def generate_configurations( deserialized = self._deserialize("ConfigurationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - generate_configurations.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/generateConfigurations" - } + return deserialized # type: ignore diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py index aa7384572e73..2439c809ede3 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -72,7 +72,6 @@ def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.Linke :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LinkerResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.LinkerResource] @@ -95,15 +94,14 @@ def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.Linke def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_uri=resource_uri, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -115,13 +113,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ResourceList", pipeline_response) @@ -131,11 +129,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -148,8 +146,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers"} - @distributed_trace_async async def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.LinkerResource: """Returns Linker resource for a given name. @@ -159,7 +155,6 @@ async def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _mode :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LinkerResource or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.LinkerResource :raises ~azure.core.exceptions.HttpResponseError: @@ -178,20 +173,19 @@ async def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -204,14 +198,12 @@ async def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _mode deserialized = self._deserialize("LinkerResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} + return deserialized # type: ignore async def _create_or_update_initial( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerResource, IO], **kwargs: Any + self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerResource, IO[bytes]], **kwargs: Any ) -> _models.LinkerResource: error_map = { 401: ClientAuthenticationError, @@ -236,23 +228,22 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "LinkerResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -273,10 +264,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}" - } - @overload async def begin_create_or_update( self, @@ -299,14 +286,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -318,7 +297,7 @@ async def begin_create_or_update( self, resource_uri: str, linker_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -331,18 +310,10 @@ async def begin_create_or_update( :param linker_name: The name Linker resource. Required. :type linker_name: str :param parameters: Linker details. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -351,7 +322,7 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerResource, IO], **kwargs: Any + self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.LinkerResource]: """Create or update Linker resource. @@ -360,19 +331,9 @@ async def begin_create_or_update( :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_name: str - :param parameters: Linker details. Is either a LinkerResource type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Linker details. Is either a LinkerResource type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -404,7 +365,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("LinkerResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -417,15 +378,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.LinkerResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} + return AsyncLROPoller[_models.LinkerResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_uri: str, linker_name: str, **kwargs: Any @@ -444,20 +405,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -468,9 +428,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -481,14 +439,6 @@ async def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -515,7 +465,7 @@ async def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -527,18 +477,16 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _update_initial( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerPatch, IO], **kwargs: Any + self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerPatch, IO[bytes]], **kwargs: Any ) -> _models.LinkerResource: error_map = { 401: ClientAuthenticationError, @@ -563,23 +511,22 @@ async def _update_initial( else: _json = self._serialize.body(parameters, "LinkerPatch") - request = build_update_request( + _request = build_update_request( resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -600,8 +547,6 @@ async def _update_initial( return deserialized # type: ignore - _update_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} - @overload async def begin_update( self, @@ -624,14 +569,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -643,7 +580,7 @@ async def begin_update( self, resource_uri: str, linker_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -656,18 +593,10 @@ async def begin_update( :param linker_name: The name Linker resource. Required. :type linker_name: str :param parameters: Linker details. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -676,7 +605,7 @@ async def begin_update( @distributed_trace_async async def begin_update( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerPatch, IO], **kwargs: Any + self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerPatch, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.LinkerResource]: """Operation to update an existing Linker. @@ -685,19 +614,8 @@ async def begin_update( :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_name: str - :param parameters: Linker details. Is either a LinkerPatch type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Linker details. Is either a LinkerPatch type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO[bytes] :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -729,7 +647,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("LinkerResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -742,15 +660,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.LinkerResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} + return AsyncLROPoller[_models.LinkerResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _validate_initial( self, resource_uri: str, linker_name: str, **kwargs: Any @@ -769,20 +687,19 @@ async def _validate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ValidateOperationResult]] = kwargs.pop("cls", None) - request = build_validate_request( + _request = build_validate_request( resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, - template_url=self._validate_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -797,13 +714,9 @@ async def _validate_initial( deserialized = self._deserialize("ValidateOperationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _validate_initial.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/validateLinker" - } + return deserialized # type: ignore @distributed_trace_async async def begin_validate( @@ -816,14 +729,6 @@ async def begin_validate( :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ValidateOperationResult or the result of cls(response) :rtype: @@ -853,7 +758,7 @@ async def begin_validate( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ValidateOperationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -865,17 +770,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ValidateOperationResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_validate.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/validateLinker" - } + return AsyncLROPoller[_models.ValidateOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def list_configurations( @@ -888,7 +791,6 @@ async def list_configurations( :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConfigurationResult or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: @@ -907,20 +809,19 @@ async def list_configurations( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConfigurationResult] = kwargs.pop("cls", None) - request = build_list_configurations_request( + _request = build_list_configurations_request( resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, - template_url=self.list_configurations.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -933,10 +834,6 @@ async def list_configurations( deserialized = self._deserialize("ConfigurationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_configurations.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/listConfigurations" - } + return deserialized # type: ignore diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linkers_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linkers_operations.py index e0882cbe48c2..edb69299dc25 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linkers_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linkers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -71,7 +71,6 @@ def list_dryrun(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_model :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DryrunResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.DryrunResource] @@ -94,15 +93,14 @@ def list_dryrun(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_model def prepare_request(next_link=None): if not next_link: - request = build_list_dryrun_request( + _request = build_list_dryrun_request( resource_uri=resource_uri, api_version=api_version, - template_url=self.list_dryrun.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -114,13 +112,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DryrunList", pipeline_response) @@ -130,11 +128,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -147,8 +145,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns"} - @distributed_trace_async async def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) -> _models.DryrunResource: """get a dryrun job. @@ -158,7 +154,6 @@ async def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) - :type resource_uri: str :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DryrunResource or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.DryrunResource :raises ~azure.core.exceptions.HttpResponseError: @@ -177,20 +172,19 @@ async def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - request = build_get_dryrun_request( + _request = build_get_dryrun_request( resource_uri=resource_uri, dryrun_name=dryrun_name, api_version=api_version, - template_url=self.get_dryrun.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -203,14 +197,12 @@ async def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) - deserialized = self._deserialize("DryrunResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} + return deserialized # type: ignore async def _create_dryrun_initial( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO], **kwargs: Any + self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO[bytes]], **kwargs: Any ) -> _models.DryrunResource: error_map = { 401: ClientAuthenticationError, @@ -235,23 +227,22 @@ async def _create_dryrun_initial( else: _json = self._serialize.body(parameters, "DryrunResource") - request = build_create_dryrun_request( + _request = build_create_dryrun_request( resource_uri=resource_uri, dryrun_name=dryrun_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_dryrun_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -272,8 +263,6 @@ async def _create_dryrun_initial( return deserialized # type: ignore - _create_dryrun_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - @overload async def begin_create_dryrun( self, @@ -296,14 +285,6 @@ async def begin_create_dryrun( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -315,7 +296,7 @@ async def begin_create_dryrun( self, resource_uri: str, dryrun_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -328,18 +309,10 @@ async def begin_create_dryrun( :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str :param parameters: dryrun resource. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -348,7 +321,7 @@ async def begin_create_dryrun( @distributed_trace_async async def begin_create_dryrun( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO], **kwargs: Any + self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DryrunResource]: """create a dryrun job to do necessary check before actual creation. @@ -357,19 +330,9 @@ async def begin_create_dryrun( :type resource_uri: str :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunResource type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: dryrun resource. Is either a DryrunResource type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -401,7 +364,7 @@ async def begin_create_dryrun( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DryrunResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -414,18 +377,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.DryrunResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} + return AsyncLROPoller[_models.DryrunResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_dryrun_initial( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO], **kwargs: Any + self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO[bytes]], **kwargs: Any ) -> Optional[_models.DryrunResource]: error_map = { 401: ClientAuthenticationError, @@ -450,23 +413,22 @@ async def _update_dryrun_initial( else: _json = self._serialize.body(parameters, "DryrunPatch") - request = build_update_dryrun_request( + _request = build_update_dryrun_request( resource_uri=resource_uri, dryrun_name=dryrun_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._update_dryrun_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -481,11 +443,9 @@ async def _update_dryrun_initial( deserialized = self._deserialize("DryrunResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_dryrun_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} + return deserialized # type: ignore @overload async def begin_update_dryrun( @@ -509,14 +469,6 @@ async def begin_update_dryrun( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -528,7 +480,7 @@ async def begin_update_dryrun( self, resource_uri: str, dryrun_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -541,18 +493,10 @@ async def begin_update_dryrun( :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str :param parameters: dryrun resource. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -561,7 +505,7 @@ async def begin_update_dryrun( @distributed_trace_async async def begin_update_dryrun( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO], **kwargs: Any + self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DryrunResource]: """add a dryrun job to do necessary check before actual creation. @@ -570,19 +514,8 @@ async def begin_update_dryrun( :type resource_uri: str :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunPatch type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: dryrun resource. Is either a DryrunPatch type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch or IO[bytes] :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -614,7 +547,7 @@ async def begin_update_dryrun( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DryrunResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -627,15 +560,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.DryrunResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} + return AsyncLROPoller[_models.DryrunResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def delete_dryrun( # pylint: disable=inconsistent-return-statements @@ -648,7 +581,6 @@ async def delete_dryrun( # pylint: disable=inconsistent-return-statements :type resource_uri: str :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -667,20 +599,19 @@ async def delete_dryrun( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_dryrun_request( + _request = build_delete_dryrun_request( resource_uri=resource_uri, dryrun_name=dryrun_name, api_version=api_version, - template_url=self.delete_dryrun.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -691,9 +622,7 @@ async def delete_dryrun( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} + return cls(pipeline_response, None, {}) # type: ignore @overload async def generate_configurations( @@ -717,7 +646,6 @@ async def generate_configurations( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConfigurationResult or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: @@ -728,7 +656,7 @@ async def generate_configurations( self, resource_uri: str, linker_name: str, - parameters: Optional[IO] = None, + parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -741,11 +669,10 @@ async def generate_configurations( :param linker_name: The name Linker resource. Required. :type linker_name: str :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConfigurationResult or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: @@ -756,7 +683,7 @@ async def generate_configurations( self, resource_uri: str, linker_name: str, - parameters: Optional[Union[_models.ConfigurationInfo, IO]] = None, + parameters: Optional[Union[_models.ConfigurationInfo, IO[bytes]]] = None, **kwargs: Any ) -> _models.ConfigurationResult: """Generate configurations for a Linker. @@ -767,12 +694,8 @@ async def generate_configurations( :param linker_name: The name Linker resource. Required. :type linker_name: str :param parameters: Connection Info, including format, secret store, etc. Is either a - ConfigurationInfo type or a IO type. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ConfigurationInfo type or a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo or IO[bytes] :return: ConfigurationResult or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: @@ -803,23 +726,22 @@ async def generate_configurations( else: _json = None - request = build_generate_configurations_request( + _request = build_generate_configurations_request( resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.generate_configurations.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -832,13 +754,9 @@ async def generate_configurations( deserialized = self._deserialize("ConfigurationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - generate_configurations.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/generateConfigurations" - } + return deserialized # type: ignore @distributed_trace def list_dapr_configurations( @@ -849,7 +767,6 @@ def list_dapr_configurations( :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DaprConfigurationResource or the result of cls(response) :rtype: @@ -873,15 +790,14 @@ def list_dapr_configurations( def prepare_request(next_link=None): if not next_link: - request = build_list_dapr_configurations_request( + _request = build_list_dapr_configurations_request( resource_uri=resource_uri, api_version=api_version, - template_url=self.list_dapr_configurations.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -893,13 +809,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DaprConfigurationList", pipeline_response) @@ -909,11 +825,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -925,5 +841,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_dapr_configurations.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/daprConfigurations"} diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py index 672ca4560ab8..e8c4d1d1c2aa 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -56,7 +56,6 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """Lists the available ServiceLinker REST API operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -78,14 +77,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -97,13 +95,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -113,11 +111,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -129,5 +127,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ServiceLinker/operations"} diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py index 7ae228143b04..a55609cf8935 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py @@ -25,7 +25,7 @@ class AuthInfoBase(_serialization.Model): ServicePrincipalCertificateAuthInfo, ServicePrincipalSecretAuthInfo, SystemAssignedIdentityAuthInfo, UserAccountAuthInfo, UserAssignedIdentityAuthInfo - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", @@ -77,7 +77,7 @@ class AccessKeyInfoBase(AuthInfoBase): """The access key directly from target resource properties, which target service is Azure Resource, such as Microsoft.Storage. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", @@ -133,7 +133,7 @@ class AzureResourcePropertiesBase(_serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: AzureKeyVaultProperties - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: The azure resource type. Required. "KeyVault" :vartype type: str or ~azure.mgmt.servicelinker.models.AzureResourceType @@ -158,7 +158,7 @@ def __init__(self, **kwargs: Any) -> None: class AzureKeyVaultProperties(AzureResourcePropertiesBase): """The resource properties when type is Azure Key Vault. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: The azure resource type. Required. "KeyVault" :vartype type: str or ~azure.mgmt.servicelinker.models.AzureResourceType @@ -191,7 +191,7 @@ class TargetServiceBase(_serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: AzureResource, ConfluentBootstrapServer, ConfluentSchemaRegistry, SelfHostedServer - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: The target service type. Required. Known values are: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry", and "SelfHostedServer". @@ -224,7 +224,7 @@ def __init__(self, **kwargs: Any) -> None: class AzureResource(TargetServiceBase): """The azure resource info when target service type is AzureResource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: The target service type. Required. Known values are: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry", and "SelfHostedServer". @@ -270,7 +270,7 @@ class DryrunPrerequisiteResult(_serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: BasicErrorDryrunPrerequisiteResult, PermissionsMissingDryrunPrerequisiteResult - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: The type of dryrun result. Required. Known values are: "basicError" and "permissionsMissing". @@ -301,7 +301,7 @@ def __init__(self, **kwargs: Any) -> None: class BasicErrorDryrunPrerequisiteResult(DryrunPrerequisiteResult): """The represent of basic error. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: The type of dryrun result. Required. Known values are: "basicError" and "permissionsMissing". @@ -603,7 +603,7 @@ def __init__(self, *, app_configuration_id: Optional[str] = None, **kwargs: Any) class ConfluentBootstrapServer(TargetServiceBase): """The service properties when target service type is ConfluentBootstrapServer. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: The target service type. Required. Known values are: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry", and "SelfHostedServer". @@ -634,7 +634,7 @@ def __init__(self, *, endpoint: Optional[str] = None, **kwargs: Any) -> None: class ConfluentSchemaRegistry(TargetServiceBase): """The service properties when target service type is ConfluentSchemaRegistry. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: The target service type. Required. Known values are: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry", and "SelfHostedServer". @@ -758,7 +758,7 @@ class DryrunParameters(_serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: CreateOrUpdateDryrunParameters - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar action_name: The name of action for you dryrun job. Required. "createOrUpdate" :vartype action_name: str or ~azure.mgmt.servicelinker.models.DryrunActionName @@ -785,7 +785,7 @@ class CreateOrUpdateDryrunParameters(DryrunParameters, LinkerProperties): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar target_service: The target service properties. :vartype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase @@ -1238,7 +1238,7 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1280,7 +1280,7 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1292,24 +1292,6 @@ class ProxyResource(Resource): :vartype system_data: ~azure.mgmt.servicelinker.models.SystemData """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - class DryrunResource(ProxyResource): """a dryrun job resource. @@ -1317,7 +1299,7 @@ class DryrunResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1373,7 +1355,7 @@ def __init__(self, *, parameters: Optional["_models.DryrunParameters"] = None, * class EasyAuthMicrosoftEntraIDAuthInfo(AuthInfoBase): """The authentication info when authType is EasyAuth Microsoft Entra ID. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", @@ -1582,7 +1564,7 @@ class SecretInfoBase(_serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: KeyVaultSecretReferenceSecretInfo, KeyVaultSecretUriSecretInfo, ValueSecretInfo - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar secret_type: The secret type. Required. Known values are: "rawValue", "keyVaultSecretUri", and "keyVaultSecretReference". @@ -1616,7 +1598,7 @@ class KeyVaultSecretReferenceSecretInfo(SecretInfoBase): secret stored in user's keyvault and source is Azure Kubernetes. The key Vault's resource id is linked to secretStore.keyVaultId. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar secret_type: The secret type. Required. Known values are: "rawValue", "keyVaultSecretUri", and "keyVaultSecretReference". @@ -1654,7 +1636,7 @@ class KeyVaultSecretUriSecretInfo(SecretInfoBase): """The secret info when type is keyVaultSecretUri. It's for scenario that user provides a secret stored in user's keyvault and source is Web App, Spring Cloud or Container App. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar secret_type: The secret type. Required. Known values are: "rawValue", "keyVaultSecretUri", and "keyVaultSecretReference". @@ -1778,7 +1760,7 @@ class LinkerResource(ProxyResource): # pylint: disable=too-many-instance-attrib Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2002,10 +1984,10 @@ def __init__(self, **kwargs: Any) -> None: self.next_link = None -class PermissionsMissingDryrunPrerequisiteResult(DryrunPrerequisiteResult): +class PermissionsMissingDryrunPrerequisiteResult(DryrunPrerequisiteResult): # pylint: disable=name-too-long """The represent of missing permissions. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: The type of dryrun result. Required. Known values are: "basicError" and "permissionsMissing". @@ -2134,7 +2116,7 @@ def __init__( class SecretAuthInfo(AuthInfoBase): """The authentication info when authType is secret. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", @@ -2220,7 +2202,7 @@ def __init__( class SelfHostedServer(TargetServiceBase): """The service properties when target service type is SelfHostedServer. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: The target service type. Required. Known values are: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry", and "SelfHostedServer". @@ -2251,7 +2233,7 @@ def __init__(self, *, endpoint: Optional[str] = None, **kwargs: Any) -> None: class ServicePrincipalCertificateAuthInfo(AuthInfoBase): """The authentication info when authType is servicePrincipal certificate. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", @@ -2335,7 +2317,7 @@ def __init__( class ServicePrincipalSecretAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): """The authentication info when authType is servicePrincipal secret. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar user_name: Username created in the database which is mapped to a user in AAD. :vartype user_name: str @@ -2485,7 +2467,7 @@ def __init__( class SystemAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): """The authentication info when authType is systemAssignedIdentity. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar user_name: Username created in the database which is mapped to a user in AAD. :vartype user_name: str @@ -2617,7 +2599,7 @@ def __init__( class UserAccountAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): """The authentication info when authType is user account. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar user_name: Username created in the database which is mapped to a user in AAD. :vartype user_name: str @@ -2692,7 +2674,7 @@ def __init__( class UserAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): """The authentication info when authType is userAssignedIdentity. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar user_name: Username created in the database which is mapped to a user in AAD. :vartype user_name: str @@ -2922,7 +2904,7 @@ def __init__( class ValueSecretInfo(SecretInfoBase): """The secret info when type is rawValue. It's for scenarios that user input the secret. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar secret_type: The secret type. Required. Known values are: "rawValue", "keyVaultSecretUri", and "keyVaultSecretReference". diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_configuration_names_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_configuration_names_operations.py index 1de85a3f646d..6527692b2292 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_configuration_names_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_configuration_names_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -89,7 +89,6 @@ def list( :type filter: str :param skip_token: OData skipToken option for pagination. Default value is None. :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ConfigurationNameItem or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.ConfigurationNameItem] @@ -112,16 +111,15 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( filter=filter, skip_token=skip_token, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -133,13 +131,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ConfigurationNameResult", pipeline_response) @@ -149,11 +147,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -165,5 +163,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ServiceLinker/configurationNames"} diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_connector_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_connector_operations.py index 0bd59922ca38..02c15f26db39 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_connector_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_connector_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -490,7 +490,6 @@ def list_dryrun( :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DryrunResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.DryrunResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -512,17 +511,16 @@ def list_dryrun( def prepare_request(next_link=None): if not next_link: - request = build_list_dryrun_request( + _request = build_list_dryrun_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, api_version=api_version, - template_url=self.list_dryrun.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -534,13 +532,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DryrunList", pipeline_response) @@ -550,11 +548,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -567,10 +565,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns" - } - @distributed_trace def get_dryrun( self, subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any @@ -586,7 +580,6 @@ def get_dryrun( :type location: str :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DryrunResource or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.DryrunResource :raises ~azure.core.exceptions.HttpResponseError: @@ -605,22 +598,21 @@ def get_dryrun( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - request = build_get_dryrun_request( + _request = build_get_dryrun_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, dryrun_name=dryrun_name, api_version=api_version, - template_url=self.get_dryrun.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -633,13 +625,9 @@ def get_dryrun( deserialized = self._deserialize("DryrunResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } + return deserialized # type: ignore def _create_dryrun_initial( self, @@ -647,7 +635,7 @@ def _create_dryrun_initial( resource_group_name: str, location: str, dryrun_name: str, - parameters: Union[_models.DryrunResource, IO], + parameters: Union[_models.DryrunResource, IO[bytes]], **kwargs: Any ) -> _models.DryrunResource: error_map = { @@ -673,7 +661,7 @@ def _create_dryrun_initial( else: _json = self._serialize.body(parameters, "DryrunResource") - request = build_create_dryrun_request( + _request = build_create_dryrun_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, @@ -682,16 +670,15 @@ def _create_dryrun_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_dryrun_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -712,10 +699,6 @@ def _create_dryrun_initial( return deserialized # type: ignore - _create_dryrun_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - @overload def begin_create_dryrun( self, @@ -744,14 +727,6 @@ def begin_create_dryrun( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -765,7 +740,7 @@ def begin_create_dryrun( resource_group_name: str, location: str, dryrun_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -782,18 +757,10 @@ def begin_create_dryrun( :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str :param parameters: dryrun resource. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -807,7 +774,7 @@ def begin_create_dryrun( resource_group_name: str, location: str, dryrun_name: str, - parameters: Union[_models.DryrunResource, IO], + parameters: Union[_models.DryrunResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.DryrunResource]: """create a dryrun job to do necessary check before actual creation. @@ -821,19 +788,9 @@ def begin_create_dryrun( :type location: str :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunResource type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: dryrun resource. Is either a DryrunResource type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource or IO[bytes] :return: An instance of LROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -867,7 +824,7 @@ def begin_create_dryrun( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DryrunResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -879,17 +836,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.DryrunResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } + return LROPoller[_models.DryrunResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_dryrun_initial( self, @@ -897,7 +852,7 @@ def _update_dryrun_initial( resource_group_name: str, location: str, dryrun_name: str, - parameters: Union[_models.DryrunPatch, IO], + parameters: Union[_models.DryrunPatch, IO[bytes]], **kwargs: Any ) -> Optional[_models.DryrunResource]: error_map = { @@ -923,7 +878,7 @@ def _update_dryrun_initial( else: _json = self._serialize.body(parameters, "DryrunPatch") - request = build_update_dryrun_request( + _request = build_update_dryrun_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, @@ -932,16 +887,15 @@ def _update_dryrun_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_dryrun_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -956,13 +910,9 @@ def _update_dryrun_initial( deserialized = self._deserialize("DryrunResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_dryrun_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } + return deserialized # type: ignore @overload def begin_update_dryrun( @@ -992,14 +942,6 @@ def begin_update_dryrun( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -1013,7 +955,7 @@ def begin_update_dryrun( resource_group_name: str, location: str, dryrun_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1030,18 +972,10 @@ def begin_update_dryrun( :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str :param parameters: dryrun resource. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -1055,7 +989,7 @@ def begin_update_dryrun( resource_group_name: str, location: str, dryrun_name: str, - parameters: Union[_models.DryrunPatch, IO], + parameters: Union[_models.DryrunPatch, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.DryrunResource]: """update a dryrun job to do necessary check before actual creation. @@ -1069,19 +1003,8 @@ def begin_update_dryrun( :type location: str :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunPatch type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: dryrun resource. Is either a DryrunPatch type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch or IO[bytes] :return: An instance of LROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -1115,7 +1038,7 @@ def begin_update_dryrun( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DryrunResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1127,17 +1050,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.DryrunResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } + return LROPoller[_models.DryrunResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def delete_dryrun( # pylint: disable=inconsistent-return-statements @@ -1154,7 +1075,6 @@ def delete_dryrun( # pylint: disable=inconsistent-return-statements :type location: str :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1173,22 +1093,21 @@ def delete_dryrun( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_dryrun_request( + _request = build_delete_dryrun_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, dryrun_name=dryrun_name, api_version=api_version, - template_url=self.delete_dryrun.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1199,11 +1118,7 @@ def delete_dryrun( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list( @@ -1219,7 +1134,6 @@ def list( :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LinkerResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.LinkerResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -1241,17 +1155,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1263,13 +1176,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ResourceList", pipeline_response) @@ -1279,11 +1192,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1296,10 +1209,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors" - } - @distributed_trace def get( self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any @@ -1315,7 +1224,6 @@ def get( :type location: str :param connector_name: The name of resource. Required. :type connector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LinkerResource or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.LinkerResource :raises ~azure.core.exceptions.HttpResponseError: @@ -1334,22 +1242,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, connector_name=connector_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1362,13 +1269,9 @@ def get( deserialized = self._deserialize("LinkerResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, @@ -1376,7 +1279,7 @@ def _create_or_update_initial( resource_group_name: str, location: str, connector_name: str, - parameters: Union[_models.LinkerResource, IO], + parameters: Union[_models.LinkerResource, IO[bytes]], **kwargs: Any ) -> _models.LinkerResource: error_map = { @@ -1402,7 +1305,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "LinkerResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, @@ -1411,16 +1314,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1441,10 +1343,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - @overload def begin_create_or_update( self, @@ -1473,14 +1371,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -1494,7 +1384,7 @@ def begin_create_or_update( resource_group_name: str, location: str, connector_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1511,18 +1401,10 @@ def begin_create_or_update( :param connector_name: The name of resource. Required. :type connector_name: str :param parameters: Connector details. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -1536,7 +1418,7 @@ def begin_create_or_update( resource_group_name: str, location: str, connector_name: str, - parameters: Union[_models.LinkerResource, IO], + parameters: Union[_models.LinkerResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.LinkerResource]: """Create or update Connector resource. @@ -1550,19 +1432,9 @@ def begin_create_or_update( :type location: str :param connector_name: The name of resource. Required. :type connector_name: str - :param parameters: Connector details. Is either a LinkerResource type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Connector details. Is either a LinkerResource type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource or IO[bytes] :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -1596,7 +1468,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("LinkerResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1608,17 +1480,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.LinkerResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } + return LROPoller[_models.LinkerResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any @@ -1637,22 +1507,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, connector_name=connector_name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1663,11 +1532,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -1684,14 +1549,6 @@ def begin_delete( :type location: str :param connector_name: The name of resource. Required. :type connector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1720,7 +1577,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1731,17 +1588,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _update_initial( self, @@ -1749,7 +1602,7 @@ def _update_initial( resource_group_name: str, location: str, connector_name: str, - parameters: Union[_models.LinkerPatch, IO], + parameters: Union[_models.LinkerPatch, IO[bytes]], **kwargs: Any ) -> _models.LinkerResource: error_map = { @@ -1775,7 +1628,7 @@ def _update_initial( else: _json = self._serialize.body(parameters, "LinkerPatch") - request = build_update_request( + _request = build_update_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, @@ -1784,16 +1637,15 @@ def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1814,10 +1666,6 @@ def _update_initial( return deserialized # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - @overload def begin_update( self, @@ -1846,14 +1694,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -1867,7 +1707,7 @@ def begin_update( resource_group_name: str, location: str, connector_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1884,18 +1724,10 @@ def begin_update( :param connector_name: The name of resource. Required. :type connector_name: str :param parameters: Connector details. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -1909,7 +1741,7 @@ def begin_update( resource_group_name: str, location: str, connector_name: str, - parameters: Union[_models.LinkerPatch, IO], + parameters: Union[_models.LinkerPatch, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.LinkerResource]: """Operation to update an existing Connector. @@ -1923,19 +1755,9 @@ def begin_update( :type location: str :param connector_name: The name of resource. Required. :type connector_name: str - :param parameters: Connector details. Is either a LinkerPatch type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Connector details. Is either a LinkerPatch type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO[bytes] :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -1969,7 +1791,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("LinkerResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1981,17 +1803,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.LinkerResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } + return LROPoller[_models.LinkerResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _validate_initial( self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any @@ -2010,22 +1830,21 @@ def _validate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ValidateOperationResult]] = kwargs.pop("cls", None) - request = build_validate_request( + _request = build_validate_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, connector_name=connector_name, api_version=api_version, - template_url=self._validate_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2040,13 +1859,9 @@ def _validate_initial( deserialized = self._deserialize("ValidateOperationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _validate_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate" - } + return deserialized # type: ignore @distributed_trace def begin_validate( @@ -2063,14 +1878,6 @@ def begin_validate( :type location: str :param connector_name: The name of resource. Required. :type connector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ValidateOperationResult or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.ValidateOperationResult] @@ -2101,7 +1908,7 @@ def begin_validate( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ValidateOperationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -2113,17 +1920,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ValidateOperationResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_validate.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate" - } + return LROPoller[_models.ValidateOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def generate_configurations( @@ -2153,7 +1958,6 @@ def generate_configurations( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConfigurationResult or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: @@ -2166,7 +1970,7 @@ def generate_configurations( resource_group_name: str, location: str, connector_name: str, - parameters: Optional[IO] = None, + parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -2183,11 +1987,10 @@ def generate_configurations( :param connector_name: The name of resource. Required. :type connector_name: str :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConfigurationResult or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: @@ -2200,7 +2003,7 @@ def generate_configurations( resource_group_name: str, location: str, connector_name: str, - parameters: Optional[Union[_models.ConfigurationInfo, IO]] = None, + parameters: Optional[Union[_models.ConfigurationInfo, IO[bytes]]] = None, **kwargs: Any ) -> _models.ConfigurationResult: """Generate configurations for a Connector. @@ -2215,12 +2018,8 @@ def generate_configurations( :param connector_name: The name of resource. Required. :type connector_name: str :param parameters: Connection Info, including format, secret store, etc. Is either a - ConfigurationInfo type or a IO type. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ConfigurationInfo type or a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo or IO[bytes] :return: ConfigurationResult or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: @@ -2251,7 +2050,7 @@ def generate_configurations( else: _json = None - request = build_generate_configurations_request( + _request = build_generate_configurations_request( subscription_id=subscription_id, resource_group_name=resource_group_name, location=location, @@ -2260,16 +2059,15 @@ def generate_configurations( content_type=content_type, json=_json, content=_content, - template_url=self.generate_configurations.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2282,10 +2080,6 @@ def generate_configurations( deserialized = self._deserialize("ConfigurationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - generate_configurations.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/generateConfigurations" - } + return deserialized # type: ignore diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py index 0d940a434140..5c59758de9f5 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -250,7 +250,6 @@ def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.LinkerReso :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LinkerResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.LinkerResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -272,15 +271,14 @@ def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.LinkerReso def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_uri=resource_uri, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -292,13 +290,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ResourceList", pipeline_response) @@ -308,11 +306,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -325,8 +323,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers"} - @distributed_trace def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.LinkerResource: """Returns Linker resource for a given name. @@ -336,7 +332,6 @@ def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.Lin :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LinkerResource or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.LinkerResource :raises ~azure.core.exceptions.HttpResponseError: @@ -355,20 +350,19 @@ def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.Lin api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -381,14 +375,12 @@ def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.Lin deserialized = self._deserialize("LinkerResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} + return deserialized # type: ignore def _create_or_update_initial( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerResource, IO], **kwargs: Any + self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerResource, IO[bytes]], **kwargs: Any ) -> _models.LinkerResource: error_map = { 401: ClientAuthenticationError, @@ -413,23 +405,22 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "LinkerResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -450,10 +441,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}" - } - @overload def begin_create_or_update( self, @@ -476,14 +463,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -495,7 +474,7 @@ def begin_create_or_update( self, resource_uri: str, linker_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -508,18 +487,10 @@ def begin_create_or_update( :param linker_name: The name Linker resource. Required. :type linker_name: str :param parameters: Linker details. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -528,7 +499,7 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerResource, IO], **kwargs: Any + self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.LinkerResource]: """Create or update Linker resource. @@ -537,19 +508,9 @@ def begin_create_or_update( :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_name: str - :param parameters: Linker details. Is either a LinkerResource type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Linker details. Is either a LinkerResource type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource or IO[bytes] :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -581,7 +542,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("LinkerResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -593,15 +554,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.LinkerResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} + return LROPoller[_models.LinkerResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_uri: str, linker_name: str, **kwargs: Any @@ -620,20 +581,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -644,9 +604,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) -> LROPoller[None]: @@ -657,14 +615,6 @@ def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) -> LR :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -691,7 +641,7 @@ def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) -> LR def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -702,18 +652,16 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _update_initial( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerPatch, IO], **kwargs: Any + self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerPatch, IO[bytes]], **kwargs: Any ) -> _models.LinkerResource: error_map = { 401: ClientAuthenticationError, @@ -738,23 +686,22 @@ def _update_initial( else: _json = self._serialize.body(parameters, "LinkerPatch") - request = build_update_request( + _request = build_update_request( resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -775,8 +722,6 @@ def _update_initial( return deserialized # type: ignore - _update_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} - @overload def begin_update( self, @@ -799,14 +744,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -818,7 +755,7 @@ def begin_update( self, resource_uri: str, linker_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -831,18 +768,10 @@ def begin_update( :param linker_name: The name Linker resource. Required. :type linker_name: str :param parameters: Linker details. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -851,7 +780,7 @@ def begin_update( @distributed_trace def begin_update( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerPatch, IO], **kwargs: Any + self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerPatch, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.LinkerResource]: """Operation to update an existing Linker. @@ -860,19 +789,8 @@ def begin_update( :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_name: str - :param parameters: Linker details. Is either a LinkerPatch type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Linker details. Is either a LinkerPatch type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO[bytes] :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] @@ -904,7 +822,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("LinkerResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -916,15 +834,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.LinkerResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} + return LROPoller[_models.LinkerResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _validate_initial( self, resource_uri: str, linker_name: str, **kwargs: Any @@ -943,20 +861,19 @@ def _validate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ValidateOperationResult]] = kwargs.pop("cls", None) - request = build_validate_request( + _request = build_validate_request( resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, - template_url=self._validate_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -971,13 +888,9 @@ def _validate_initial( deserialized = self._deserialize("ValidateOperationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _validate_initial.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/validateLinker" - } + return deserialized # type: ignore @distributed_trace def begin_validate( @@ -990,14 +903,6 @@ def begin_validate( :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ValidateOperationResult or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.ValidateOperationResult] @@ -1026,7 +931,7 @@ def begin_validate( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ValidateOperationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1038,17 +943,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ValidateOperationResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_validate.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/validateLinker" - } + return LROPoller[_models.ValidateOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_configurations(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.ConfigurationResult: @@ -1059,7 +962,6 @@ def list_configurations(self, resource_uri: str, linker_name: str, **kwargs: Any :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConfigurationResult or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: @@ -1078,20 +980,19 @@ def list_configurations(self, resource_uri: str, linker_name: str, **kwargs: Any api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConfigurationResult] = kwargs.pop("cls", None) - request = build_list_configurations_request( + _request = build_list_configurations_request( resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, - template_url=self.list_configurations.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1104,10 +1005,6 @@ def list_configurations(self, resource_uri: str, linker_name: str, **kwargs: Any deserialized = self._deserialize("ConfigurationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_configurations.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/listConfigurations" - } + return deserialized # type: ignore diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linkers_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linkers_operations.py index e8f0a14de846..4b435a8fe7ce 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linkers_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linkers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -249,7 +249,6 @@ def list_dryrun(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.Dry :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DryrunResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.DryrunResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -271,15 +270,14 @@ def list_dryrun(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.Dry def prepare_request(next_link=None): if not next_link: - request = build_list_dryrun_request( + _request = build_list_dryrun_request( resource_uri=resource_uri, api_version=api_version, - template_url=self.list_dryrun.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -291,13 +289,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DryrunList", pipeline_response) @@ -307,11 +305,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -324,8 +322,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns"} - @distributed_trace def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) -> _models.DryrunResource: """get a dryrun job. @@ -335,7 +331,6 @@ def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) -> _mod :type resource_uri: str :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DryrunResource or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.DryrunResource :raises ~azure.core.exceptions.HttpResponseError: @@ -354,20 +349,19 @@ def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) -> _mod api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - request = build_get_dryrun_request( + _request = build_get_dryrun_request( resource_uri=resource_uri, dryrun_name=dryrun_name, api_version=api_version, - template_url=self.get_dryrun.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -380,14 +374,12 @@ def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) -> _mod deserialized = self._deserialize("DryrunResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} + return deserialized # type: ignore def _create_dryrun_initial( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO], **kwargs: Any + self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO[bytes]], **kwargs: Any ) -> _models.DryrunResource: error_map = { 401: ClientAuthenticationError, @@ -412,23 +404,22 @@ def _create_dryrun_initial( else: _json = self._serialize.body(parameters, "DryrunResource") - request = build_create_dryrun_request( + _request = build_create_dryrun_request( resource_uri=resource_uri, dryrun_name=dryrun_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_dryrun_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -449,8 +440,6 @@ def _create_dryrun_initial( return deserialized # type: ignore - _create_dryrun_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - @overload def begin_create_dryrun( self, @@ -473,14 +462,6 @@ def begin_create_dryrun( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -492,7 +473,7 @@ def begin_create_dryrun( self, resource_uri: str, dryrun_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -505,18 +486,10 @@ def begin_create_dryrun( :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str :param parameters: dryrun resource. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -525,7 +498,7 @@ def begin_create_dryrun( @distributed_trace def begin_create_dryrun( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO], **kwargs: Any + self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.DryrunResource]: """create a dryrun job to do necessary check before actual creation. @@ -534,19 +507,9 @@ def begin_create_dryrun( :type resource_uri: str :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunResource type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: dryrun resource. Is either a DryrunResource type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource or IO[bytes] :return: An instance of LROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -578,7 +541,7 @@ def begin_create_dryrun( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DryrunResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -590,18 +553,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.DryrunResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} + return LROPoller[_models.DryrunResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_dryrun_initial( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO], **kwargs: Any + self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO[bytes]], **kwargs: Any ) -> Optional[_models.DryrunResource]: error_map = { 401: ClientAuthenticationError, @@ -626,23 +589,22 @@ def _update_dryrun_initial( else: _json = self._serialize.body(parameters, "DryrunPatch") - request = build_update_dryrun_request( + _request = build_update_dryrun_request( resource_uri=resource_uri, dryrun_name=dryrun_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._update_dryrun_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -657,11 +619,9 @@ def _update_dryrun_initial( deserialized = self._deserialize("DryrunResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_dryrun_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} + return deserialized # type: ignore @overload def begin_update_dryrun( @@ -685,14 +645,6 @@ def begin_update_dryrun( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -704,7 +656,7 @@ def begin_update_dryrun( self, resource_uri: str, dryrun_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -717,18 +669,10 @@ def begin_update_dryrun( :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str :param parameters: dryrun resource. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -737,7 +681,7 @@ def begin_update_dryrun( @distributed_trace def begin_update_dryrun( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO], **kwargs: Any + self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.DryrunResource]: """add a dryrun job to do necessary check before actual creation. @@ -746,19 +690,8 @@ def begin_update_dryrun( :type resource_uri: str :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunPatch type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: dryrun resource. Is either a DryrunPatch type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch or IO[bytes] :return: An instance of LROPoller that returns either DryrunResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] @@ -790,7 +723,7 @@ def begin_update_dryrun( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DryrunResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -802,15 +735,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.DryrunResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} + return LROPoller[_models.DryrunResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def delete_dryrun( # pylint: disable=inconsistent-return-statements @@ -823,7 +756,6 @@ def delete_dryrun( # pylint: disable=inconsistent-return-statements :type resource_uri: str :param dryrun_name: The name of dryrun. Required. :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -842,20 +774,19 @@ def delete_dryrun( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_dryrun_request( + _request = build_delete_dryrun_request( resource_uri=resource_uri, dryrun_name=dryrun_name, api_version=api_version, - template_url=self.delete_dryrun.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -866,9 +797,7 @@ def delete_dryrun( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} + return cls(pipeline_response, None, {}) # type: ignore @overload def generate_configurations( @@ -892,7 +821,6 @@ def generate_configurations( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConfigurationResult or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: @@ -903,7 +831,7 @@ def generate_configurations( self, resource_uri: str, linker_name: str, - parameters: Optional[IO] = None, + parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -916,11 +844,10 @@ def generate_configurations( :param linker_name: The name Linker resource. Required. :type linker_name: str :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConfigurationResult or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: @@ -931,7 +858,7 @@ def generate_configurations( self, resource_uri: str, linker_name: str, - parameters: Optional[Union[_models.ConfigurationInfo, IO]] = None, + parameters: Optional[Union[_models.ConfigurationInfo, IO[bytes]]] = None, **kwargs: Any ) -> _models.ConfigurationResult: """Generate configurations for a Linker. @@ -942,12 +869,8 @@ def generate_configurations( :param linker_name: The name Linker resource. Required. :type linker_name: str :param parameters: Connection Info, including format, secret store, etc. Is either a - ConfigurationInfo type or a IO type. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ConfigurationInfo type or a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo or IO[bytes] :return: ConfigurationResult or the result of cls(response) :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: @@ -978,23 +901,22 @@ def generate_configurations( else: _json = None - request = build_generate_configurations_request( + _request = build_generate_configurations_request( resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.generate_configurations.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1007,13 +929,9 @@ def generate_configurations( deserialized = self._deserialize("ConfigurationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - generate_configurations.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/generateConfigurations" - } + return deserialized # type: ignore @distributed_trace def list_dapr_configurations( @@ -1024,7 +942,6 @@ def list_dapr_configurations( :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DaprConfigurationResource or the result of cls(response) :rtype: @@ -1048,15 +965,14 @@ def list_dapr_configurations( def prepare_request(next_link=None): if not next_link: - request = build_list_dapr_configurations_request( + _request = build_list_dapr_configurations_request( resource_uri=resource_uri, api_version=api_version, - template_url=self.list_dapr_configurations.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1068,13 +984,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DaprConfigurationList", pipeline_response) @@ -1084,11 +1000,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1100,5 +1016,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_dapr_configurations.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/daprConfigurations"} diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py index 501a3a17324c..8a4cdd7fc58b 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -78,7 +78,6 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """Lists the available ServiceLinker REST API operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -100,14 +99,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +117,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -135,11 +133,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,5 +149,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ServiceLinker/operations"} diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/configuration_names_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/configuration_names_list.py index 18b07075b19e..aecf43be11eb 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/configuration_names_list.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/configuration_names_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_create.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_create.py index e7b1deb07625..d8e7709e7fba 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_create.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_delete.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_delete.py index 78364a23cd36..9f18063d73c4 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_delete.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_get.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_get.py index 8fdc973509c4..94682869f841 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_get.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_list.py index ca39bef4454d..996d28c99d71 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_list.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_update.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_update.py index 1ada6f82ebf5..d93757ea34fd 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_update.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_list.py index 948b5188d330..e409490f2f1e 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_list.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connectors.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connectors.py index bbfa71d15593..ae1c851d9bb6 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connectors.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connectors.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_connector.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_connector.py index aeec7f5aadf2..96b4636e3dca 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_connector.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_connector.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_dryrun.py index 802f49a1b93f..35c31ee67356 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_dryrun.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_dryrun.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_linker.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_linker.py index 481d5b2369bc..8d7ddad5e7ea 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_linker.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_linker.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/generate_configurations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/generate_configurations.py index bec2a04b9fb6..63dddf823761 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/generate_configurations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/generate_configurations.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_configurations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_configurations.py index cd568016859b..33aca750739c 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_configurations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_configurations.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dapr_configurations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dapr_configurations.py index 27b3f7042e14..850886163ff4 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dapr_configurations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dapr_configurations.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dryrun.py index b6f4c545bd08..e68f3b9af1b3 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dryrun.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dryrun.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker.py index 17af45e5f777..0b2536d6a894 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_generate_configurations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_generate_configurations.py index 72e5867916b7..a928b074c75d 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_generate_configurations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_generate_configurations.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_list.py index bdb2e3910a05..36c473d47bd6 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_list.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/list_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/list_dryrun.py index b08bd47c3b00..4315ea455025 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/list_dryrun.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/list_dryrun.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/operations_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/operations_list.py index 886ff5129dc4..d0655ccc6226 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/operations_list.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/operations_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_connector.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_connector.py index 0390b71a75bb..de6949bb4f25 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_connector.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_connector.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_dryrun.py index 268679c3fa45..3b646fe1a93e 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_dryrun.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_dryrun.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_linker.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_linker.py index fc86f70ac479..540af7c479e7 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_linker.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_linker.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_connector.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_connector.py index 797ad53c067f..3cb30512975e 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_connector.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_connector.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_dryrun.py index dd63b35c1b95..d691e86b86e0 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_dryrun.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_dryrun.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_linker.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_linker.py index 2e0d51c400f7..0fcde84db489 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_linker.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_linker.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_connector_success.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_connector_success.py index 7c52662c44d2..230b114c2767 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_connector_success.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_connector_success.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_linker_success.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_linker_success.py index 4c0053398e65..af5be30d2782 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_linker_success.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_linker_success.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/setup.py b/sdk/servicelinker/azure-mgmt-servicelinker/setup.py index 2b410cf24d40..d59453bb65bc 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/setup.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/setup.py @@ -74,9 +74,9 @@ "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", + "isodate>=0.6.1", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], python_requires=">=3.8", )