diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/README.md b/sdk/healthcareapis/azure-mgmt-healthcareapis/README.md index 093ee194768a..91dd4e6bf550 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/README.md +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Health Care Apis Management Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.8+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.8+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/_meta.json b/sdk/healthcareapis/azure-mgmt-healthcareapis/_meta.json index eae54078f6e4..cb9809b6acb7 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/_meta.json +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/_meta.json @@ -1,11 +1,11 @@ { - "commit": "583e15ceb4cf23dc23b2300bd352f16d781e69ac", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "commit": "28b3e8c2bfc50273b06998178f0bca2da75e6073", + "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/healthcareapis/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/healthcareapis/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/healthcareapis/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_configuration.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_configuration.py index 7954d874ed74..5b3eb7fafc85 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_configuration.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_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 HealthcareApisManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class HealthcareApisManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for HealthcareApisManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +28,13 @@ class HealthcareApisManagementClientConfiguration(Configuration): # pylint: dis :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(HealthcareApisManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-11-01") + api_version: str = kwargs.pop("api_version", "2024-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-healthcareapis/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,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/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_healthcare_apis_management_client.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_healthcare_apis_management_client.py index 4a8ce2e6ecac..b27a2da31479 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_healthcare_apis_management_client.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_healthcare_apis_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 HealthcareApisManagementClientConfiguration @@ -77,7 +79,7 @@ class HealthcareApisManagementClient: # pylint: disable=client-accepts-api-vers :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -94,7 +96,25 @@ def __init__( self._config = HealthcareApisManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **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) @@ -128,7 +148,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 @@ -148,7 +168,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/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_serialization.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_serialization.py index 4bae2292227b..2f781d740827 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_serialization.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_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/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_version.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_version.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_configuration.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_configuration.py index 2b126a1d5db1..6402ec0bbc12 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_configuration.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/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 HealthcareApisManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class HealthcareApisManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for HealthcareApisManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +28,13 @@ class HealthcareApisManagementClientConfiguration(Configuration): # pylint: dis :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(HealthcareApisManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-11-01") + api_version: str = kwargs.pop("api_version", "2024-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-healthcareapis/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,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/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_healthcare_apis_management_client.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_healthcare_apis_management_client.py index 30fe4f4e484d..ffa892003957 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_healthcare_apis_management_client.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_healthcare_apis_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 @@ -77,7 +79,7 @@ class HealthcareApisManagementClient: # pylint: disable=client-accepts-api-vers :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -94,7 +96,25 @@ def __init__( self._config = HealthcareApisManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **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) @@ -128,7 +148,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 @@ -148,7 +170,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/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_dicom_services_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_dicom_services_operations.py index f1d3dd6fb89b..bc93fb6d17da 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_dicom_services_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_dicom_services_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. @@ -73,7 +73,6 @@ def list_by_workspace( :type resource_group_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DicomService or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.DicomService] :raises ~azure.core.exceptions.HttpResponseError: @@ -95,17 +94,16 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - request = build_list_by_workspace_request( + _request = build_list_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_workspace.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 @@ -117,13 +115,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("DicomServiceCollection", pipeline_response) @@ -133,11 +131,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 @@ -150,10 +148,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices" - } - @distributed_trace_async async def get( self, resource_group_name: str, workspace_name: str, dicom_service_name: str, **kwargs: Any @@ -167,7 +161,6 @@ async def get( :type workspace_name: str :param dicom_service_name: The name of DICOM Service resource. Required. :type dicom_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DicomService or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.DicomService :raises ~azure.core.exceptions.HttpResponseError: @@ -186,22 +179,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DicomService] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, dicom_service_name=dicom_service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -214,20 +206,16 @@ async def get( deserialized = self._deserialize("DicomService", 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.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, workspace_name: str, dicom_service_name: str, - dicomservice: Union[_models.DicomService, IO], + dicomservice: Union[_models.DicomService, IO[bytes]], **kwargs: Any ) -> _models.DicomService: error_map = { @@ -253,7 +241,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(dicomservice, "DicomService") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, dicom_service_name=dicom_service_name, @@ -262,16 +250,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 @@ -295,10 +282,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}" - } - @overload async def begin_create_or_update( self, @@ -325,14 +308,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 DicomService or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.DicomService] @@ -345,7 +320,7 @@ async def begin_create_or_update( resource_group_name: str, workspace_name: str, dicom_service_name: str, - dicomservice: IO, + dicomservice: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -361,18 +336,10 @@ async def begin_create_or_update( :type dicom_service_name: str :param dicomservice: The parameters for creating or updating a Dicom Service resource. Required. - :type dicomservice: IO + :type dicomservice: 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 DicomService or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.DicomService] @@ -385,7 +352,7 @@ async def begin_create_or_update( resource_group_name: str, workspace_name: str, dicom_service_name: str, - dicomservice: Union[_models.DicomService, IO], + dicomservice: Union[_models.DicomService, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DicomService]: """Creates or updates a DICOM Service resource with the specified parameters. @@ -398,19 +365,8 @@ async def begin_create_or_update( :param dicom_service_name: The name of DICOM Service resource. Required. :type dicom_service_name: str :param dicomservice: The parameters for creating or updating a Dicom Service resource. Is - either a DicomService type or a IO type. Required. - :type dicomservice: ~azure.mgmt.healthcareapis.models.DicomService 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. + either a DicomService type or a IO[bytes] type. Required. + :type dicomservice: ~azure.mgmt.healthcareapis.models.DicomService or IO[bytes] :return: An instance of AsyncLROPoller that returns either DicomService or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.DicomService] @@ -443,7 +399,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DicomService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -453,24 +409,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.DicomService].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.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}" - } + return AsyncLROPoller[_models.DicomService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, resource_group_name: str, dicom_service_name: str, workspace_name: str, - dicomservice_patch_resource: Union[_models.DicomServicePatchResource, IO], + dicomservice_patch_resource: Union[_models.DicomServicePatchResource, IO[bytes]], **kwargs: Any ) -> _models.DicomService: error_map = { @@ -496,7 +450,7 @@ async def _update_initial( else: _json = self._serialize.body(dicomservice_patch_resource, "DicomServicePatchResource") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, dicom_service_name=dicom_service_name, workspace_name=workspace_name, @@ -505,16 +459,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 @@ -535,10 +488,6 @@ async def _update_initial( return deserialized # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}" - } - @overload async def begin_update( self, @@ -564,14 +513,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 DicomService or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.DicomService] @@ -584,7 +525,7 @@ async def begin_update( resource_group_name: str, dicom_service_name: str, workspace_name: str, - dicomservice_patch_resource: IO, + dicomservice_patch_resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -599,18 +540,10 @@ async def begin_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param dicomservice_patch_resource: The parameters for updating a Dicom Service. Required. - :type dicomservice_patch_resource: IO + :type dicomservice_patch_resource: 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 DicomService or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.DicomService] @@ -623,7 +556,7 @@ async def begin_update( resource_group_name: str, dicom_service_name: str, workspace_name: str, - dicomservice_patch_resource: Union[_models.DicomServicePatchResource, IO], + dicomservice_patch_resource: Union[_models.DicomServicePatchResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DicomService]: """Patch DICOM Service details. @@ -636,20 +569,9 @@ async def begin_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param dicomservice_patch_resource: The parameters for updating a Dicom Service. Is either a - DicomServicePatchResource type or a IO type. Required. + DicomServicePatchResource type or a IO[bytes] type. Required. :type dicomservice_patch_resource: ~azure.mgmt.healthcareapis.models.DicomServicePatchResource - 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. + or IO[bytes] :return: An instance of AsyncLROPoller that returns either DicomService or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.DicomService] @@ -682,7 +604,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DicomService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -692,17 +614,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.DicomService].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.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}" - } + return AsyncLROPoller[_models.DicomService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dicom_service_name: str, workspace_name: str, **kwargs: Any @@ -721,22 +641,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( resource_group_name=resource_group_name, dicom_service_name=dicom_service_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -747,11 +666,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.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -766,14 +681,6 @@ async def begin_delete( :type dicom_service_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_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: @@ -801,7 +708,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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -810,14 +717,10 @@ 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.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_destinations_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_destinations_operations.py index 7b5a3fe12532..3b55f914a1d6 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_destinations_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_destinations_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. @@ -65,7 +65,6 @@ def list_by_iot_connector( :type workspace_name: str :param iot_connector_name: The name of IoT Connector resource. Required. :type iot_connector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotFhirDestination or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.IotFhirDestination] @@ -88,18 +87,17 @@ def list_by_iot_connector( def prepare_request(next_link=None): if not next_link: - request = build_list_by_iot_connector_request( + _request = build_list_by_iot_connector_request( resource_group_name=resource_group_name, workspace_name=workspace_name, iot_connector_name=iot_connector_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_iot_connector.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 @@ -111,13 +109,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("IotFhirDestinationCollection", pipeline_response) @@ -127,11 +125,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 @@ -143,7 +141,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_iot_connector.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations" - } diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_services_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_services_operations.py index 25104df87610..b49fbd65a295 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_services_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_services_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. @@ -73,7 +73,6 @@ def list_by_workspace( :type resource_group_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FhirService or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.FhirService] :raises ~azure.core.exceptions.HttpResponseError: @@ -95,17 +94,16 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - request = build_list_by_workspace_request( + _request = build_list_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_workspace.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 @@ -117,13 +115,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("FhirServiceCollection", pipeline_response) @@ -133,11 +131,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 @@ -150,10 +148,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices" - } - @distributed_trace_async async def get( self, resource_group_name: str, workspace_name: str, fhir_service_name: str, **kwargs: Any @@ -167,7 +161,6 @@ async def get( :type workspace_name: str :param fhir_service_name: The name of FHIR Service resource. Required. :type fhir_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FhirService or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.FhirService :raises ~azure.core.exceptions.HttpResponseError: @@ -186,22 +179,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FhirService] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, fhir_service_name=fhir_service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -214,20 +206,16 @@ async def get( deserialized = self._deserialize("FhirService", 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.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, workspace_name: str, fhir_service_name: str, - fhirservice: Union[_models.FhirService, IO], + fhirservice: Union[_models.FhirService, IO[bytes]], **kwargs: Any ) -> _models.FhirService: error_map = { @@ -253,7 +241,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(fhirservice, "FhirService") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, fhir_service_name=fhir_service_name, @@ -262,16 +250,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 @@ -295,10 +282,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}" - } - @overload async def begin_create_or_update( self, @@ -324,14 +307,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 FhirService or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.FhirService] @@ -344,7 +319,7 @@ async def begin_create_or_update( resource_group_name: str, workspace_name: str, fhir_service_name: str, - fhirservice: IO, + fhirservice: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -359,18 +334,10 @@ async def begin_create_or_update( :param fhir_service_name: The name of FHIR Service resource. Required. :type fhir_service_name: str :param fhirservice: The parameters for creating or updating a Fhir Service resource. Required. - :type fhirservice: IO + :type fhirservice: 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 FhirService or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.FhirService] @@ -383,7 +350,7 @@ async def begin_create_or_update( resource_group_name: str, workspace_name: str, fhir_service_name: str, - fhirservice: Union[_models.FhirService, IO], + fhirservice: Union[_models.FhirService, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.FhirService]: """Creates or updates a FHIR Service resource with the specified parameters. @@ -396,19 +363,8 @@ async def begin_create_or_update( :param fhir_service_name: The name of FHIR Service resource. Required. :type fhir_service_name: str :param fhirservice: The parameters for creating or updating a Fhir Service resource. Is either - a FhirService type or a IO type. Required. - :type fhirservice: ~azure.mgmt.healthcareapis.models.FhirService 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. + a FhirService type or a IO[bytes] type. Required. + :type fhirservice: ~azure.mgmt.healthcareapis.models.FhirService or IO[bytes] :return: An instance of AsyncLROPoller that returns either FhirService or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.FhirService] @@ -441,7 +397,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("FhirService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -451,24 +407,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.FhirService].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.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}" - } + return AsyncLROPoller[_models.FhirService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, resource_group_name: str, fhir_service_name: str, workspace_name: str, - fhirservice_patch_resource: Union[_models.FhirServicePatchResource, IO], + fhirservice_patch_resource: Union[_models.FhirServicePatchResource, IO[bytes]], **kwargs: Any ) -> _models.FhirService: error_map = { @@ -494,7 +448,7 @@ async def _update_initial( else: _json = self._serialize.body(fhirservice_patch_resource, "FhirServicePatchResource") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, fhir_service_name=fhir_service_name, workspace_name=workspace_name, @@ -503,16 +457,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 @@ -533,10 +486,6 @@ async def _update_initial( return deserialized # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}" - } - @overload async def begin_update( self, @@ -562,14 +511,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 FhirService or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.FhirService] @@ -582,7 +523,7 @@ async def begin_update( resource_group_name: str, fhir_service_name: str, workspace_name: str, - fhirservice_patch_resource: IO, + fhirservice_patch_resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -597,18 +538,10 @@ async def begin_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param fhirservice_patch_resource: The parameters for updating a Fhir Service. Required. - :type fhirservice_patch_resource: IO + :type fhirservice_patch_resource: 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 FhirService or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.FhirService] @@ -621,7 +554,7 @@ async def begin_update( resource_group_name: str, fhir_service_name: str, workspace_name: str, - fhirservice_patch_resource: Union[_models.FhirServicePatchResource, IO], + fhirservice_patch_resource: Union[_models.FhirServicePatchResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.FhirService]: """Patch FHIR Service details. @@ -634,20 +567,9 @@ async def begin_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param fhirservice_patch_resource: The parameters for updating a Fhir Service. Is either a - FhirServicePatchResource type or a IO type. Required. + FhirServicePatchResource type or a IO[bytes] type. Required. :type fhirservice_patch_resource: ~azure.mgmt.healthcareapis.models.FhirServicePatchResource 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. + IO[bytes] :return: An instance of AsyncLROPoller that returns either FhirService or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.FhirService] @@ -680,7 +602,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("FhirService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -690,17 +612,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.FhirService].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.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}" - } + return AsyncLROPoller[_models.FhirService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, fhir_service_name: str, workspace_name: str, **kwargs: Any @@ -719,22 +639,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( resource_group_name=resource_group_name, fhir_service_name=fhir_service_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -745,11 +664,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.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -764,14 +679,6 @@ async def begin_delete( :type fhir_service_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_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: @@ -799,7 +706,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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -808,14 +715,10 @@ 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.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connector_fhir_destination_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connector_fhir_destination_operations.py index f743432d25a0..c3f6f19ee93d 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connector_fhir_destination_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connector_fhir_destination_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. @@ -77,7 +77,6 @@ async def get( :type iot_connector_name: str :param fhir_destination_name: The name of IoT Connector FHIR destination resource. Required. :type fhir_destination_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IotFhirDestination or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.IotFhirDestination :raises ~azure.core.exceptions.HttpResponseError: @@ -96,23 +95,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IotFhirDestination] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, iot_connector_name=iot_connector_name, fhir_destination_name=fhir_destination_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -125,13 +123,9 @@ async def get( deserialized = self._deserialize("IotFhirDestination", 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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, @@ -139,7 +133,7 @@ async def _create_or_update_initial( workspace_name: str, iot_connector_name: str, fhir_destination_name: str, - iot_fhir_destination: Union[_models.IotFhirDestination, IO], + iot_fhir_destination: Union[_models.IotFhirDestination, IO[bytes]], **kwargs: Any ) -> _models.IotFhirDestination: error_map = { @@ -165,7 +159,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(iot_fhir_destination, "IotFhirDestination") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, iot_connector_name=iot_connector_name, @@ -175,16 +169,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 @@ -208,10 +201,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}" - } - @overload async def begin_create_or_update( self, @@ -241,14 +230,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 IotFhirDestination or the result of cls(response) :rtype: @@ -263,7 +244,7 @@ async def begin_create_or_update( workspace_name: str, iot_connector_name: str, fhir_destination_name: str, - iot_fhir_destination: IO, + iot_fhir_destination: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -281,18 +262,10 @@ async def begin_create_or_update( :type fhir_destination_name: str :param iot_fhir_destination: The parameters for creating or updating an IoT Connector FHIR destination resource. Required. - :type iot_fhir_destination: IO + :type iot_fhir_destination: 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 IotFhirDestination or the result of cls(response) :rtype: @@ -307,7 +280,7 @@ async def begin_create_or_update( workspace_name: str, iot_connector_name: str, fhir_destination_name: str, - iot_fhir_destination: Union[_models.IotFhirDestination, IO], + iot_fhir_destination: Union[_models.IotFhirDestination, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.IotFhirDestination]: """Creates or updates an IoT Connector FHIR destination resource with the specified parameters. @@ -322,19 +295,8 @@ async def begin_create_or_update( :param fhir_destination_name: The name of IoT Connector FHIR destination resource. Required. :type fhir_destination_name: str :param iot_fhir_destination: The parameters for creating or updating an IoT Connector FHIR - destination resource. Is either a IotFhirDestination type or a IO type. Required. - :type iot_fhir_destination: ~azure.mgmt.healthcareapis.models.IotFhirDestination 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. + destination resource. Is either a IotFhirDestination type or a IO[bytes] type. Required. + :type iot_fhir_destination: ~azure.mgmt.healthcareapis.models.IotFhirDestination or IO[bytes] :return: An instance of AsyncLROPoller that returns either IotFhirDestination or the result of cls(response) :rtype: @@ -369,7 +331,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("IotFhirDestination", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -379,17 +341,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.IotFhirDestination].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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}" - } + return AsyncLROPoller[_models.IotFhirDestination]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -413,23 +373,22 @@ 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_group_name=resource_group_name, workspace_name=workspace_name, iot_connector_name=iot_connector_name, fhir_destination_name=fhir_destination_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -440,11 +399,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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -466,14 +421,6 @@ async def begin_delete( :type iot_connector_name: str :param fhir_destination_name: The name of IoT Connector FHIR destination resource. Required. :type fhir_destination_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: @@ -502,7 +449,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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -511,14 +458,10 @@ 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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connectors_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connectors_operations.py index baeb5d33b761..873217c5d194 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connectors_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connectors_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. @@ -73,7 +73,6 @@ def list_by_workspace( :type resource_group_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotConnector or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.IotConnector] :raises ~azure.core.exceptions.HttpResponseError: @@ -95,17 +94,16 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - request = build_list_by_workspace_request( + _request = build_list_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_workspace.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 @@ -117,13 +115,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("IotConnectorCollection", pipeline_response) @@ -133,11 +131,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 @@ -150,10 +148,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors" - } - @distributed_trace_async async def get( self, resource_group_name: str, workspace_name: str, iot_connector_name: str, **kwargs: Any @@ -167,7 +161,6 @@ async def get( :type workspace_name: str :param iot_connector_name: The name of IoT Connector resource. Required. :type iot_connector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IotConnector or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.IotConnector :raises ~azure.core.exceptions.HttpResponseError: @@ -186,22 +179,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IotConnector] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, iot_connector_name=iot_connector_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -214,20 +206,16 @@ async def get( deserialized = self._deserialize("IotConnector", 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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, workspace_name: str, iot_connector_name: str, - iot_connector: Union[_models.IotConnector, IO], + iot_connector: Union[_models.IotConnector, IO[bytes]], **kwargs: Any ) -> _models.IotConnector: error_map = { @@ -253,7 +241,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(iot_connector, "IotConnector") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, iot_connector_name=iot_connector_name, @@ -262,16 +250,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 @@ -295,10 +282,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}" - } - @overload async def begin_create_or_update( self, @@ -325,14 +308,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 IotConnector or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.IotConnector] @@ -345,7 +320,7 @@ async def begin_create_or_update( resource_group_name: str, workspace_name: str, iot_connector_name: str, - iot_connector: IO, + iot_connector: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -361,18 +336,10 @@ async def begin_create_or_update( :type iot_connector_name: str :param iot_connector: The parameters for creating or updating an IoT Connectors resource. Required. - :type iot_connector: IO + :type iot_connector: 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 IotConnector or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.IotConnector] @@ -385,7 +352,7 @@ async def begin_create_or_update( resource_group_name: str, workspace_name: str, iot_connector_name: str, - iot_connector: Union[_models.IotConnector, IO], + iot_connector: Union[_models.IotConnector, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.IotConnector]: """Creates or updates an IoT Connector resource with the specified parameters. @@ -398,19 +365,8 @@ async def begin_create_or_update( :param iot_connector_name: The name of IoT Connector resource. Required. :type iot_connector_name: str :param iot_connector: The parameters for creating or updating an IoT Connectors resource. Is - either a IotConnector type or a IO type. Required. - :type iot_connector: ~azure.mgmt.healthcareapis.models.IotConnector 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. + either a IotConnector type or a IO[bytes] type. Required. + :type iot_connector: ~azure.mgmt.healthcareapis.models.IotConnector or IO[bytes] :return: An instance of AsyncLROPoller that returns either IotConnector or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.IotConnector] @@ -443,7 +399,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("IotConnector", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -453,24 +409,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.IotConnector].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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}" - } + return AsyncLROPoller[_models.IotConnector]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, resource_group_name: str, iot_connector_name: str, workspace_name: str, - iot_connector_patch_resource: Union[_models.IotConnectorPatchResource, IO], + iot_connector_patch_resource: Union[_models.IotConnectorPatchResource, IO[bytes]], **kwargs: Any ) -> _models.IotConnector: error_map = { @@ -496,7 +450,7 @@ async def _update_initial( else: _json = self._serialize.body(iot_connector_patch_resource, "IotConnectorPatchResource") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, iot_connector_name=iot_connector_name, workspace_name=workspace_name, @@ -505,16 +459,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 @@ -535,10 +488,6 @@ async def _update_initial( return deserialized # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}" - } - @overload async def begin_update( self, @@ -564,14 +513,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 IotConnector or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.IotConnector] @@ -584,7 +525,7 @@ async def begin_update( resource_group_name: str, iot_connector_name: str, workspace_name: str, - iot_connector_patch_resource: IO, + iot_connector_patch_resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -599,18 +540,10 @@ async def begin_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param iot_connector_patch_resource: The parameters for updating an IoT Connector. Required. - :type iot_connector_patch_resource: IO + :type iot_connector_patch_resource: 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 IotConnector or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.IotConnector] @@ -623,7 +556,7 @@ async def begin_update( resource_group_name: str, iot_connector_name: str, workspace_name: str, - iot_connector_patch_resource: Union[_models.IotConnectorPatchResource, IO], + iot_connector_patch_resource: Union[_models.IotConnectorPatchResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.IotConnector]: """Patch an IoT Connector. @@ -636,20 +569,9 @@ async def begin_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param iot_connector_patch_resource: The parameters for updating an IoT Connector. Is either a - IotConnectorPatchResource type or a IO type. Required. + IotConnectorPatchResource type or a IO[bytes] type. Required. :type iot_connector_patch_resource: ~azure.mgmt.healthcareapis.models.IotConnectorPatchResource - 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. + or IO[bytes] :return: An instance of AsyncLROPoller that returns either IotConnector or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.IotConnector] @@ -682,7 +604,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("IotConnector", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -692,17 +614,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.IotConnector].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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}" - } + return AsyncLROPoller[_models.IotConnector]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, iot_connector_name: str, workspace_name: str, **kwargs: Any @@ -721,22 +641,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( resource_group_name=resource_group_name, iot_connector_name=iot_connector_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -747,11 +666,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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -766,14 +681,6 @@ async def begin_delete( :type iot_connector_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_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: @@ -801,7 +708,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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -810,14 +717,10 @@ 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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_operation_results_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_operation_results_operations.py index 8a8dda5a000a..a12553b570ab 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_operation_results_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_operation_results_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. @@ -60,7 +60,6 @@ async def get( :type location_name: str :param operation_result_id: The ID of the operation result to get. Required. :type operation_result_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationResultsDescription or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.OperationResultsDescription :raises ~azure.core.exceptions.HttpResponseError: @@ -79,21 +78,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationResultsDescription] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( location_name=location_name, operation_result_id=operation_result_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -106,10 +104,6 @@ async def get( deserialized = self._deserialize("OperationResultsDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/locations/{locationName}/operationresults/{operationResultId}" - } + return deserialized # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_operations.py index 45d30c1b881f..13991e5f6229 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/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.OperationDetail"]: """Lists all of the available operations supported by Microsoft Healthcare resource provider. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationDetail or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.OperationDetail] @@ -79,14 +78,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: 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 @@ -98,13 +96,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("ListOperations", pipeline_response) @@ -114,11 +112,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 @@ -130,5 +128,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.HealthcareApis/operations"} diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_private_endpoint_connections_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_private_endpoint_connections_operations.py index 7162c6f86d24..c56f07998301 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_private_endpoint_connections_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_by_service( :type resource_group_name: str :param resource_name: The name of the service instance. Required. :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnectionDescription or the result of cls(response) :rtype: @@ -96,17 +95,16 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.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 @@ -118,13 +116,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("PrivateEndpointConnectionListResultDescription", pipeline_response) @@ -134,11 +132,11 @@ async def extract_data(pipeline_response): return 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 @@ -151,10 +149,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections" - } - @distributed_trace_async async def get( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -169,7 +163,6 @@ async def get( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionDescription or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionDescription :raises ~azure.core.exceptions.HttpResponseError: @@ -188,22 +181,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionDescription] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -216,20 +208,16 @@ async def get( deserialized = self._deserialize("PrivateEndpointConnectionDescription", 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.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO], + properties: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnectionDescription: error_map = { @@ -255,7 +243,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(properties, "PrivateEndpointConnection") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -264,16 +252,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 @@ -286,13 +273,9 @@ async def _create_or_update_initial( deserialized = self._deserialize("PrivateEndpointConnectionDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -320,14 +303,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 PrivateEndpointConnectionDescription or the result of cls(response) :rtype: @@ -341,7 +316,7 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -357,18 +332,10 @@ async def begin_create_or_update( with the Azure resource. Required. :type private_endpoint_connection_name: str :param properties: The private endpoint connection properties. Required. - :type properties: IO + :type properties: 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 PrivateEndpointConnectionDescription or the result of cls(response) :rtype: @@ -382,7 +349,7 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO], + properties: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PrivateEndpointConnectionDescription]: """Update the state of the specified private endpoint connection associated with the service. @@ -396,19 +363,8 @@ async def begin_create_or_update( with the Azure resource. Required. :type private_endpoint_connection_name: str :param properties: The private endpoint connection properties. Is either a - PrivateEndpointConnection type or a IO type. Required. - :type properties: ~azure.mgmt.healthcareapis.models.PrivateEndpointConnection 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. + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.healthcareapis.models.PrivateEndpointConnection or IO[bytes] :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnectionDescription or the result of cls(response) :rtype: @@ -442,7 +398,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -452,17 +408,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PrivateEndpointConnectionDescription].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.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return AsyncLROPoller[_models.PrivateEndpointConnectionDescription]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -481,22 +435,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( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -507,11 +460,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.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -527,14 +476,6 @@ async def begin_delete( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_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: @@ -562,7 +503,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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -571,14 +512,10 @@ 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.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_private_link_resources_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_private_link_resources_operations.py index 4a76d1dd9e2e..35476875185d 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_private_link_resources_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_private_link_resources_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. @@ -61,7 +61,6 @@ async def list_by_service( :type resource_group_name: str :param resource_name: The name of the service instance. Required. :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResourceListResultDescription or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.PrivateLinkResourceListResultDescription :raises ~azure.core.exceptions.HttpResponseError: @@ -80,21 +79,20 @@ async def list_by_service( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResultDescription] = kwargs.pop("cls", None) - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.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 @@ -107,13 +105,9 @@ async def list_by_service( deserialized = self._deserialize("PrivateLinkResourceListResultDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateLinkResources" - } + return deserialized # type: ignore @distributed_trace_async async def get( @@ -128,7 +122,6 @@ async def get( :type resource_name: str :param group_name: The name of the private link resource group. Required. :type group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResourceDescription or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.PrivateLinkResourceDescription :raises ~azure.core.exceptions.HttpResponseError: @@ -147,22 +140,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceDescription] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, resource_name=resource_name, group_name=group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -175,10 +167,6 @@ async def get( deserialized = self._deserialize("PrivateLinkResourceDescription", 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.HealthcareApis/services/{resourceName}/privateLinkResources/{groupName}" - } + return deserialized # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_services_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_services_operations.py index 989333e8bf55..0e0afc586885 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_services_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_services_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. @@ -33,7 +33,6 @@ from ..._vendor import _convert_request from ...operations._services_operations import ( build_check_name_availability_request, - build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, @@ -73,7 +72,6 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :type resource_group_name: str :param resource_name: The name of the service instance. Required. :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServicesDescription or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.ServicesDescription :raises ~azure.core.exceptions.HttpResponseError: @@ -92,21 +90,20 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServicesDescription] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -118,249 +115,16 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) deserialized = self._deserialize("ServicesDescription", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}" - } - - async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - service_description: Union[_models.ServicesDescription, IO], - **kwargs: Any - ) -> _models.ServicesDescription: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServicesDescription] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(service_description, (IOBase, bytes)): - _content = service_description - else: - _json = self._serialize.body(service_description, "ServicesDescription") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("ServicesDescription", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ServicesDescription", pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}" - } - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - service_description: _models.ServicesDescription, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ServicesDescription]: - """Create or update the metadata of a service instance. - - :param resource_group_name: The name of the resource group that contains the service instance. - Required. - :type resource_group_name: str - :param resource_name: The name of the service instance. Required. - :type resource_name: str - :param service_description: The service instance metadata. Required. - :type service_description: ~azure.mgmt.healthcareapis.models.ServicesDescription - :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 ServicesDescription or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.ServicesDescription] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - service_description: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ServicesDescription]: - """Create or update the metadata of a service instance. - - :param resource_group_name: The name of the resource group that contains the service instance. - Required. - :type resource_group_name: str - :param resource_name: The name of the service instance. Required. - :type resource_name: str - :param service_description: The service instance metadata. Required. - :type service_description: IO - :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 ServicesDescription or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.ServicesDescription] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - service_description: Union[_models.ServicesDescription, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.ServicesDescription]: - """Create or update the metadata of a service instance. - - :param resource_group_name: The name of the resource group that contains the service instance. - Required. - :type resource_group_name: str - :param resource_name: The name of the service instance. Required. - :type resource_name: str - :param service_description: The service instance metadata. Is either a ServicesDescription type - or a IO type. Required. - :type service_description: ~azure.mgmt.healthcareapis.models.ServicesDescription 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. - :return: An instance of AsyncLROPoller that returns either ServicesDescription or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.ServicesDescription] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServicesDescription] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - service_description=service_description, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServicesDescription", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}" - } - async def _update_initial( self, resource_group_name: str, resource_name: str, - service_patch_description: Union[_models.ServicesPatchDescription, IO], + service_patch_description: Union[_models.ServicesPatchDescription, IO[bytes]], **kwargs: Any ) -> _models.ServicesDescription: error_map = { @@ -386,7 +150,7 @@ async def _update_initial( else: _json = self._serialize.body(service_patch_description, "ServicesPatchDescription") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, @@ -394,16 +158,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 @@ -416,13 +179,9 @@ async def _update_initial( deserialized = self._deserialize("ServicesDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -447,14 +206,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 ServicesDescription or the result of cls(response) :rtype: @@ -467,7 +218,7 @@ async def begin_update( self, resource_group_name: str, resource_name: str, - service_patch_description: IO, + service_patch_description: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -481,18 +232,10 @@ async def begin_update( :type resource_name: str :param service_patch_description: The service instance metadata and security metadata. Required. - :type service_patch_description: IO + :type service_patch_description: 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 ServicesDescription or the result of cls(response) :rtype: @@ -505,7 +248,7 @@ async def begin_update( self, resource_group_name: str, resource_name: str, - service_patch_description: Union[_models.ServicesPatchDescription, IO], + service_patch_description: Union[_models.ServicesPatchDescription, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ServicesDescription]: """Update the metadata of a service instance. @@ -516,20 +259,9 @@ async def begin_update( :param resource_name: The name of the service instance. Required. :type resource_name: str :param service_patch_description: The service instance metadata and security metadata. Is - either a ServicesPatchDescription type or a IO type. Required. + either a ServicesPatchDescription type or a IO[bytes] type. Required. :type service_patch_description: ~azure.mgmt.healthcareapis.models.ServicesPatchDescription 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. + IO[bytes] :return: An instance of AsyncLROPoller that returns either ServicesDescription or the result of cls(response) :rtype: @@ -562,7 +294,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ServicesDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -572,17 +304,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ServicesDescription].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.HealthcareApis/services/{resourceName}" - } + return AsyncLROPoller[_models.ServicesDescription]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, **kwargs: Any @@ -601,21 +331,20 @@ 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_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -626,11 +355,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.HealthcareApis/services/{resourceName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -641,14 +366,6 @@ async def begin_delete(self, resource_group_name: str, resource_name: str, **kwa :type resource_group_name: str :param resource_name: The name of the service instance. Required. :type resource_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: @@ -675,7 +392,7 @@ async def begin_delete(self, resource_group_name: str, resource_name: str, **kwa 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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -684,23 +401,18 @@ 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.HealthcareApis/services/{resourceName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.ServicesDescription"]: """Get all the service instances in a subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServicesDescription or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.ServicesDescription] @@ -723,15 +435,14 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ServicesDescription"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -743,13 +454,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("ServicesDescriptionListResult", pipeline_response) @@ -759,11 +470,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 @@ -776,8 +487,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/services"} - @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any @@ -787,7 +496,6 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group that contains the service instance. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServicesDescription or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.ServicesDescription] @@ -810,16 +518,15 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -831,13 +538,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("ServicesDescriptionListResult", pipeline_response) @@ -847,11 +554,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 @@ -864,10 +571,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services" - } - @overload async def check_name_availability( self, @@ -886,7 +589,6 @@ async def check_name_availability( :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: ServicesNameAvailabilityInfo or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.ServicesNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: @@ -894,18 +596,17 @@ async def check_name_availability( @overload async def check_name_availability( - self, check_name_availability_inputs: IO, *, content_type: str = "application/json", **kwargs: Any + self, check_name_availability_inputs: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.ServicesNameAvailabilityInfo: """Check if a service instance name is available. :param check_name_availability_inputs: Set the name parameter in the CheckNameAvailabilityParameters structure to the name of the service instance to check. Required. - :type check_name_availability_inputs: IO + :type check_name_availability_inputs: 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: ServicesNameAvailabilityInfo or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.ServicesNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: @@ -913,19 +614,15 @@ async def check_name_availability( @distributed_trace_async async def check_name_availability( - self, check_name_availability_inputs: Union[_models.CheckNameAvailabilityParameters, IO], **kwargs: Any + self, check_name_availability_inputs: Union[_models.CheckNameAvailabilityParameters, IO[bytes]], **kwargs: Any ) -> _models.ServicesNameAvailabilityInfo: """Check if a service instance name is available. :param check_name_availability_inputs: Set the name parameter in the CheckNameAvailabilityParameters structure to the name of the service instance to check. Is - either a CheckNameAvailabilityParameters type or a IO type. Required. + either a CheckNameAvailabilityParameters type or a IO[bytes] type. Required. :type check_name_availability_inputs: - ~azure.mgmt.healthcareapis.models.CheckNameAvailabilityParameters 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 + ~azure.mgmt.healthcareapis.models.CheckNameAvailabilityParameters or IO[bytes] :return: ServicesNameAvailabilityInfo or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.ServicesNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: @@ -953,22 +650,21 @@ async def check_name_availability( else: _json = self._serialize.body(check_name_availability_inputs, "CheckNameAvailabilityParameters") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.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 @@ -981,10 +677,6 @@ async def check_name_availability( deserialized = self._deserialize("ServicesNameAvailabilityInfo", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/checkNameAvailability" - } + return deserialized # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_workspace_private_endpoint_connections_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_workspace_private_endpoint_connections_operations.py index 1f08430bdb0b..191546962d14 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_workspace_private_endpoint_connections_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_workspace_private_endpoint_connections_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. @@ -42,7 +42,7 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class WorkspacePrivateEndpointConnectionsOperations: +class WorkspacePrivateEndpointConnectionsOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -72,7 +72,6 @@ def list_by_workspace( :type resource_group_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnectionDescription or the result of cls(response) :rtype: @@ -96,17 +95,16 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - request = build_list_by_workspace_request( + _request = build_list_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_workspace.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 @@ -118,13 +116,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("PrivateEndpointConnectionListResultDescription", pipeline_response) @@ -134,11 +132,11 @@ async def extract_data(pipeline_response): return 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 @@ -151,10 +149,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections" - } - @distributed_trace_async async def get( self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -169,7 +163,6 @@ async def get( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionDescription or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionDescription :raises ~azure.core.exceptions.HttpResponseError: @@ -188,22 +181,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionDescription] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -216,20 +208,16 @@ async def get( deserialized = self._deserialize("PrivateEndpointConnectionDescription", 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.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnectionDescription, IO], + properties: Union[_models.PrivateEndpointConnectionDescription, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnectionDescription: error_map = { @@ -255,7 +243,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(properties, "PrivateEndpointConnectionDescription") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -264,16 +252,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 @@ -286,13 +273,9 @@ async def _create_or_update_initial( deserialized = self._deserialize("PrivateEndpointConnectionDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -320,14 +303,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 PrivateEndpointConnectionDescription or the result of cls(response) :rtype: @@ -341,7 +316,7 @@ async def begin_create_or_update( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -357,18 +332,10 @@ async def begin_create_or_update( with the Azure resource. Required. :type private_endpoint_connection_name: str :param properties: The private endpoint connection properties. Required. - :type properties: IO + :type properties: 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 PrivateEndpointConnectionDescription or the result of cls(response) :rtype: @@ -382,7 +349,7 @@ async def begin_create_or_update( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnectionDescription, IO], + properties: Union[_models.PrivateEndpointConnectionDescription, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PrivateEndpointConnectionDescription]: """Update the state of the specified private endpoint connection associated with the workspace. @@ -396,19 +363,9 @@ async def begin_create_or_update( with the Azure resource. Required. :type private_endpoint_connection_name: str :param properties: The private endpoint connection properties. Is either a - PrivateEndpointConnectionDescription type or a IO type. Required. - :type properties: ~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionDescription 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. + PrivateEndpointConnectionDescription type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionDescription or + IO[bytes] :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnectionDescription or the result of cls(response) :rtype: @@ -442,7 +399,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -452,17 +409,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PrivateEndpointConnectionDescription].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.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return AsyncLROPoller[_models.PrivateEndpointConnectionDescription]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -481,22 +436,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( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -507,11 +461,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.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -527,14 +477,6 @@ async def begin_delete( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_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: @@ -562,7 +504,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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -571,14 +513,10 @@ 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.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_workspace_private_link_resources_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_workspace_private_link_resources_operations.py index f348d94d269e..7434bb42a85a 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_workspace_private_link_resources_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_workspace_private_link_resources_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. @@ -67,7 +67,6 @@ def list_by_workspace( :type resource_group_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateLinkResourceDescription or the result of cls(response) :rtype: @@ -91,17 +90,16 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - request = build_list_by_workspace_request( + _request = build_list_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_workspace.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 @@ -113,13 +111,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("PrivateLinkResourceListResultDescription", pipeline_response) @@ -129,11 +127,11 @@ async def extract_data(pipeline_response): return 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 @@ -146,10 +144,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/privateLinkResources" - } - @distributed_trace_async async def get( self, resource_group_name: str, workspace_name: str, group_name: str, **kwargs: Any @@ -163,7 +157,6 @@ async def get( :type workspace_name: str :param group_name: The name of the private link resource group. Required. :type group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResourceDescription or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.PrivateLinkResourceDescription :raises ~azure.core.exceptions.HttpResponseError: @@ -182,22 +175,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceDescription] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, group_name=group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -210,10 +202,6 @@ async def get( deserialized = self._deserialize("PrivateLinkResourceDescription", 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.HealthcareApis/workspaces/{workspaceName}/privateLinkResources/{groupName}" - } + return deserialized # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_workspaces_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_workspaces_operations.py index 397c8fc57465..e3c50ebf5b07 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_workspaces_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_workspaces_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. @@ -67,7 +67,6 @@ def __init__(self, *args, **kwargs) -> None: def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Workspace"]: """Lists all the available workspaces under the specified subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Workspace or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.Workspace] :raises ~azure.core.exceptions.HttpResponseError: @@ -89,15 +88,14 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Workspac def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -109,13 +107,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("WorkspaceList", pipeline_response) @@ -125,11 +123,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 @@ -142,10 +140,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/workspaces" - } - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Workspace"]: """Lists all the available workspaces under the specified resource group. @@ -153,7 +147,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy :param resource_group_name: The name of the resource group that contains the service instance. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Workspace or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.Workspace] :raises ~azure.core.exceptions.HttpResponseError: @@ -175,16 +168,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -196,13 +188,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("WorkspaceList", pipeline_response) @@ -212,11 +204,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 @@ -229,10 +221,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces" - } - @distributed_trace_async async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _models.Workspace: """Gets the properties of the specified workspace. @@ -242,7 +230,6 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any :type resource_group_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -261,21 +248,20 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -288,16 +274,16 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any deserialized = self._deserialize("Workspace", 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.HealthcareApis/workspaces/{workspaceName}" - } + return deserialized # type: ignore async def _create_or_update_initial( - self, resource_group_name: str, workspace_name: str, workspace: Union[_models.Workspace, IO], **kwargs: Any + self, + resource_group_name: str, + workspace_name: str, + workspace: Union[_models.Workspace, IO[bytes]], + **kwargs: Any ) -> _models.Workspace: error_map = { 401: ClientAuthenticationError, @@ -322,7 +308,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(workspace, "Workspace") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -330,16 +316,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 @@ -363,10 +348,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}" - } - @overload async def begin_create_or_update( self, @@ -389,14 +370,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 Workspace or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.Workspace] @@ -408,7 +381,7 @@ async def begin_create_or_update( self, resource_group_name: str, workspace_name: str, - workspace: IO, + workspace: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -421,18 +394,10 @@ async def begin_create_or_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param workspace: The parameters for creating or updating a healthcare workspace. Required. - :type workspace: IO + :type workspace: 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 Workspace or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.Workspace] @@ -441,7 +406,11 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, workspace_name: str, workspace: Union[_models.Workspace, IO], **kwargs: Any + self, + resource_group_name: str, + workspace_name: str, + workspace: Union[_models.Workspace, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.Workspace]: """Creates or updates a workspace resource with the specified parameters. @@ -451,19 +420,8 @@ async def begin_create_or_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param workspace: The parameters for creating or updating a healthcare workspace. Is either a - Workspace type or a IO type. Required. - :type workspace: ~azure.mgmt.healthcareapis.models.Workspace 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. + Workspace type or a IO[bytes] type. Required. + :type workspace: ~azure.mgmt.healthcareapis.models.Workspace or IO[bytes] :return: An instance of AsyncLROPoller that returns either Workspace or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.Workspace] @@ -495,7 +453,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Workspace", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -505,23 +463,21 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Workspace].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.HealthcareApis/workspaces/{workspaceName}" - } + return AsyncLROPoller[_models.Workspace]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, resource_group_name: str, workspace_name: str, - workspace_patch_resource: Union[_models.WorkspacePatchResource, IO], + workspace_patch_resource: Union[_models.WorkspacePatchResource, IO[bytes]], **kwargs: Any ) -> _models.Workspace: error_map = { @@ -547,7 +503,7 @@ async def _update_initial( else: _json = self._serialize.body(workspace_patch_resource, "WorkspacePatchResource") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -555,16 +511,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 @@ -585,10 +540,6 @@ async def _update_initial( return deserialized # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}" - } - @overload async def begin_update( self, @@ -611,14 +562,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 Workspace or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.Workspace] @@ -630,7 +573,7 @@ async def begin_update( self, resource_group_name: str, workspace_name: str, - workspace_patch_resource: IO, + workspace_patch_resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -643,18 +586,10 @@ async def begin_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param workspace_patch_resource: The parameters for updating a specified workspace. Required. - :type workspace_patch_resource: IO + :type workspace_patch_resource: 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 Workspace or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.Workspace] @@ -666,7 +601,7 @@ async def begin_update( self, resource_group_name: str, workspace_name: str, - workspace_patch_resource: Union[_models.WorkspacePatchResource, IO], + workspace_patch_resource: Union[_models.WorkspacePatchResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Workspace]: """Patch workspace details. @@ -677,19 +612,9 @@ async def begin_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param workspace_patch_resource: The parameters for updating a specified workspace. Is either a - WorkspacePatchResource type or a IO type. Required. - :type workspace_patch_resource: ~azure.mgmt.healthcareapis.models.WorkspacePatchResource 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. + WorkspacePatchResource type or a IO[bytes] type. Required. + :type workspace_patch_resource: ~azure.mgmt.healthcareapis.models.WorkspacePatchResource or + IO[bytes] :return: An instance of AsyncLROPoller that returns either Workspace or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.Workspace] @@ -721,7 +646,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Workspace", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -731,17 +656,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Workspace].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.HealthcareApis/workspaces/{workspaceName}" - } + return AsyncLROPoller[_models.Workspace]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, **kwargs: Any @@ -760,21 +683,20 @@ 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_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -785,11 +707,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.HealthcareApis/workspaces/{workspaceName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -800,14 +718,6 @@ async def begin_delete(self, resource_group_name: str, workspace_name: str, **kw :type resource_group_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_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: @@ -834,7 +744,7 @@ async def begin_delete(self, resource_group_name: str, workspace_name: str, **kw 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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -843,14 +753,10 @@ 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.HealthcareApis/workspaces/{workspaceName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/__init__.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/__init__.py index 5a42ffa36a7c..4ecad744c2dd 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/__init__.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/__init__.py @@ -75,6 +75,9 @@ from ._models_py3 import ServicesProperties from ._models_py3 import ServicesResource from ._models_py3 import ServicesResourceIdentity +from ._models_py3 import SmartIdentityProviderApplication +from ._models_py3 import SmartIdentityProviderConfiguration +from ._models_py3 import StorageConfiguration from ._models_py3 import SystemData from ._models_py3 import TaggedResource from ._models_py3 import UserAssignedIdentity @@ -98,6 +101,7 @@ from ._healthcare_apis_management_client_enums import ServiceEventState from ._healthcare_apis_management_client_enums import ServiceManagedIdentityType from ._healthcare_apis_management_client_enums import ServiceNameUnavailabilityReason +from ._healthcare_apis_management_client_enums import SmartDataActions from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -172,6 +176,9 @@ "ServicesProperties", "ServicesResource", "ServicesResourceIdentity", + "SmartIdentityProviderApplication", + "SmartIdentityProviderConfiguration", + "StorageConfiguration", "SystemData", "TaggedResource", "UserAssignedIdentity", @@ -194,6 +201,7 @@ "ServiceEventState", "ServiceManagedIdentityType", "ServiceNameUnavailabilityReason", + "SmartDataActions", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_healthcare_apis_management_client_enums.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_healthcare_apis_management_client_enums.py index 30eeb9c2aebf..00ca5a20af9e 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_healthcare_apis_management_client_enums.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_healthcare_apis_management_client_enums.py @@ -138,3 +138,9 @@ class ServiceNameUnavailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMe INVALID = "Invalid" ALREADY_EXISTS = "AlreadyExists" + + +class SmartDataActions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Data Actions that can be enabled for a Smart Identity Provider Application.""" + + READ = "Read" diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_models_py3.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_models_py3.py index 33d81dfa5f53..64d3dd618938 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_models_py3.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_models_py3.py @@ -27,7 +27,7 @@ class CheckNameAvailabilityParameters(_serialization.Model): """Input values. - 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 name: The name of the service instance to check. Required. :vartype name: str @@ -349,6 +349,8 @@ class DicomService(TaggedResource, ServiceManagedIdentity): # pylint: disable=t :vartype event_state: str or ~azure.mgmt.healthcareapis.models.ServiceEventState :ivar encryption: The encryption settings of the DICOM service. :vartype encryption: ~azure.mgmt.healthcareapis.models.Encryption + :ivar storage_configuration: The configuration of external storage account. + :vartype storage_configuration: ~azure.mgmt.healthcareapis.models.StorageConfiguration """ _validation = { @@ -385,6 +387,7 @@ class DicomService(TaggedResource, ServiceManagedIdentity): # pylint: disable=t "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, "event_state": {"key": "properties.eventState", "type": "str"}, "encryption": {"key": "properties.encryption", "type": "Encryption"}, + "storage_configuration": {"key": "properties.storageConfiguration", "type": "StorageConfiguration"}, } def __init__( @@ -398,6 +401,7 @@ def __init__( cors_configuration: Optional["_models.CorsConfiguration"] = None, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, encryption: Optional["_models.Encryption"] = None, + storage_configuration: Optional["_models.StorageConfiguration"] = None, **kwargs: Any ) -> None: """ @@ -421,6 +425,8 @@ def __init__( :paramtype public_network_access: str or ~azure.mgmt.healthcareapis.models.PublicNetworkAccess :keyword encryption: The encryption settings of the DICOM service. :paramtype encryption: ~azure.mgmt.healthcareapis.models.Encryption + :keyword storage_configuration: The configuration of external storage account. + :paramtype storage_configuration: ~azure.mgmt.healthcareapis.models.StorageConfiguration """ super().__init__(etag=etag, location=location, tags=tags, identity=identity, **kwargs) self.identity = identity @@ -433,6 +439,7 @@ def __init__( self.public_network_access = public_network_access self.event_state = None self.encryption = encryption + self.storage_configuration = storage_configuration self.id = None self.name = None self.type = None @@ -882,12 +889,17 @@ class FhirServiceAuthenticationConfiguration(_serialization.Model): :vartype audience: str :ivar smart_proxy_enabled: If the SMART on FHIR proxy is enabled. :vartype smart_proxy_enabled: bool + :ivar smart_identity_providers: The array of identity provider configurations for SMART on FHIR + authentication. + :vartype smart_identity_providers: + list[~azure.mgmt.healthcareapis.models.SmartIdentityProviderConfiguration] """ _attribute_map = { "authority": {"key": "authority", "type": "str"}, "audience": {"key": "audience", "type": "str"}, "smart_proxy_enabled": {"key": "smartProxyEnabled", "type": "bool"}, + "smart_identity_providers": {"key": "smartIdentityProviders", "type": "[SmartIdentityProviderConfiguration]"}, } def __init__( @@ -896,6 +908,7 @@ def __init__( authority: Optional[str] = None, audience: Optional[str] = None, smart_proxy_enabled: Optional[bool] = None, + smart_identity_providers: Optional[List["_models.SmartIdentityProviderConfiguration"]] = None, **kwargs: Any ) -> None: """ @@ -905,11 +918,16 @@ def __init__( :paramtype audience: str :keyword smart_proxy_enabled: If the SMART on FHIR proxy is enabled. :paramtype smart_proxy_enabled: bool + :keyword smart_identity_providers: The array of identity provider configurations for SMART on + FHIR authentication. + :paramtype smart_identity_providers: + list[~azure.mgmt.healthcareapis.models.SmartIdentityProviderConfiguration] """ super().__init__(**kwargs) self.authority = authority self.audience = audience self.smart_proxy_enabled = smart_proxy_enabled + self.smart_identity_providers = smart_identity_providers class FhirServiceCollection(_serialization.Model): @@ -1299,7 +1317,7 @@ def __init__(self, **kwargs: Any) -> None: self.provisioning_state = None -class IotEventHubIngestionEndpointConfiguration(_serialization.Model): +class IotEventHubIngestionEndpointConfiguration(_serialization.Model): # pylint: disable=name-too-long """Event Hub ingestion endpoint configuration. :ivar event_hub_name: Event Hub name to connect to. @@ -1345,7 +1363,7 @@ class IotFhirDestination(LocationBasedResource): 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 id: The resource identifier. :vartype id: str @@ -1470,7 +1488,7 @@ class IotFhirDestinationProperties(IotDestinationProperties): 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 provisioning_state: The provisioning state. Known values are: "Deleting", "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", "Deprovisioned", @@ -1993,7 +2011,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 @@ -2028,7 +2046,7 @@ class PrivateEndpointConnection(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 @@ -2093,7 +2111,7 @@ class PrivateEndpointConnectionDescription(PrivateEndpointConnection): 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 @@ -2178,7 +2196,7 @@ def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] self.value = value -class PrivateEndpointConnectionListResultDescription(_serialization.Model): +class PrivateEndpointConnectionListResultDescription(_serialization.Model): # pylint: disable=name-too-long """List of private endpoint connection associated with the specified storage account. :ivar value: Array of private endpoint connections. @@ -2206,7 +2224,7 @@ class PrivateLinkResource(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 @@ -2255,7 +2273,7 @@ class PrivateLinkResourceDescription(PrivateLinkResource): 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 @@ -2407,7 +2425,7 @@ def __init__( class ServiceAccessPolicyEntry(_serialization.Model): """An access policy entry. - 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 object_id: An Azure AD object ID (User or Apps) that is allowed access to the FHIR service. Required. @@ -2675,7 +2693,7 @@ class ServiceManagedIdentityIdentity(_serialization.Model): 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 type: Type of identity being specified, currently SystemAssigned and None are allowed. Required. Known values are: "None", "SystemAssigned", "UserAssigned", and @@ -2689,7 +2707,7 @@ class ServiceManagedIdentityIdentity(_serialization.Model): :vartype tenant_id: str :ivar user_assigned_identities: The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long The dictionary values can be empty objects ({}) in requests. :vartype user_assigned_identities: dict[str, ~azure.mgmt.healthcareapis.models.UserAssignedIdentity] @@ -2722,7 +2740,7 @@ def __init__( :paramtype type: str or ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityType :keyword user_assigned_identities: The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long The dictionary values can be empty objects ({}) in requests. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.healthcareapis.models.UserAssignedIdentity] @@ -2778,7 +2796,7 @@ class ServicesResource(_serialization.Model): 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 id: The resource identifier. :vartype id: str @@ -2861,7 +2879,7 @@ class ServicesDescription(ServicesResource): 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 id: The resource identifier. :vartype id: str @@ -3226,6 +3244,117 @@ def __init__( self.type = type +class SmartIdentityProviderApplication(_serialization.Model): + """An Application configured in the Identity Provider used to access FHIR resources. + + :ivar client_id: The application client id defined in the identity provider. This value will be + used to validate bearer tokens against the given authority. + :vartype client_id: str + :ivar audience: The audience that will be used to validate bearer tokens against the given + authority. + :vartype audience: str + :ivar allowed_data_actions: The actions that are permitted to be performed on FHIR resources + for the application. + :vartype allowed_data_actions: list[str or ~azure.mgmt.healthcareapis.models.SmartDataActions] + """ + + _attribute_map = { + "client_id": {"key": "clientId", "type": "str"}, + "audience": {"key": "audience", "type": "str"}, + "allowed_data_actions": {"key": "allowedDataActions", "type": "[str]"}, + } + + def __init__( + self, + *, + client_id: Optional[str] = None, + audience: Optional[str] = None, + allowed_data_actions: Optional[List[Union[str, "_models.SmartDataActions"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword client_id: The application client id defined in the identity provider. This value will + be used to validate bearer tokens against the given authority. + :paramtype client_id: str + :keyword audience: The audience that will be used to validate bearer tokens against the given + authority. + :paramtype audience: str + :keyword allowed_data_actions: The actions that are permitted to be performed on FHIR resources + for the application. + :paramtype allowed_data_actions: list[str or + ~azure.mgmt.healthcareapis.models.SmartDataActions] + """ + super().__init__(**kwargs) + self.client_id = client_id + self.audience = audience + self.allowed_data_actions = allowed_data_actions + + +class SmartIdentityProviderConfiguration(_serialization.Model): + """An object to configure an identity provider for use with SMART on FHIR authentication. + + :ivar authority: The identity provider token authority also known as the token issuing + authority. + :vartype authority: str + :ivar applications: The array of identity provider applications for SMART on FHIR + authentication. + :vartype applications: list[~azure.mgmt.healthcareapis.models.SmartIdentityProviderApplication] + """ + + _attribute_map = { + "authority": {"key": "authority", "type": "str"}, + "applications": {"key": "applications", "type": "[SmartIdentityProviderApplication]"}, + } + + def __init__( + self, + *, + authority: Optional[str] = None, + applications: Optional[List["_models.SmartIdentityProviderApplication"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword authority: The identity provider token authority also known as the token issuing + authority. + :paramtype authority: str + :keyword applications: The array of identity provider applications for SMART on FHIR + authentication. + :paramtype applications: + list[~azure.mgmt.healthcareapis.models.SmartIdentityProviderApplication] + """ + super().__init__(**kwargs) + self.authority = authority + self.applications = applications + + +class StorageConfiguration(_serialization.Model): + """The configuration of connected storage. + + :ivar storage_resource_id: The resource id of connected storage account. + :vartype storage_resource_id: str + :ivar file_system_name: The filesystem name of connected storage account. + :vartype file_system_name: str + """ + + _attribute_map = { + "storage_resource_id": {"key": "storageResourceId", "type": "str"}, + "file_system_name": {"key": "fileSystemName", "type": "str"}, + } + + def __init__( + self, *, storage_resource_id: Optional[str] = None, file_system_name: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword storage_resource_id: The resource id of connected storage account. + :paramtype storage_resource_id: str + :keyword file_system_name: The filesystem name of connected storage account. + :paramtype file_system_name: str + """ + super().__init__(**kwargs) + self.storage_resource_id = storage_resource_id + self.file_system_name = file_system_name + + class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. @@ -3420,17 +3549,6 @@ class WorkspacePatchResource(ResourceTags): :vartype tags: dict[str, str] """ - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(tags=tags, **kwargs) - class WorkspaceProperties(_serialization.Model): """Workspaces resource specific properties. diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_dicom_services_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_dicom_services_operations.py index f8cad4f60958..51adbcf7233a 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_dicom_services_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_dicom_services_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. @@ -45,7 +45,7 @@ def build_list_by_workspace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +114,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -153,7 +153,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -192,7 +192,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -252,7 +252,6 @@ def list_by_workspace( :type resource_group_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DicomService or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.DicomService] :raises ~azure.core.exceptions.HttpResponseError: @@ -274,17 +273,16 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - request = build_list_by_workspace_request( + _request = build_list_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_workspace.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 @@ -296,13 +294,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("DicomServiceCollection", pipeline_response) @@ -312,11 +310,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 @@ -329,10 +327,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices" - } - @distributed_trace def get( self, resource_group_name: str, workspace_name: str, dicom_service_name: str, **kwargs: Any @@ -346,7 +340,6 @@ def get( :type workspace_name: str :param dicom_service_name: The name of DICOM Service resource. Required. :type dicom_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DicomService or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.DicomService :raises ~azure.core.exceptions.HttpResponseError: @@ -365,22 +358,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DicomService] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, dicom_service_name=dicom_service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -393,20 +385,16 @@ def get( deserialized = self._deserialize("DicomService", 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.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, workspace_name: str, dicom_service_name: str, - dicomservice: Union[_models.DicomService, IO], + dicomservice: Union[_models.DicomService, IO[bytes]], **kwargs: Any ) -> _models.DicomService: error_map = { @@ -432,7 +420,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(dicomservice, "DicomService") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, dicom_service_name=dicom_service_name, @@ -441,16 +429,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 @@ -474,10 +461,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}" - } - @overload def begin_create_or_update( self, @@ -504,14 +487,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 DicomService or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.DicomService] @@ -524,7 +499,7 @@ def begin_create_or_update( resource_group_name: str, workspace_name: str, dicom_service_name: str, - dicomservice: IO, + dicomservice: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -540,18 +515,10 @@ def begin_create_or_update( :type dicom_service_name: str :param dicomservice: The parameters for creating or updating a Dicom Service resource. Required. - :type dicomservice: IO + :type dicomservice: 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 DicomService or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.DicomService] @@ -564,7 +531,7 @@ def begin_create_or_update( resource_group_name: str, workspace_name: str, dicom_service_name: str, - dicomservice: Union[_models.DicomService, IO], + dicomservice: Union[_models.DicomService, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.DicomService]: """Creates or updates a DICOM Service resource with the specified parameters. @@ -577,19 +544,8 @@ def begin_create_or_update( :param dicom_service_name: The name of DICOM Service resource. Required. :type dicom_service_name: str :param dicomservice: The parameters for creating or updating a Dicom Service resource. Is - either a DicomService type or a IO type. Required. - :type dicomservice: ~azure.mgmt.healthcareapis.models.DicomService 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. + either a DicomService type or a IO[bytes] type. Required. + :type dicomservice: ~azure.mgmt.healthcareapis.models.DicomService or IO[bytes] :return: An instance of LROPoller that returns either DicomService or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.DicomService] @@ -622,7 +578,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DicomService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -632,24 +588,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.DicomService].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.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}" - } + return LROPoller[_models.DicomService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, resource_group_name: str, dicom_service_name: str, workspace_name: str, - dicomservice_patch_resource: Union[_models.DicomServicePatchResource, IO], + dicomservice_patch_resource: Union[_models.DicomServicePatchResource, IO[bytes]], **kwargs: Any ) -> _models.DicomService: error_map = { @@ -675,7 +629,7 @@ def _update_initial( else: _json = self._serialize.body(dicomservice_patch_resource, "DicomServicePatchResource") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, dicom_service_name=dicom_service_name, workspace_name=workspace_name, @@ -684,16 +638,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 @@ -714,10 +667,6 @@ def _update_initial( return deserialized # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}" - } - @overload def begin_update( self, @@ -743,14 +692,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 DicomService or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.DicomService] @@ -763,7 +704,7 @@ def begin_update( resource_group_name: str, dicom_service_name: str, workspace_name: str, - dicomservice_patch_resource: IO, + dicomservice_patch_resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -778,18 +719,10 @@ def begin_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param dicomservice_patch_resource: The parameters for updating a Dicom Service. Required. - :type dicomservice_patch_resource: IO + :type dicomservice_patch_resource: 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 DicomService or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.DicomService] @@ -802,7 +735,7 @@ def begin_update( resource_group_name: str, dicom_service_name: str, workspace_name: str, - dicomservice_patch_resource: Union[_models.DicomServicePatchResource, IO], + dicomservice_patch_resource: Union[_models.DicomServicePatchResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.DicomService]: """Patch DICOM Service details. @@ -815,20 +748,9 @@ def begin_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param dicomservice_patch_resource: The parameters for updating a Dicom Service. Is either a - DicomServicePatchResource type or a IO type. Required. + DicomServicePatchResource type or a IO[bytes] type. Required. :type dicomservice_patch_resource: ~azure.mgmt.healthcareapis.models.DicomServicePatchResource - 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. + or IO[bytes] :return: An instance of LROPoller that returns either DicomService or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.DicomService] @@ -861,7 +783,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DicomService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -871,17 +793,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.DicomService].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.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}" - } + return LROPoller[_models.DicomService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dicom_service_name: str, workspace_name: str, **kwargs: Any @@ -900,22 +820,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( resource_group_name=resource_group_name, dicom_service_name=dicom_service_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -926,11 +845,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.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -945,14 +860,6 @@ def begin_delete( :type dicom_service_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_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: @@ -980,7 +887,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(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -989,14 +896,10 @@ 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.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_destinations_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_destinations_operations.py index 6102a7e65334..115996d262d4 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_destinations_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_destinations_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. @@ -42,7 +42,7 @@ def build_list_by_iot_connector_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +104,6 @@ def list_by_iot_connector( :type workspace_name: str :param iot_connector_name: The name of IoT Connector resource. Required. :type iot_connector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotFhirDestination or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.IotFhirDestination] :raises ~azure.core.exceptions.HttpResponseError: @@ -126,18 +125,17 @@ def list_by_iot_connector( def prepare_request(next_link=None): if not next_link: - request = build_list_by_iot_connector_request( + _request = build_list_by_iot_connector_request( resource_group_name=resource_group_name, workspace_name=workspace_name, iot_connector_name=iot_connector_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_iot_connector.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 @@ -149,13 +147,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("IotFhirDestinationCollection", pipeline_response) @@ -165,11 +163,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 @@ -181,7 +179,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_iot_connector.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations" - } diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_services_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_services_operations.py index 3c0cac3f16bf..79b619676604 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_services_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_services_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. @@ -45,7 +45,7 @@ def build_list_by_workspace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +112,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -149,7 +149,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -186,7 +186,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -244,7 +244,6 @@ def list_by_workspace( :type resource_group_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FhirService or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.FhirService] :raises ~azure.core.exceptions.HttpResponseError: @@ -266,17 +265,16 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - request = build_list_by_workspace_request( + _request = build_list_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_workspace.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 @@ -288,13 +286,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("FhirServiceCollection", pipeline_response) @@ -304,11 +302,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 @@ -321,10 +319,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices" - } - @distributed_trace def get( self, resource_group_name: str, workspace_name: str, fhir_service_name: str, **kwargs: Any @@ -338,7 +332,6 @@ def get( :type workspace_name: str :param fhir_service_name: The name of FHIR Service resource. Required. :type fhir_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FhirService or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.FhirService :raises ~azure.core.exceptions.HttpResponseError: @@ -357,22 +350,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FhirService] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, fhir_service_name=fhir_service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -385,20 +377,16 @@ def get( deserialized = self._deserialize("FhirService", 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.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, workspace_name: str, fhir_service_name: str, - fhirservice: Union[_models.FhirService, IO], + fhirservice: Union[_models.FhirService, IO[bytes]], **kwargs: Any ) -> _models.FhirService: error_map = { @@ -424,7 +412,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(fhirservice, "FhirService") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, fhir_service_name=fhir_service_name, @@ -433,16 +421,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 @@ -466,10 +453,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}" - } - @overload def begin_create_or_update( self, @@ -495,14 +478,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 FhirService or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.FhirService] @@ -515,7 +490,7 @@ def begin_create_or_update( resource_group_name: str, workspace_name: str, fhir_service_name: str, - fhirservice: IO, + fhirservice: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -530,18 +505,10 @@ def begin_create_or_update( :param fhir_service_name: The name of FHIR Service resource. Required. :type fhir_service_name: str :param fhirservice: The parameters for creating or updating a Fhir Service resource. Required. - :type fhirservice: IO + :type fhirservice: 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 FhirService or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.FhirService] @@ -554,7 +521,7 @@ def begin_create_or_update( resource_group_name: str, workspace_name: str, fhir_service_name: str, - fhirservice: Union[_models.FhirService, IO], + fhirservice: Union[_models.FhirService, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.FhirService]: """Creates or updates a FHIR Service resource with the specified parameters. @@ -567,19 +534,8 @@ def begin_create_or_update( :param fhir_service_name: The name of FHIR Service resource. Required. :type fhir_service_name: str :param fhirservice: The parameters for creating or updating a Fhir Service resource. Is either - a FhirService type or a IO type. Required. - :type fhirservice: ~azure.mgmt.healthcareapis.models.FhirService 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. + a FhirService type or a IO[bytes] type. Required. + :type fhirservice: ~azure.mgmt.healthcareapis.models.FhirService or IO[bytes] :return: An instance of LROPoller that returns either FhirService or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.FhirService] @@ -612,7 +568,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("FhirService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -622,24 +578,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.FhirService].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.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}" - } + return LROPoller[_models.FhirService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, resource_group_name: str, fhir_service_name: str, workspace_name: str, - fhirservice_patch_resource: Union[_models.FhirServicePatchResource, IO], + fhirservice_patch_resource: Union[_models.FhirServicePatchResource, IO[bytes]], **kwargs: Any ) -> _models.FhirService: error_map = { @@ -665,7 +619,7 @@ def _update_initial( else: _json = self._serialize.body(fhirservice_patch_resource, "FhirServicePatchResource") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, fhir_service_name=fhir_service_name, workspace_name=workspace_name, @@ -674,16 +628,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 @@ -704,10 +657,6 @@ def _update_initial( return deserialized # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}" - } - @overload def begin_update( self, @@ -733,14 +682,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 FhirService or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.FhirService] @@ -753,7 +694,7 @@ def begin_update( resource_group_name: str, fhir_service_name: str, workspace_name: str, - fhirservice_patch_resource: IO, + fhirservice_patch_resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -768,18 +709,10 @@ def begin_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param fhirservice_patch_resource: The parameters for updating a Fhir Service. Required. - :type fhirservice_patch_resource: IO + :type fhirservice_patch_resource: 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 FhirService or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.FhirService] @@ -792,7 +725,7 @@ def begin_update( resource_group_name: str, fhir_service_name: str, workspace_name: str, - fhirservice_patch_resource: Union[_models.FhirServicePatchResource, IO], + fhirservice_patch_resource: Union[_models.FhirServicePatchResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.FhirService]: """Patch FHIR Service details. @@ -805,20 +738,9 @@ def begin_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param fhirservice_patch_resource: The parameters for updating a Fhir Service. Is either a - FhirServicePatchResource type or a IO type. Required. + FhirServicePatchResource type or a IO[bytes] type. Required. :type fhirservice_patch_resource: ~azure.mgmt.healthcareapis.models.FhirServicePatchResource 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. + IO[bytes] :return: An instance of LROPoller that returns either FhirService or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.FhirService] @@ -851,7 +773,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("FhirService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -861,17 +783,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.FhirService].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.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}" - } + return LROPoller[_models.FhirService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, fhir_service_name: str, workspace_name: str, **kwargs: Any @@ -890,22 +810,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( resource_group_name=resource_group_name, fhir_service_name=fhir_service_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -916,11 +835,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.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -935,14 +850,6 @@ def begin_delete( :type fhir_service_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_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: @@ -970,7 +877,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(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -979,14 +886,10 @@ 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.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connector_fhir_destination_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connector_fhir_destination_operations.py index 1305f8aa4471..736b35fc0938 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connector_fhir_destination_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connector_fhir_destination_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. @@ -48,7 +48,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -139,7 +139,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -211,7 +211,6 @@ def get( :type iot_connector_name: str :param fhir_destination_name: The name of IoT Connector FHIR destination resource. Required. :type fhir_destination_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IotFhirDestination or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.IotFhirDestination :raises ~azure.core.exceptions.HttpResponseError: @@ -230,23 +229,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IotFhirDestination] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, iot_connector_name=iot_connector_name, fhir_destination_name=fhir_destination_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -259,13 +257,9 @@ def get( deserialized = self._deserialize("IotFhirDestination", 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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, @@ -273,7 +267,7 @@ def _create_or_update_initial( workspace_name: str, iot_connector_name: str, fhir_destination_name: str, - iot_fhir_destination: Union[_models.IotFhirDestination, IO], + iot_fhir_destination: Union[_models.IotFhirDestination, IO[bytes]], **kwargs: Any ) -> _models.IotFhirDestination: error_map = { @@ -299,7 +293,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(iot_fhir_destination, "IotFhirDestination") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, iot_connector_name=iot_connector_name, @@ -309,16 +303,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 @@ -342,10 +335,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}" - } - @overload def begin_create_or_update( self, @@ -375,14 +364,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 IotFhirDestination or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.IotFhirDestination] @@ -396,7 +377,7 @@ def begin_create_or_update( workspace_name: str, iot_connector_name: str, fhir_destination_name: str, - iot_fhir_destination: IO, + iot_fhir_destination: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -414,18 +395,10 @@ def begin_create_or_update( :type fhir_destination_name: str :param iot_fhir_destination: The parameters for creating or updating an IoT Connector FHIR destination resource. Required. - :type iot_fhir_destination: IO + :type iot_fhir_destination: 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 IotFhirDestination or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.IotFhirDestination] @@ -439,7 +412,7 @@ def begin_create_or_update( workspace_name: str, iot_connector_name: str, fhir_destination_name: str, - iot_fhir_destination: Union[_models.IotFhirDestination, IO], + iot_fhir_destination: Union[_models.IotFhirDestination, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.IotFhirDestination]: """Creates or updates an IoT Connector FHIR destination resource with the specified parameters. @@ -454,19 +427,8 @@ def begin_create_or_update( :param fhir_destination_name: The name of IoT Connector FHIR destination resource. Required. :type fhir_destination_name: str :param iot_fhir_destination: The parameters for creating or updating an IoT Connector FHIR - destination resource. Is either a IotFhirDestination type or a IO type. Required. - :type iot_fhir_destination: ~azure.mgmt.healthcareapis.models.IotFhirDestination 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. + destination resource. Is either a IotFhirDestination type or a IO[bytes] type. Required. + :type iot_fhir_destination: ~azure.mgmt.healthcareapis.models.IotFhirDestination or IO[bytes] :return: An instance of LROPoller that returns either IotFhirDestination or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.IotFhirDestination] @@ -500,7 +462,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("IotFhirDestination", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -510,17 +472,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.IotFhirDestination].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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}" - } + return LROPoller[_models.IotFhirDestination]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -544,23 +504,22 @@ 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_group_name=resource_group_name, workspace_name=workspace_name, iot_connector_name=iot_connector_name, fhir_destination_name=fhir_destination_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -571,11 +530,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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -597,14 +552,6 @@ def begin_delete( :type iot_connector_name: str :param fhir_destination_name: The name of IoT Connector FHIR destination resource. Required. :type fhir_destination_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: @@ -633,7 +580,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(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -642,14 +589,10 @@ 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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connectors_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connectors_operations.py index f2f2064079f2..d67f0d5777b4 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connectors_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connectors_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. @@ -45,7 +45,7 @@ def build_list_by_workspace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +114,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -153,7 +153,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -192,7 +192,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -252,7 +252,6 @@ def list_by_workspace( :type resource_group_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotConnector or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.IotConnector] :raises ~azure.core.exceptions.HttpResponseError: @@ -274,17 +273,16 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - request = build_list_by_workspace_request( + _request = build_list_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_workspace.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 @@ -296,13 +294,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("IotConnectorCollection", pipeline_response) @@ -312,11 +310,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 @@ -329,10 +327,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors" - } - @distributed_trace def get( self, resource_group_name: str, workspace_name: str, iot_connector_name: str, **kwargs: Any @@ -346,7 +340,6 @@ def get( :type workspace_name: str :param iot_connector_name: The name of IoT Connector resource. Required. :type iot_connector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IotConnector or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.IotConnector :raises ~azure.core.exceptions.HttpResponseError: @@ -365,22 +358,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IotConnector] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, iot_connector_name=iot_connector_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -393,20 +385,16 @@ def get( deserialized = self._deserialize("IotConnector", 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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, workspace_name: str, iot_connector_name: str, - iot_connector: Union[_models.IotConnector, IO], + iot_connector: Union[_models.IotConnector, IO[bytes]], **kwargs: Any ) -> _models.IotConnector: error_map = { @@ -432,7 +420,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(iot_connector, "IotConnector") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, iot_connector_name=iot_connector_name, @@ -441,16 +429,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 @@ -474,10 +461,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}" - } - @overload def begin_create_or_update( self, @@ -504,14 +487,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 IotConnector or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.IotConnector] @@ -524,7 +499,7 @@ def begin_create_or_update( resource_group_name: str, workspace_name: str, iot_connector_name: str, - iot_connector: IO, + iot_connector: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -540,18 +515,10 @@ def begin_create_or_update( :type iot_connector_name: str :param iot_connector: The parameters for creating or updating an IoT Connectors resource. Required. - :type iot_connector: IO + :type iot_connector: 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 IotConnector or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.IotConnector] @@ -564,7 +531,7 @@ def begin_create_or_update( resource_group_name: str, workspace_name: str, iot_connector_name: str, - iot_connector: Union[_models.IotConnector, IO], + iot_connector: Union[_models.IotConnector, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.IotConnector]: """Creates or updates an IoT Connector resource with the specified parameters. @@ -577,19 +544,8 @@ def begin_create_or_update( :param iot_connector_name: The name of IoT Connector resource. Required. :type iot_connector_name: str :param iot_connector: The parameters for creating or updating an IoT Connectors resource. Is - either a IotConnector type or a IO type. Required. - :type iot_connector: ~azure.mgmt.healthcareapis.models.IotConnector 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. + either a IotConnector type or a IO[bytes] type. Required. + :type iot_connector: ~azure.mgmt.healthcareapis.models.IotConnector or IO[bytes] :return: An instance of LROPoller that returns either IotConnector or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.IotConnector] @@ -622,7 +578,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("IotConnector", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -632,24 +588,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.IotConnector].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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}" - } + return LROPoller[_models.IotConnector]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, resource_group_name: str, iot_connector_name: str, workspace_name: str, - iot_connector_patch_resource: Union[_models.IotConnectorPatchResource, IO], + iot_connector_patch_resource: Union[_models.IotConnectorPatchResource, IO[bytes]], **kwargs: Any ) -> _models.IotConnector: error_map = { @@ -675,7 +629,7 @@ def _update_initial( else: _json = self._serialize.body(iot_connector_patch_resource, "IotConnectorPatchResource") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, iot_connector_name=iot_connector_name, workspace_name=workspace_name, @@ -684,16 +638,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 @@ -714,10 +667,6 @@ def _update_initial( return deserialized # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}" - } - @overload def begin_update( self, @@ -743,14 +692,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 IotConnector or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.IotConnector] @@ -763,7 +704,7 @@ def begin_update( resource_group_name: str, iot_connector_name: str, workspace_name: str, - iot_connector_patch_resource: IO, + iot_connector_patch_resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -778,18 +719,10 @@ def begin_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param iot_connector_patch_resource: The parameters for updating an IoT Connector. Required. - :type iot_connector_patch_resource: IO + :type iot_connector_patch_resource: 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 IotConnector or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.IotConnector] @@ -802,7 +735,7 @@ def begin_update( resource_group_name: str, iot_connector_name: str, workspace_name: str, - iot_connector_patch_resource: Union[_models.IotConnectorPatchResource, IO], + iot_connector_patch_resource: Union[_models.IotConnectorPatchResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.IotConnector]: """Patch an IoT Connector. @@ -815,20 +748,9 @@ def begin_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param iot_connector_patch_resource: The parameters for updating an IoT Connector. Is either a - IotConnectorPatchResource type or a IO type. Required. + IotConnectorPatchResource type or a IO[bytes] type. Required. :type iot_connector_patch_resource: ~azure.mgmt.healthcareapis.models.IotConnectorPatchResource - 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. + or IO[bytes] :return: An instance of LROPoller that returns either IotConnector or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.IotConnector] @@ -861,7 +783,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("IotConnector", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -871,17 +793,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.IotConnector].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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}" - } + return LROPoller[_models.IotConnector]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, iot_connector_name: str, workspace_name: str, **kwargs: Any @@ -900,22 +820,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( resource_group_name=resource_group_name, iot_connector_name=iot_connector_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -926,11 +845,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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -945,14 +860,6 @@ def begin_delete( :type iot_connector_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_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: @@ -980,7 +887,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(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -989,14 +896,10 @@ 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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operation_results_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operation_results_operations.py index df1c80682d8a..ee9f4f2cc977 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operation_results_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operation_results_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. @@ -38,7 +38,7 @@ def build_get_request(location_name: str, operation_result_id: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +90,6 @@ def get(self, location_name: str, operation_result_id: str, **kwargs: Any) -> _m :type location_name: str :param operation_result_id: The ID of the operation result to get. Required. :type operation_result_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationResultsDescription or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.OperationResultsDescription :raises ~azure.core.exceptions.HttpResponseError: @@ -109,21 +108,20 @@ def get(self, location_name: str, operation_result_id: str, **kwargs: Any) -> _m api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationResultsDescription] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( location_name=location_name, operation_result_id=operation_result_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -136,10 +134,6 @@ def get(self, location_name: str, operation_result_id: str, **kwargs: Any) -> _m deserialized = self._deserialize("OperationResultsDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/locations/{locationName}/operationresults/{operationResultId}" - } + return deserialized # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operations.py index e31a60ae709e..e24ac8c31b6b 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/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. @@ -40,7 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,6 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: """Lists all of the available operations supported by Microsoft Healthcare resource provider. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationDetail or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.OperationDetail] :raises ~azure.core.exceptions.HttpResponseError: @@ -100,14 +99,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: 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("ListOperations", 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.HealthcareApis/operations"} diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_endpoint_connections_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_endpoint_connections_operations.py index 504d7a64d342..0c4106e7b99d 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_endpoint_connections_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_endpoint_connections_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. @@ -45,7 +45,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +122,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -165,7 +165,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -225,7 +225,6 @@ def list_by_service( :type resource_group_name: str :param resource_name: The name of the service instance. Required. :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnectionDescription or the result of cls(response) :rtype: @@ -249,17 +248,16 @@ def list_by_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.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 @@ -271,13 +269,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("PrivateEndpointConnectionListResultDescription", pipeline_response) @@ -287,11 +285,11 @@ def extract_data(pipeline_response): return 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 @@ -304,10 +302,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections" - } - @distributed_trace def get( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -322,7 +316,6 @@ def get( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionDescription or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionDescription :raises ~azure.core.exceptions.HttpResponseError: @@ -341,22 +334,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionDescription] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -369,20 +361,16 @@ def get( deserialized = self._deserialize("PrivateEndpointConnectionDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO], + properties: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnectionDescription: error_map = { @@ -408,7 +396,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(properties, "PrivateEndpointConnection") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -417,16 +405,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 @@ -439,13 +426,9 @@ def _create_or_update_initial( deserialized = self._deserialize("PrivateEndpointConnectionDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -473,14 +456,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 PrivateEndpointConnectionDescription or the result of cls(response) :rtype: @@ -494,7 +469,7 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -510,18 +485,10 @@ def begin_create_or_update( with the Azure resource. Required. :type private_endpoint_connection_name: str :param properties: The private endpoint connection properties. Required. - :type properties: IO + :type properties: 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 PrivateEndpointConnectionDescription or the result of cls(response) :rtype: @@ -535,7 +502,7 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO], + properties: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PrivateEndpointConnectionDescription]: """Update the state of the specified private endpoint connection associated with the service. @@ -549,19 +516,8 @@ def begin_create_or_update( with the Azure resource. Required. :type private_endpoint_connection_name: str :param properties: The private endpoint connection properties. Is either a - PrivateEndpointConnection type or a IO type. Required. - :type properties: ~azure.mgmt.healthcareapis.models.PrivateEndpointConnection 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. + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.healthcareapis.models.PrivateEndpointConnection or IO[bytes] :return: An instance of LROPoller that returns either PrivateEndpointConnectionDescription or the result of cls(response) :rtype: @@ -595,7 +551,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -605,17 +561,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PrivateEndpointConnectionDescription].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.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return LROPoller[_models.PrivateEndpointConnectionDescription]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -634,22 +588,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( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -660,11 +613,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.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -680,14 +629,6 @@ def begin_delete( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_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: @@ -715,7 +656,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(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -724,14 +665,10 @@ 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.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_link_resources_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_link_resources_operations.py index 9e241da99f54..3c839d932a40 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_link_resources_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_link_resources_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. @@ -40,7 +40,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +131,6 @@ def list_by_service( :type resource_group_name: str :param resource_name: The name of the service instance. Required. :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResourceListResultDescription or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.PrivateLinkResourceListResultDescription :raises ~azure.core.exceptions.HttpResponseError: @@ -150,21 +149,20 @@ def list_by_service( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResultDescription] = kwargs.pop("cls", None) - request = build_list_by_service_request( + _request = build_list_by_service_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_service.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 @@ -177,13 +175,9 @@ def list_by_service( deserialized = self._deserialize("PrivateLinkResourceListResultDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateLinkResources" - } + return deserialized # type: ignore @distributed_trace def get( @@ -198,7 +192,6 @@ def get( :type resource_name: str :param group_name: The name of the private link resource group. Required. :type group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResourceDescription or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.PrivateLinkResourceDescription :raises ~azure.core.exceptions.HttpResponseError: @@ -217,22 +210,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceDescription] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, resource_name=resource_name, group_name=group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -245,10 +237,6 @@ def get( deserialized = self._deserialize("PrivateLinkResourceDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateLinkResources/{groupName}" - } + return deserialized # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_services_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_services_operations.py index 990fdf2cc5ff..3a8cf6ea89c2 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_services_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_services_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. @@ -43,7 +43,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,49 +70,13 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str", max_length=24, min_length=3), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - def build_update_request( resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -148,7 +112,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -179,7 +143,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -203,7 +167,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -233,7 +197,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -286,7 +250,6 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :type resource_group_name: str :param resource_name: The name of the service instance. Required. :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServicesDescription or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.ServicesDescription :raises ~azure.core.exceptions.HttpResponseError: @@ -305,21 +268,20 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServicesDescription] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -331,246 +293,16 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m deserialized = self._deserialize("ServicesDescription", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}" - } - - def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - service_description: Union[_models.ServicesDescription, IO], - **kwargs: Any - ) -> _models.ServicesDescription: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServicesDescription] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(service_description, (IOBase, bytes)): - _content = service_description - else: - _json = self._serialize.body(service_description, "ServicesDescription") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("ServicesDescription", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ServicesDescription", pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}" - } - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - service_description: _models.ServicesDescription, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ServicesDescription]: - """Create or update the metadata of a service instance. - - :param resource_group_name: The name of the resource group that contains the service instance. - Required. - :type resource_group_name: str - :param resource_name: The name of the service instance. Required. - :type resource_name: str - :param service_description: The service instance metadata. Required. - :type service_description: ~azure.mgmt.healthcareapis.models.ServicesDescription - :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 ServicesDescription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.ServicesDescription] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - service_description: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ServicesDescription]: - """Create or update the metadata of a service instance. - - :param resource_group_name: The name of the resource group that contains the service instance. - Required. - :type resource_group_name: str - :param resource_name: The name of the service instance. Required. - :type resource_name: str - :param service_description: The service instance metadata. Required. - :type service_description: IO - :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 ServicesDescription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.ServicesDescription] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - service_description: Union[_models.ServicesDescription, IO], - **kwargs: Any - ) -> LROPoller[_models.ServicesDescription]: - """Create or update the metadata of a service instance. - - :param resource_group_name: The name of the resource group that contains the service instance. - Required. - :type resource_group_name: str - :param resource_name: The name of the service instance. Required. - :type resource_name: str - :param service_description: The service instance metadata. Is either a ServicesDescription type - or a IO type. Required. - :type service_description: ~azure.mgmt.healthcareapis.models.ServicesDescription 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. - :return: An instance of LROPoller that returns either ServicesDescription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.ServicesDescription] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServicesDescription] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - service_description=service_description, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServicesDescription", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}" - } - def _update_initial( self, resource_group_name: str, resource_name: str, - service_patch_description: Union[_models.ServicesPatchDescription, IO], + service_patch_description: Union[_models.ServicesPatchDescription, IO[bytes]], **kwargs: Any ) -> _models.ServicesDescription: error_map = { @@ -596,7 +328,7 @@ def _update_initial( else: _json = self._serialize.body(service_patch_description, "ServicesPatchDescription") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, @@ -604,16 +336,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 @@ -626,13 +357,9 @@ def _update_initial( deserialized = self._deserialize("ServicesDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -657,14 +384,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 ServicesDescription or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.ServicesDescription] @@ -676,7 +395,7 @@ def begin_update( self, resource_group_name: str, resource_name: str, - service_patch_description: IO, + service_patch_description: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -690,18 +409,10 @@ def begin_update( :type resource_name: str :param service_patch_description: The service instance metadata and security metadata. Required. - :type service_patch_description: IO + :type service_patch_description: 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 ServicesDescription or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.ServicesDescription] @@ -713,7 +424,7 @@ def begin_update( self, resource_group_name: str, resource_name: str, - service_patch_description: Union[_models.ServicesPatchDescription, IO], + service_patch_description: Union[_models.ServicesPatchDescription, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ServicesDescription]: """Update the metadata of a service instance. @@ -724,20 +435,9 @@ def begin_update( :param resource_name: The name of the service instance. Required. :type resource_name: str :param service_patch_description: The service instance metadata and security metadata. Is - either a ServicesPatchDescription type or a IO type. Required. + either a ServicesPatchDescription type or a IO[bytes] type. Required. :type service_patch_description: ~azure.mgmt.healthcareapis.models.ServicesPatchDescription 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. + IO[bytes] :return: An instance of LROPoller that returns either ServicesDescription or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.ServicesDescription] @@ -769,7 +469,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ServicesDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -779,17 +479,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ServicesDescription].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.HealthcareApis/services/{resourceName}" - } + return LROPoller[_models.ServicesDescription]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, **kwargs: Any @@ -808,21 +506,20 @@ 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_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -833,11 +530,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.HealthcareApis/services/{resourceName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: @@ -848,14 +541,6 @@ def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: A :type resource_group_name: str :param resource_name: The name of the service instance. Required. :type resource_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: @@ -882,7 +567,7 @@ def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: A 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(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -891,23 +576,18 @@ 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.HealthcareApis/services/{resourceName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.ServicesDescription"]: """Get all the service instances in a subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServicesDescription or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.ServicesDescription] :raises ~azure.core.exceptions.HttpResponseError: @@ -929,15 +609,14 @@ def list(self, **kwargs: Any) -> Iterable["_models.ServicesDescription"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -949,13 +628,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("ServicesDescriptionListResult", pipeline_response) @@ -965,11 +644,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 @@ -982,8 +661,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/services"} - @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any @@ -993,7 +670,6 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group that contains the service instance. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServicesDescription or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.ServicesDescription] :raises ~azure.core.exceptions.HttpResponseError: @@ -1015,16 +691,15 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1036,13 +711,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("ServicesDescriptionListResult", pipeline_response) @@ -1052,11 +727,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 @@ -1069,10 +744,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services" - } - @overload def check_name_availability( self, @@ -1091,7 +762,6 @@ def check_name_availability( :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: ServicesNameAvailabilityInfo or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.ServicesNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: @@ -1099,18 +769,17 @@ def check_name_availability( @overload def check_name_availability( - self, check_name_availability_inputs: IO, *, content_type: str = "application/json", **kwargs: Any + self, check_name_availability_inputs: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.ServicesNameAvailabilityInfo: """Check if a service instance name is available. :param check_name_availability_inputs: Set the name parameter in the CheckNameAvailabilityParameters structure to the name of the service instance to check. Required. - :type check_name_availability_inputs: IO + :type check_name_availability_inputs: 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: ServicesNameAvailabilityInfo or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.ServicesNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: @@ -1118,19 +787,15 @@ def check_name_availability( @distributed_trace def check_name_availability( - self, check_name_availability_inputs: Union[_models.CheckNameAvailabilityParameters, IO], **kwargs: Any + self, check_name_availability_inputs: Union[_models.CheckNameAvailabilityParameters, IO[bytes]], **kwargs: Any ) -> _models.ServicesNameAvailabilityInfo: """Check if a service instance name is available. :param check_name_availability_inputs: Set the name parameter in the CheckNameAvailabilityParameters structure to the name of the service instance to check. Is - either a CheckNameAvailabilityParameters type or a IO type. Required. + either a CheckNameAvailabilityParameters type or a IO[bytes] type. Required. :type check_name_availability_inputs: - ~azure.mgmt.healthcareapis.models.CheckNameAvailabilityParameters 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 + ~azure.mgmt.healthcareapis.models.CheckNameAvailabilityParameters or IO[bytes] :return: ServicesNameAvailabilityInfo or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.ServicesNameAvailabilityInfo :raises ~azure.core.exceptions.HttpResponseError: @@ -1158,22 +823,21 @@ def check_name_availability( else: _json = self._serialize.body(check_name_availability_inputs, "CheckNameAvailabilityParameters") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.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 @@ -1186,10 +850,6 @@ def check_name_availability( deserialized = self._deserialize("ServicesNameAvailabilityInfo", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/checkNameAvailability" - } + return deserialized # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspace_private_endpoint_connections_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspace_private_endpoint_connections_operations.py index 47eec0e0abca..ba9945a92ad5 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspace_private_endpoint_connections_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspace_private_endpoint_connections_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. @@ -45,7 +45,7 @@ def build_list_by_workspace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +122,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -165,7 +165,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -195,7 +195,7 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -class WorkspacePrivateEndpointConnectionsOperations: +class WorkspacePrivateEndpointConnectionsOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -225,7 +225,6 @@ def list_by_workspace( :type resource_group_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnectionDescription or the result of cls(response) :rtype: @@ -249,17 +248,16 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - request = build_list_by_workspace_request( + _request = build_list_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_workspace.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 @@ -271,13 +269,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("PrivateEndpointConnectionListResultDescription", pipeline_response) @@ -287,11 +285,11 @@ def extract_data(pipeline_response): return 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 @@ -304,10 +302,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections" - } - @distributed_trace def get( self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -322,7 +316,6 @@ def get( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionDescription or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionDescription :raises ~azure.core.exceptions.HttpResponseError: @@ -341,22 +334,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionDescription] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -369,20 +361,16 @@ def get( deserialized = self._deserialize("PrivateEndpointConnectionDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnectionDescription, IO], + properties: Union[_models.PrivateEndpointConnectionDescription, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnectionDescription: error_map = { @@ -408,7 +396,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(properties, "PrivateEndpointConnectionDescription") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -417,16 +405,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 @@ -439,13 +426,9 @@ def _create_or_update_initial( deserialized = self._deserialize("PrivateEndpointConnectionDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -473,14 +456,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 PrivateEndpointConnectionDescription or the result of cls(response) :rtype: @@ -494,7 +469,7 @@ def begin_create_or_update( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -510,18 +485,10 @@ def begin_create_or_update( with the Azure resource. Required. :type private_endpoint_connection_name: str :param properties: The private endpoint connection properties. Required. - :type properties: IO + :type properties: 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 PrivateEndpointConnectionDescription or the result of cls(response) :rtype: @@ -535,7 +502,7 @@ def begin_create_or_update( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnectionDescription, IO], + properties: Union[_models.PrivateEndpointConnectionDescription, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PrivateEndpointConnectionDescription]: """Update the state of the specified private endpoint connection associated with the workspace. @@ -549,19 +516,9 @@ def begin_create_or_update( with the Azure resource. Required. :type private_endpoint_connection_name: str :param properties: The private endpoint connection properties. Is either a - PrivateEndpointConnectionDescription type or a IO type. Required. - :type properties: ~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionDescription 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. + PrivateEndpointConnectionDescription type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionDescription or + IO[bytes] :return: An instance of LROPoller that returns either PrivateEndpointConnectionDescription or the result of cls(response) :rtype: @@ -595,7 +552,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -605,17 +562,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PrivateEndpointConnectionDescription].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.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return LROPoller[_models.PrivateEndpointConnectionDescription]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -634,22 +589,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( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -660,11 +614,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.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -680,14 +630,6 @@ def begin_delete( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_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: @@ -715,7 +657,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(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -724,14 +666,10 @@ 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.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspace_private_link_resources_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspace_private_link_resources_operations.py index da2b038e5979..e2242205302f 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspace_private_link_resources_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspace_private_link_resources_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. @@ -42,7 +42,7 @@ def build_list_by_workspace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +75,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +133,6 @@ def list_by_workspace( :type resource_group_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateLinkResourceDescription or the result of cls(response) :rtype: @@ -157,17 +156,16 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - request = build_list_by_workspace_request( + _request = build_list_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_workspace.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 @@ -179,13 +177,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("PrivateLinkResourceListResultDescription", pipeline_response) @@ -195,11 +193,11 @@ def extract_data(pipeline_response): return 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 @@ -212,10 +210,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/privateLinkResources" - } - @distributed_trace def get( self, resource_group_name: str, workspace_name: str, group_name: str, **kwargs: Any @@ -229,7 +223,6 @@ def get( :type workspace_name: str :param group_name: The name of the private link resource group. Required. :type group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResourceDescription or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.PrivateLinkResourceDescription :raises ~azure.core.exceptions.HttpResponseError: @@ -248,22 +241,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceDescription] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, group_name=group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -276,10 +268,6 @@ def get( deserialized = self._deserialize("PrivateLinkResourceDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/privateLinkResources/{groupName}" - } + return deserialized # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspaces_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspaces_operations.py index 686f9e78356b..7397d8bc468d 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspaces_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspaces_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. @@ -43,7 +43,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +67,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +99,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +132,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -168,7 +168,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -204,7 +204,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -254,7 +254,6 @@ def __init__(self, *args, **kwargs): def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Workspace"]: """Lists all the available workspaces under the specified subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Workspace or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.Workspace] :raises ~azure.core.exceptions.HttpResponseError: @@ -276,15 +275,14 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Workspace"]: def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -296,13 +294,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("WorkspaceList", pipeline_response) @@ -312,11 +310,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 @@ -329,10 +327,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/workspaces" - } - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Workspace"]: """Lists all the available workspaces under the specified resource group. @@ -340,7 +334,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite :param resource_group_name: The name of the resource group that contains the service instance. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Workspace or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.Workspace] :raises ~azure.core.exceptions.HttpResponseError: @@ -362,16 +355,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -383,13 +375,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("WorkspaceList", pipeline_response) @@ -399,11 +391,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 @@ -416,10 +408,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces" - } - @distributed_trace def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _models.Workspace: """Gets the properties of the specified workspace. @@ -429,7 +417,6 @@ def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _ :type resource_group_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -448,21 +435,20 @@ def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -475,16 +461,16 @@ def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _ deserialized = self._deserialize("Workspace", 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.HealthcareApis/workspaces/{workspaceName}" - } + return deserialized # type: ignore def _create_or_update_initial( - self, resource_group_name: str, workspace_name: str, workspace: Union[_models.Workspace, IO], **kwargs: Any + self, + resource_group_name: str, + workspace_name: str, + workspace: Union[_models.Workspace, IO[bytes]], + **kwargs: Any ) -> _models.Workspace: error_map = { 401: ClientAuthenticationError, @@ -509,7 +495,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(workspace, "Workspace") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -517,16 +503,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 @@ -550,10 +535,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}" - } - @overload def begin_create_or_update( self, @@ -576,14 +557,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 Workspace or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.Workspace] :raises ~azure.core.exceptions.HttpResponseError: @@ -594,7 +567,7 @@ def begin_create_or_update( self, resource_group_name: str, workspace_name: str, - workspace: IO, + workspace: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -607,18 +580,10 @@ def begin_create_or_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param workspace: The parameters for creating or updating a healthcare workspace. Required. - :type workspace: IO + :type workspace: 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 Workspace or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.Workspace] :raises ~azure.core.exceptions.HttpResponseError: @@ -626,7 +591,11 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, resource_group_name: str, workspace_name: str, workspace: Union[_models.Workspace, IO], **kwargs: Any + self, + resource_group_name: str, + workspace_name: str, + workspace: Union[_models.Workspace, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.Workspace]: """Creates or updates a workspace resource with the specified parameters. @@ -636,19 +605,8 @@ def begin_create_or_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param workspace: The parameters for creating or updating a healthcare workspace. Is either a - Workspace type or a IO type. Required. - :type workspace: ~azure.mgmt.healthcareapis.models.Workspace 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. + Workspace type or a IO[bytes] type. Required. + :type workspace: ~azure.mgmt.healthcareapis.models.Workspace or IO[bytes] :return: An instance of LROPoller that returns either Workspace or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.Workspace] :raises ~azure.core.exceptions.HttpResponseError: @@ -679,7 +637,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Workspace", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -689,23 +647,21 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Workspace].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.HealthcareApis/workspaces/{workspaceName}" - } + return LROPoller[_models.Workspace]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, resource_group_name: str, workspace_name: str, - workspace_patch_resource: Union[_models.WorkspacePatchResource, IO], + workspace_patch_resource: Union[_models.WorkspacePatchResource, IO[bytes]], **kwargs: Any ) -> _models.Workspace: error_map = { @@ -731,7 +687,7 @@ def _update_initial( else: _json = self._serialize.body(workspace_patch_resource, "WorkspacePatchResource") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -739,16 +695,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 @@ -769,10 +724,6 @@ def _update_initial( return deserialized # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}" - } - @overload def begin_update( self, @@ -795,14 +746,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 Workspace or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.Workspace] :raises ~azure.core.exceptions.HttpResponseError: @@ -813,7 +756,7 @@ def begin_update( self, resource_group_name: str, workspace_name: str, - workspace_patch_resource: IO, + workspace_patch_resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -826,18 +769,10 @@ def begin_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param workspace_patch_resource: The parameters for updating a specified workspace. Required. - :type workspace_patch_resource: IO + :type workspace_patch_resource: 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 Workspace or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.Workspace] :raises ~azure.core.exceptions.HttpResponseError: @@ -848,7 +783,7 @@ def begin_update( self, resource_group_name: str, workspace_name: str, - workspace_patch_resource: Union[_models.WorkspacePatchResource, IO], + workspace_patch_resource: Union[_models.WorkspacePatchResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Workspace]: """Patch workspace details. @@ -859,19 +794,9 @@ def begin_update( :param workspace_name: The name of workspace resource. Required. :type workspace_name: str :param workspace_patch_resource: The parameters for updating a specified workspace. Is either a - WorkspacePatchResource type or a IO type. Required. - :type workspace_patch_resource: ~azure.mgmt.healthcareapis.models.WorkspacePatchResource 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. + WorkspacePatchResource type or a IO[bytes] type. Required. + :type workspace_patch_resource: ~azure.mgmt.healthcareapis.models.WorkspacePatchResource or + IO[bytes] :return: An instance of LROPoller that returns either Workspace or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.Workspace] :raises ~azure.core.exceptions.HttpResponseError: @@ -902,7 +827,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Workspace", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -912,17 +837,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Workspace].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.HealthcareApis/workspaces/{workspaceName}" - } + return LROPoller[_models.Workspace]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, **kwargs: Any @@ -941,21 +864,20 @@ 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_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _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 @@ -966,11 +888,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.HealthcareApis/workspaces/{workspaceName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> LROPoller[None]: @@ -981,14 +899,6 @@ def begin_delete(self, resource_group_name: str, workspace_name: str, **kwargs: :type resource_group_name: str :param workspace_name: The name of workspace resource. Required. :type workspace_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: @@ -1015,7 +925,7 @@ def begin_delete(self, resource_group_name: str, workspace_name: str, **kwargs: 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(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -1024,14 +934,10 @@ 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.HealthcareApis/workspaces/{workspaceName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/check_name_availability_post.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/check_name_availability_post.py index 5028980ee3f9..ada4485f645f 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/check_name_availability_post.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/check_name_availability_post.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.healthcareapis import HealthcareApisManagementClient """ @@ -35,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/CheckNameAvailabilityPost.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/CheckNameAvailabilityPost.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_create.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_create.py index 46e14e13bdca..2bc3e074d9b2 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_create.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_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.healthcareapis import HealthcareApisManagementClient """ @@ -33,11 +36,19 @@ def main(): resource_group_name="testRG", workspace_name="workspace1", dicom_service_name="blue", - dicomservice={"location": "westus", "properties": {}}, + dicomservice={ + "location": "westus", + "properties": { + "storageConfiguration": { + "fileSystemName": "fileSystemName", + "storageResourceId": "/subscriptions/ab309d4e-4c2e-4241-be2e-08e1c8dd4246/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/accountname", + } + }, + }, ).result() print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/dicomservices/DicomServices_Create.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/dicomservices/DicomServices_Create.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_delete.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_delete.py index adc7394bf2e2..4bb4d0087f3d 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_delete.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/dicomservices/DicomServices_Delete.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/dicomservices/DicomServices_Delete.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_get.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_get.py index 109d0165f75d..51f0e8055ece 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_get.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/dicomservices/DicomServices_Get.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/dicomservices/DicomServices_Get.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_list.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_list.py index 12c7341750f2..d18c1ab49bfb 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_list.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/dicomservices/DicomServices_List.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/dicomservices/DicomServices_List.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_patch.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_patch.py index a5397ee5ba8c..40468ad75acc 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_patch.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_patch.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.healthcareapis import HealthcareApisManagementClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/dicomservices/DicomServices_Patch.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/dicomservices/DicomServices_Patch.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_create.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_create.py index fa81fc96e81c..78251d79f433 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_create.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_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.healthcareapis import HealthcareApisManagementClient """ @@ -47,6 +50,18 @@ def main(): "authenticationConfiguration": { "audience": "https://azurehealthcareapis.com", "authority": "https://login.microsoftonline.com/abfde7b2-df0f-47e6-aabf-2462b07508dc", + "smartIdentityProviders": [ + { + "applications": [ + { + "allowedDataActions": ["Read"], + "audience": "22222222-2222-2222-2222-222222222222", + "clientId": "22222222-2222-2222-2222-222222222222", + } + ], + "authority": "https://login.b2clogin.com/11111111-1111-1111-1111-111111111111/v2.0", + } + ], "smartProxyEnabled": True, }, "corsConfiguration": { @@ -75,6 +90,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/fhirservices/FhirServices_Create.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/fhirservices/FhirServices_Create.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_delete.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_delete.py index eae5bc9832a6..07f51645ca7c 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_delete.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/fhirservices/FhirServices_Delete.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/fhirservices/FhirServices_Delete.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_get.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_get.py index 349a4de61d8e..47dc673e89a6 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_get.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/fhirservices/FhirServices_Get.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/fhirservices/FhirServices_Get.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_list.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_list.py index 6471e18ec5d6..6daadcea63a2 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_list.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/fhirservices/FhirServices_List.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/fhirservices/FhirServices_List.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_patch.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_patch.py index 1f0026a8c597..89297b5c899a 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_patch.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_patch.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.healthcareapis import HealthcareApisManagementClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/fhirservices/FhirServices_Patch.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/fhirservices/FhirServices_Patch.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_create.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_create.py index b3d42bf80db0..26dd6426d808 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_create.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_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.healthcareapis import HealthcareApisManagementClient """ @@ -68,6 +71,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/iotconnectors/iotconnector_Create.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/iotconnectors/iotconnector_Create.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_delete.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_delete.py index 249acfb29b42..b46b3692d9d6 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_delete.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/iotconnectors/iotconnector_Delete.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/iotconnectors/iotconnector_Delete.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_create.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_create.py index c1e9999e84d4..b721d0940168 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_create.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_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.healthcareapis import HealthcareApisManagementClient """ @@ -68,6 +71,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/iotconnectors/iotconnector_fhirdestination_Create.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/iotconnectors/iotconnector_fhirdestination_Create.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_delete.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_delete.py index 62f875a3c22c..2216cb1ca8ec 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_delete.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/iotconnectors/iotconnector_fhirdestination_Delete.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/iotconnectors/iotconnector_fhirdestination_Delete.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_get.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_get.py index b3baec72475f..b4aacc1e62b1 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_get.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/iotconnectors/iotconnector_fhirdestination_Get.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/iotconnectors/iotconnector_fhirdestination_Get.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_list.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_list.py index f96ca3557a03..21132b46592c 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_list.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/iotconnectors/iotconnector_fhirdestination_List.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/iotconnectors/iotconnector_fhirdestination_List.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_get.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_get.py index 1911825cb8ab..d0f9c0d7699e 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_get.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/iotconnectors/iotconnector_Get.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/iotconnectors/iotconnector_Get.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_list.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_list.py index bd9db60d035a..980bb1753ba9 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_list.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/iotconnectors/iotconnector_List.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/iotconnectors/iotconnector_List.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_patch.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_patch.py index 19869dfc0d28..a00f144ca962 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_patch.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_patch.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.healthcareapis import HealthcareApisManagementClient """ @@ -41,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/iotconnectors/iotconnector_Patch.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/iotconnectors/iotconnector_Patch.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/private_link_resource_get.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/private_link_resource_get.py index 8870ab264427..91841d61c0e1 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/private_link_resource_get.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/private_link_resource_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/PrivateLinkResourceGet.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/legacy/PrivateLinkResourceGet.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/private_link_resources_list_by_service.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/private_link_resources_list_by_service.py index 1c0d748a1336..8addd38704f2 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/private_link_resources_list_by_service.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/private_link_resources_list_by_service.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/PrivateLinkResourcesListByService.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/legacy/PrivateLinkResourcesListByService.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create.py deleted file mode 100644 index 47e9655d61a3..000000000000 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create.py +++ /dev/null @@ -1,72 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.healthcareapis import HealthcareApisManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-healthcareapis -# USAGE - python service_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = HealthcareApisManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.services.begin_create_or_update( - resource_group_name="rg1", - resource_name="service1", - service_description={ - "identity": {"type": "SystemAssigned"}, - "kind": "fhir-R4", - "location": "westus2", - "properties": { - "accessPolicies": [ - {"objectId": "c487e7d1-3210-41a3-8ccc-e9372b78da47"}, - {"objectId": "5b307da8-43d4-492b-8b66-b0294ade872f"}, - ], - "authenticationConfiguration": { - "audience": "https://azurehealthcareapis.com", - "authority": "https://login.microsoftonline.com/abfde7b2-df0f-47e6-aabf-2462b07508dc", - "smartProxyEnabled": True, - }, - "corsConfiguration": { - "allowCredentials": False, - "headers": ["*"], - "maxAge": 1440, - "methods": ["DELETE", "GET", "OPTIONS", "PATCH", "POST", "PUT"], - "origins": ["*"], - }, - "cosmosDbConfiguration": { - "keyVaultKeyUri": "https://my-vault.vault.azure.net/keys/my-key", - "offerThroughput": 1000, - }, - "exportConfiguration": {"storageAccountName": "existingStorageAccount"}, - "privateEndpointConnections": [], - "publicNetworkAccess": "Disabled", - }, - "tags": {}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_in_data_sovereign_region_with_cmk_enabled.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_in_data_sovereign_region_with_cmk_enabled.py deleted file mode 100644 index ae0ad4ccbe61..000000000000 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_in_data_sovereign_region_with_cmk_enabled.py +++ /dev/null @@ -1,73 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.healthcareapis import HealthcareApisManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-healthcareapis -# USAGE - python service_create_in_data_sovereign_region_with_cmk_enabled.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = HealthcareApisManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.services.begin_create_or_update( - resource_group_name="rg1", - resource_name="service1", - service_description={ - "identity": {"type": "SystemAssigned"}, - "kind": "fhir-R4", - "location": "Southeast Asia", - "properties": { - "accessPolicies": [ - {"objectId": "c487e7d1-3210-41a3-8ccc-e9372b78da47"}, - {"objectId": "5b307da8-43d4-492b-8b66-b0294ade872f"}, - ], - "authenticationConfiguration": { - "audience": "https://azurehealthcareapis.com", - "authority": "https://login.microsoftonline.com/abfde7b2-df0f-47e6-aabf-2462b07508dc", - "smartProxyEnabled": True, - }, - "corsConfiguration": { - "allowCredentials": False, - "headers": ["*"], - "maxAge": 1440, - "methods": ["DELETE", "GET", "OPTIONS", "PATCH", "POST", "PUT"], - "origins": ["*"], - }, - "cosmosDbConfiguration": { - "crossTenantCmkApplicationId": "de3fbeef-8c3a-428e-8b9f-4d229c8a85f4", - "keyVaultKeyUri": "https://my-vault.vault.azure.net/keys/my-key", - "offerThroughput": 1000, - }, - "exportConfiguration": {"storageAccountName": "existingStorageAccount"}, - "privateEndpointConnections": [], - "publicNetworkAccess": "Disabled", - }, - "tags": {}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceCreateInDataSovereignRegionWithCmkEnabled.json -if __name__ == "__main__": - main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_minimum.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_minimum.py deleted file mode 100644 index db99f1c8d575..000000000000 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_minimum.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.healthcareapis import HealthcareApisManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-healthcareapis -# USAGE - python service_create_minimum.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = HealthcareApisManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.services.begin_create_or_update( - resource_group_name="rg1", - resource_name="service2", - service_description={ - "kind": "fhir-R4", - "location": "westus2", - "properties": {"accessPolicies": [{"objectId": "c487e7d1-3210-41a3-8ccc-e9372b78da47"}]}, - "tags": {}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceCreateMinimum.json -if __name__ == "__main__": - main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_private_endpoint_connection.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_private_endpoint_connection.py index 5ac228219d52..03e864674917 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_private_endpoint_connection.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_private_endpoint_connection.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.healthcareapis import HealthcareApisManagementClient """ @@ -40,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceCreatePrivateEndpointConnection.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/legacy/ServiceCreatePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_delete.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_delete.py index e7019f2f69eb..47df251765af 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_delete.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceDelete.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/legacy/ServiceDelete.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_delete_private_endpoint_connection.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_delete_private_endpoint_connection.py index a6bbcc69778e..09874b57a02d 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_delete_private_endpoint_connection.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_delete_private_endpoint_connection.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceDeletePrivateEndpointConnection.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/legacy/ServiceDeletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get.py index d35cf7a85bc6..513378d188ff 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceGet.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/legacy/ServiceGet.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get_in_data_sovereign_region_with_cmk_enabled.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get_in_data_sovereign_region_with_cmk_enabled.py index 8dad68ce88dc..8dc77d76110e 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get_in_data_sovereign_region_with_cmk_enabled.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get_in_data_sovereign_region_with_cmk_enabled.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceGetInDataSovereignRegionWithCmkEnabled.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/legacy/ServiceGetInDataSovereignRegionWithCmkEnabled.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get_private_endpoint_connection.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get_private_endpoint_connection.py index c00a72bb1a42..5a1c50537f6b 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get_private_endpoint_connection.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get_private_endpoint_connection.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceGetPrivateEndpointConnection.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/legacy/ServiceGetPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list.py index d15ae2ccbff9..8ea9c7f3498e 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceList.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/legacy/ServiceList.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list_by_resource_group.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list_by_resource_group.py index 06e2f93e9ae8..fdf1918b0174 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list_by_resource_group.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceListByResourceGroup.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/legacy/ServiceListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list_private_endpoint_connections.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list_private_endpoint_connections.py index 260cdc171fbf..bfbfb076b76d 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list_private_endpoint_connections.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list_private_endpoint_connections.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceListPrivateEndpointConnections.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/legacy/ServiceListPrivateEndpointConnections.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_patch.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_patch.py index 34ef8bc723ea..3345457a0ef0 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_patch.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_patch.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.healthcareapis import HealthcareApisManagementClient """ @@ -37,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServicePatch.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/legacy/ServicePatch.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/operation_results_get.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/operation_results_get.py index 788ad2c78dc8..153c91a54890 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/operation_results_get.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/operation_results_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/OperationResultsGet.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/OperationResultsGet.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/operations_list.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/operations_list.py index 5393940867ce..f7b9f626784c 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/operations_list.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/operations_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/OperationsList.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/OperationsList.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/private_link_resources_list_by_workspace.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/private_link_resources_list_by_workspace.py index 2dfacb8a9ca7..c527d1359b32 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/private_link_resources_list_by_workspace.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/private_link_resources_list_by_workspace.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/privatelink/PrivateLinkResourcesListByWorkspace.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/privatelink/PrivateLinkResourcesListByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_create_private_endpoint_connection.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_create_private_endpoint_connection.py index fa21fdb0d146..7c972e4d0004 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_create_private_endpoint_connection.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_create_private_endpoint_connection.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.healthcareapis import HealthcareApisManagementClient """ @@ -40,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/privatelink/WorkspaceCreatePrivateEndpointConnection.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/privatelink/WorkspaceCreatePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_delete_private_endpoint_connection.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_delete_private_endpoint_connection.py index 5d725c809c8c..759df5270669 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_delete_private_endpoint_connection.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_delete_private_endpoint_connection.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/privatelink/WorkspaceDeletePrivateEndpointConnection.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/privatelink/WorkspaceDeletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_get_private_endpoint_connection.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_get_private_endpoint_connection.py index da200b61557b..a1e13c3200fd 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_get_private_endpoint_connection.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_get_private_endpoint_connection.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/privatelink/WorkspaceGetPrivateEndpointConnection.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/privatelink/WorkspaceGetPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_list_private_endpoint_connections.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_list_private_endpoint_connections.py index b655aaa6fbbc..a4a3907d03a8 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_list_private_endpoint_connections.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_list_private_endpoint_connections.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/privatelink/WorkspaceListPrivateEndpointConnections.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/privatelink/WorkspaceListPrivateEndpointConnections.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_private_link_resource_get.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_private_link_resource_get.py index 6d9ec01a114e..1ccfd05d7c18 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_private_link_resource_get.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_private_link_resource_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/privatelink/WorkspacePrivateLinkResourceGet.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/privatelink/WorkspacePrivateLinkResourceGet.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_create.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_create.py index 02e2e700f1b7..6cef8564daa5 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_create.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_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.healthcareapis import HealthcareApisManagementClient """ @@ -37,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/workspaces/Workspaces_Create.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/workspaces/Workspaces_Create.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_delete.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_delete.py index ea2288d3a3fa..dc59fc1b9aa1 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_delete.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/workspaces/Workspaces_Delete.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/workspaces/Workspaces_Delete.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_get.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_get.py index 23c856cafa8c..2c4f129b22e4 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_get.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/workspaces/Workspaces_Get.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/workspaces/Workspaces_Get.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_list_by_resource_group.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_list_by_resource_group.py index 80d6a37e82bb..cd1accb45b2a 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_list_by_resource_group.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/workspaces/Workspaces_ListByResourceGroup.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/workspaces/Workspaces_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_list_by_subscription.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_list_by_subscription.py index 9ab7e4a44160..5e110f62bf5a 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_list_by_subscription.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_list_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.healthcareapis import HealthcareApisManagementClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/workspaces/Workspaces_ListBySubscription.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/workspaces/Workspaces_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_patch.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_patch.py index 68d06e30917d..fcb24b901feb 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_patch.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_patch.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.healthcareapis import HealthcareApisManagementClient """ @@ -37,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/workspaces/Workspaces_Patch.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2024-03-01/examples/workspaces/Workspaces_Patch.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/setup.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/setup.py index dce3a10698ef..0fb88ebc1513 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/setup.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/setup.py @@ -53,11 +53,11 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -74,10 +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", - "typing-extensions>=4.3.0; python_version<'3.8.0'", + "isodate>=0.6.1", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], - python_requires=">=3.7", + python_requires=">=3.8", )