From 628a597a8933ca8db020bd4449b8894e7159756f Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 8 Apr 2025 09:49:26 +0000 Subject: [PATCH] CodeGen from PR 33240 in Azure/azure-rest-api-specs Merge 933efc21342dbe3e5a61a94c48a8cc7578a95457 into abb839b726184aa10f8d1eaac8e9fe590833619c --- .../CHANGELOG.md | 6 + .../azure-mgmt-healthdataaiservices/README.md | 2 +- .../_meta.json | 4 +- .../apiview-properties.json | 48 +++++ .../mgmt/healthdataaiservices/_model_base.py | 83 +++++++- .../azure/mgmt/healthdataaiservices/_patch.py | 9 +- .../healthdataaiservices/_serialization.py | 194 +++++------------- .../mgmt/healthdataaiservices/_version.py | 2 +- .../mgmt/healthdataaiservices/aio/_patch.py | 9 +- .../aio/operations/_operations.py | 82 ++++---- .../aio/operations/_patch.py | 9 +- .../healthdataaiservices/models/_models.py | 167 +++++++-------- .../healthdataaiservices/models/_patch.py | 9 +- .../operations/_operations.py | 102 ++++----- .../healthdataaiservices/operations/_patch.py | 9 +- .../azure-mgmt-healthdataaiservices/setup.py | 8 +- .../tsp-location.yaml | 2 +- 17 files changed, 411 insertions(+), 334 deletions(-) create mode 100644 sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/apiview-properties.json diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/CHANGELOG.md b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/CHANGELOG.md index de6d99c78c28..4da497d150c8 100644 --- a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/CHANGELOG.md +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 1.1.0 (2025-04-08) + +### Features Added + + - Method `Operation.__init__` has a new overload `def __init__(self: None, display: Optional[_models.OperationDisplay])` + ## 1.0.0 (2024-11-21) ### Breaking Changes diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/README.md b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/README.md index ad26f9a780a4..3cd7bcec8b2d 100644 --- a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/README.md +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/README.md @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/_meta.json b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/_meta.json index 64acfe34f449..f9a0286744e1 100644 --- a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/_meta.json +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/_meta.json @@ -1,6 +1,6 @@ { - "commit": "0410d404c68289cb1737d06bba92133bb84b515c", + "commit": "ab072b2effd79895e3ab4ff1c120e61e1c2ea7ba", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/healthdataaiservices/HealthDataAIServices.Management", - "@azure-tools/typespec-python": "0.36.1" + "@azure-tools/typespec-python": "0.42.2" } \ No newline at end of file diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/apiview-properties.json b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/apiview-properties.json new file mode 100644 index 000000000000..fc6180549273 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/apiview-properties.json @@ -0,0 +1,48 @@ +{ + "CrossLanguagePackageId": "Microsoft.HealthDataAIServices", + "CrossLanguageDefinitionId": { + "azure.mgmt.healthdataaiservices.models.DeidPropertiesUpdate": "Microsoft.HealthDataAIServices.DeidPropertiesUpdate", + "azure.mgmt.healthdataaiservices.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.healthdataaiservices.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.healthdataaiservices.models.DeidService": "Microsoft.HealthDataAIServices.DeidService", + "azure.mgmt.healthdataaiservices.models.DeidServiceProperties": "Microsoft.HealthDataAIServices.DeidServiceProperties", + "azure.mgmt.healthdataaiservices.models.DeidUpdate": "Microsoft.HealthDataAIServices.DeidUpdate", + "azure.mgmt.healthdataaiservices.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.healthdataaiservices.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.healthdataaiservices.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.healthdataaiservices.models.ManagedServiceIdentity": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity", + "azure.mgmt.healthdataaiservices.models.ManagedServiceIdentityUpdate": "Microsoft.HealthDataAIServices.ManagedServiceIdentityUpdate", + "azure.mgmt.healthdataaiservices.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", + "azure.mgmt.healthdataaiservices.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.mgmt.healthdataaiservices.models.PrivateEndpoint": "Azure.ResourceManager.CommonTypes.PrivateEndpoint", + "azure.mgmt.healthdataaiservices.models.PrivateEndpointConnection": "Azure.ResourceManager.CommonTypes.PrivateEndpointConnection", + "azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionProperties": "Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProperties", + "azure.mgmt.healthdataaiservices.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionResource": "Microsoft.HealthDataAIServices.PrivateEndpointConnectionResource", + "azure.mgmt.healthdataaiservices.models.PrivateLinkResource": "Microsoft.HealthDataAIServices.PrivateLinkResource", + "azure.mgmt.healthdataaiservices.models.PrivateLinkResourceProperties": "Azure.ResourceManager.CommonTypes.PrivateLinkResourceProperties", + "azure.mgmt.healthdataaiservices.models.PrivateLinkServiceConnectionState": "Azure.ResourceManager.CommonTypes.PrivateLinkServiceConnectionState", + "azure.mgmt.healthdataaiservices.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.healthdataaiservices.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity", + "azure.mgmt.healthdataaiservices.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.mgmt.healthdataaiservices.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.mgmt.healthdataaiservices.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.healthdataaiservices.models.ProvisioningState": "Microsoft.HealthDataAIServices.ProvisioningState", + "azure.mgmt.healthdataaiservices.models.PrivateEndpointServiceConnectionStatus": "Azure.ResourceManager.CommonTypes.PrivateEndpointServiceConnectionStatus", + "azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionProvisioningState": "Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProvisioningState", + "azure.mgmt.healthdataaiservices.models.PublicNetworkAccess": "Microsoft.HealthDataAIServices.PublicNetworkAccess", + "azure.mgmt.healthdataaiservices.models.ManagedServiceIdentityType": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType", + "azure.mgmt.healthdataaiservices.HealthDataAIServicesMgmtClient.operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.healthdataaiservices.HealthDataAIServicesMgmtClient.deid_services.get": "Microsoft.HealthDataAIServices.DeidServices.get", + "azure.mgmt.healthdataaiservices.HealthDataAIServicesMgmtClient.deid_services.list_by_resource_group": "Microsoft.HealthDataAIServices.DeidServices.listByResourceGroup", + "azure.mgmt.healthdataaiservices.HealthDataAIServicesMgmtClient.deid_services.list_by_subscription": "Microsoft.HealthDataAIServices.DeidServices.listBySubscription", + "azure.mgmt.healthdataaiservices.HealthDataAIServicesMgmtClient.deid_services.begin_create": "Microsoft.HealthDataAIServices.DeidServices.create", + "azure.mgmt.healthdataaiservices.HealthDataAIServicesMgmtClient.deid_services.begin_update": "Microsoft.HealthDataAIServices.DeidServices.update", + "azure.mgmt.healthdataaiservices.HealthDataAIServicesMgmtClient.deid_services.begin_delete": "Microsoft.HealthDataAIServices.DeidServices.delete", + "azure.mgmt.healthdataaiservices.HealthDataAIServicesMgmtClient.private_endpoint_connections.get": "Microsoft.HealthDataAIServices.PrivateEndpointConnections.get", + "azure.mgmt.healthdataaiservices.HealthDataAIServicesMgmtClient.private_endpoint_connections.begin_create": "Microsoft.HealthDataAIServices.PrivateEndpointConnections.create", + "azure.mgmt.healthdataaiservices.HealthDataAIServicesMgmtClient.private_endpoint_connections.begin_delete": "Microsoft.HealthDataAIServices.PrivateEndpointConnections.delete", + "azure.mgmt.healthdataaiservices.HealthDataAIServicesMgmtClient.private_endpoint_connections.list_by_deid_service": "Microsoft.HealthDataAIServices.PrivateEndpointConnections.listByDeidService", + "azure.mgmt.healthdataaiservices.HealthDataAIServicesMgmtClient.private_links.list_by_deid_service": "Microsoft.HealthDataAIServices.PrivateLinks.listByDeidService" + } +} \ No newline at end of file diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_model_base.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_model_base.py index e6a2730f9276..065b17f67c46 100644 --- a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_model_base.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_model_base.py @@ -2,8 +2,9 @@ # 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. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=protected-access, broad-except @@ -373,15 +374,34 @@ def __ne__(self, other: typing.Any) -> bool: return not self.__eq__(other) def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ return self._data.keys() def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ return self._data.values() def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ return self._data.items() def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ try: return self[key] except KeyError: @@ -397,17 +417,38 @@ def pop(self, key: str, default: _T) -> _T: ... def pop(self, key: str, default: typing.Any) -> typing.Any: ... def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ if default is _UNSET: return self._data.pop(key) return self._data.pop(key, default) def popitem(self) -> typing.Tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ return self._data.popitem() def clear(self) -> None: + """ + Remove all items from D. + """ self._data.clear() def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ self._data.update(*args, **kwargs) @typing.overload @@ -417,6 +458,13 @@ def setdefault(self, key: str, default: None = None) -> None: ... def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ if default is _UNSET: return self._data.setdefault(key) return self._data.setdefault(key, default) @@ -754,7 +802,7 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur except AttributeError: model_name = annotation if module is not None: - annotation = _get_model(module, model_name) + annotation = _get_model(module, model_name) # type: ignore try: if module and _is_model(annotation): @@ -894,6 +942,35 @@ def _deserialize( return _deserialize_with_callable(deserializer, value) +def _failsafe_deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, value, module, rf, format) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + value: typing.Any, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, value) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + class _RestField: def __init__( self, diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_patch.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_patch.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_serialization.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_serialization.py index ce17d1798ce7..eb86ea23c965 100644 --- a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_serialization.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_serialization.py @@ -1,28 +1,10 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -48,9 +30,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -61,13 +41,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -185,73 +165,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -479,8 +393,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -563,7 +477,7 @@ def _decode_attribute_map_key(key): return key.replace("\\.", ".") -class Serializer(object): # pylint: disable=too-many-public-methods +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -626,7 +540,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -736,8 +650,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -781,8 +695,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -805,8 +719,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -835,8 +749,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -855,9 +769,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1192,7 +1106,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1218,7 +1132,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1251,7 +1165,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1429,7 +1343,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1441,7 +1355,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1488,7 +1402,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1502,7 +1416,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1683,17 +1597,21 @@ def _instantiate_model(self, response, attrs, additional_properties=None): subtype = getattr(response, "_subtype_map", {}) try: readonly = [ - k for k, v in response._validation.items() if v.get("readonly") # pylint: disable=protected-access + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") ] const = [ - k for k, v in response._validation.items() if v.get("constant") # pylint: disable=protected-access + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore @@ -1713,7 +1631,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1795,7 +1713,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1841,7 +1759,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1932,7 +1850,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1945,7 +1863,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1960,7 +1878,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1978,7 +1896,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1991,7 +1909,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2009,7 +1927,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2025,7 +1943,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2040,14 +1958,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2063,7 +1981,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2101,7 +2019,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_version.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_version.py index 0ec13ea52bbf..ed0855dea5e6 100644 --- a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_version.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.1.0" diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/_patch.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/_patch.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/operations/_operations.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/operations/_operations.py index b861eb13b338..72084c608537 100644 --- a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/operations/_operations.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -12,6 +12,7 @@ from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -33,7 +34,8 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._model_base import SdkJSONEncoder, _deserialize +from ..._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._serialization import Deserializer, Serializer from ...operations._operations import ( build_deid_services_create_request, build_deid_services_delete_request, @@ -48,6 +50,7 @@ build_private_endpoint_connections_list_by_deid_service_request, build_private_links_list_by_deid_service_request, ) +from .._configuration import HealthDataAIServicesMgmtClientConfiguration if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -70,10 +73,12 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: HealthDataAIServicesMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -136,7 +141,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Operation], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -152,7 +157,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -172,10 +177,12 @@ class DeidServicesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: HealthDataAIServicesMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get(self, resource_group_name: str, deid_service_name: str, **kwargs: Any) -> _models.DeidService: @@ -230,7 +237,7 @@ async def get(self, resource_group_name: str, deid_service_name: str, **kwargs: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -309,7 +316,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DeidService], deserialized["value"]) + list_of_elem = _deserialize(List[_models.DeidService], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -325,7 +332,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -394,7 +401,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DeidService], deserialized["value"]) + list_of_elem = _deserialize(List[_models.DeidService], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -410,7 +417,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -473,7 +480,7 @@ async def _create_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -705,7 +712,7 @@ async def _update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -921,7 +928,7 @@ async def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1008,10 +1015,12 @@ class PrivateEndpointConnectionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: HealthDataAIServicesMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( @@ -1073,7 +1082,7 @@ async def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1144,7 +1153,7 @@ async def _create_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1385,7 +1394,7 @@ async def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1467,7 +1476,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list_by_deid_service( self, resource_group_name: str, deid_service_name: str, **kwargs: Any ) -> AsyncIterable["_models.PrivateEndpointConnectionResource"]: - # pylint: disable=line-too-long """List private endpoint connections on the given resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1535,7 +1543,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.PrivateEndpointConnectionResource], deserialized["value"]) + list_of_elem = _deserialize(List[_models.PrivateEndpointConnectionResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1551,7 +1559,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1571,10 +1579,12 @@ class PrivateLinksOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: HealthDataAIServicesMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_deid_service( @@ -1647,7 +1657,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.PrivateLinkResource], deserialized["value"]) + list_of_elem = _deserialize(List[_models.PrivateLinkResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1663,7 +1673,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/operations/_patch.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/operations/_patch.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/_models.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/_models.py index 612775b1c814..e31f42620c1a 100644 --- a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/_models.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/_models.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -26,7 +27,9 @@ class DeidPropertiesUpdate(_model_base.Model): ~azure.mgmt.healthdataaiservices.models.PublicNetworkAccess """ - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field(name="publicNetworkAccess") + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) """Gets or sets allow or disallow public network access to resource. Known values are: \"Enabled\" and \"Disabled\".""" @@ -51,10 +54,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class Resource(_model_base.Model): """Common fields that are returned in the response for all Azure Resource Manager resources. - Readonly 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}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -68,7 +69,7 @@ class Resource(_model_base.Model): id: Optional[str] = rest_field(visibility=["read"]) """Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long""" + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" name: Optional[str] = rest_field(visibility=["read"]) """The name of the resource.""" type: Optional[str] = rest_field(visibility=["read"]) @@ -82,11 +83,8 @@ class TrackedResource(Resource): """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - Readonly 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}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -102,7 +100,7 @@ class TrackedResource(Resource): :vartype location: str """ - tags: Optional[Dict[str, str]] = rest_field() + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags.""" location: str = rest_field(visibility=["read", "create"]) """The geo-location where the resource lives. Required.""" @@ -129,11 +127,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class DeidService(TrackedResource): """A HealthDataAIServicesProviderHub resource. - Readonly 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}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -153,9 +148,13 @@ class DeidService(TrackedResource): :vartype identity: ~azure.mgmt.healthdataaiservices.models.ManagedServiceIdentity """ - properties: Optional["_models.DeidServiceProperties"] = rest_field() + properties: Optional["_models.DeidServiceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" - identity: Optional["_models.ManagedServiceIdentity"] = rest_field() + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The managed service identities assigned to this resource.""" @overload @@ -182,8 +181,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class DeidServiceProperties(_model_base.Model): """Details of the HealthDataAIServices DeidService. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". :vartype provisioning_state: str or ~azure.mgmt.healthdataaiservices.models.ProvisioningState @@ -209,7 +206,9 @@ class DeidServiceProperties(_model_base.Model): name="privateEndpointConnections", visibility=["read"] ) """List of private endpoint connections.""" - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field(name="publicNetworkAccess") + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) """Gets or sets allow or disallow public network access to resource. Known values are: \"Enabled\" and \"Disabled\".""" @@ -242,11 +241,15 @@ class DeidUpdate(_model_base.Model): :vartype properties: ~azure.mgmt.healthdataaiservices.models.DeidPropertiesUpdate """ - tags: Optional[Dict[str, str]] = rest_field() + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags.""" - identity: Optional["_models.ManagedServiceIdentityUpdate"] = rest_field() + identity: Optional["_models.ManagedServiceIdentityUpdate"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """Updatable managed service identity.""" - properties: Optional["_models.DeidPropertiesUpdate"] = rest_field() + properties: Optional["_models.DeidPropertiesUpdate"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """RP-specific properties.""" @overload @@ -272,8 +275,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class ErrorAdditionalInfo(_model_base.Model): """The resource management error additional info. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. @@ -289,8 +290,6 @@ class ErrorAdditionalInfo(_model_base.Model): class ErrorDetail(_model_base.Model): """The error detail. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar code: The error code. :vartype code: str :ivar message: The error message. @@ -325,7 +324,7 @@ class ErrorResponse(_model_base.Model): :vartype error: ~azure.mgmt.healthdataaiservices.models.ErrorDetail """ - error: Optional["_models.ErrorDetail"] = rest_field() + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The error object.""" @overload @@ -349,9 +348,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class ManagedServiceIdentity(_model_base.Model): """Managed service identity (system assigned and/or user assigned identities). - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. :vartype principal_id: str @@ -372,11 +368,13 @@ class ManagedServiceIdentity(_model_base.Model): tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) """The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity.""" - type: Union[str, "_models.ManagedServiceIdentityType"] = rest_field() + type: Union[str, "_models.ManagedServiceIdentityType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The type of managed identity assigned to this resource. Required. Known values are: \"None\", \"SystemAssigned\", \"UserAssigned\", and \"SystemAssigned,UserAssigned\".""" user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = rest_field( - name="userAssignedIdentities" + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] ) """The identities assigned to this resource by the user.""" @@ -410,11 +408,13 @@ class ManagedServiceIdentityUpdate(_model_base.Model): ~azure.mgmt.healthdataaiservices.models.UserAssignedIdentity] """ - type: Optional[Union[str, "_models.ManagedServiceIdentityType"]] = rest_field() + type: Optional[Union[str, "_models.ManagedServiceIdentityType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The type of managed identity assigned to this resource. Known values are: \"None\", \"SystemAssigned\", \"UserAssigned\", and \"SystemAssigned,UserAssigned\".""" user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = rest_field( - name="userAssignedIdentities" + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] ) """The identities assigned to this resource by the user.""" @@ -440,8 +440,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class Operation(_model_base.Model): """Details of a REST API operation, returned from the Resource Provider Operations API. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". :vartype name: str @@ -466,13 +464,15 @@ class Operation(_model_base.Model): is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and \"false\" for Azure Resource Manager/control-plane operations.""" - display: Optional["_models.OperationDisplay"] = rest_field(visibility=["read"]) + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """Localized display information for this particular operation.""" origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and \"user,system\".""" - action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType") + action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"]) """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs. \"Internal\"""" @@ -480,7 +480,7 @@ class Operation(_model_base.Model): def __init__( self, *, - action_type: Optional[Union[str, "_models.ActionType"]] = None, + display: Optional["_models.OperationDisplay"] = None, ) -> None: ... @overload @@ -497,8 +497,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class OperationDisplay(_model_base.Model): """Localized display information for and operation. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". :vartype provider: str @@ -530,8 +528,6 @@ class OperationDisplay(_model_base.Model): class PrivateEndpoint(_model_base.Model): """The Private Endpoint resource. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The resource identifier for private endpoint. :vartype id: str """ @@ -543,10 +539,8 @@ class PrivateEndpoint(_model_base.Model): class PrivateEndpointConnection(Resource): """The private endpoint connection resource. - Readonly 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}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -561,7 +555,9 @@ class PrivateEndpointConnection(Resource): ~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionProperties """ - properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field() + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The private endpoint connection properties.""" @overload @@ -585,9 +581,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class PrivateEndpointConnectionProperties(_model_base.Model): """Properties of the private endpoint connection. - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar group_ids: The group ids for the private endpoint resource. :vartype group_ids: list[str] :ivar private_endpoint: The private endpoint resource. @@ -604,10 +597,12 @@ class PrivateEndpointConnectionProperties(_model_base.Model): group_ids: Optional[List[str]] = rest_field(name="groupIds", visibility=["read"]) """The group ids for the private endpoint resource.""" - private_endpoint: Optional["_models.PrivateEndpoint"] = rest_field(name="privateEndpoint") + private_endpoint: Optional["_models.PrivateEndpoint"] = rest_field( + name="privateEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) """The private endpoint resource.""" private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState" = rest_field( - name="privateLinkServiceConnectionState" + name="privateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"] ) """A collection of information about the state of the connection between service consumer and provider. Required.""" @@ -640,10 +635,8 @@ class ProxyResource(Resource): """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - Readonly 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}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -659,10 +652,8 @@ class ProxyResource(Resource): class PrivateEndpointConnectionResource(ProxyResource): """Holder for private endpoint connections. - Readonly 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}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -677,7 +668,9 @@ class PrivateEndpointConnectionResource(ProxyResource): ~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionProperties """ - properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field() + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" @overload @@ -701,10 +694,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class PrivateLinkResource(ProxyResource): """Private Links for DeidService resource. - Readonly 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}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -718,7 +709,9 @@ class PrivateLinkResource(ProxyResource): :vartype properties: ~azure.mgmt.healthdataaiservices.models.PrivateLinkResourceProperties """ - properties: Optional["_models.PrivateLinkResourceProperties"] = rest_field() + properties: Optional["_models.PrivateLinkResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" @overload @@ -742,8 +735,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class PrivateLinkResourceProperties(_model_base.Model): """Properties of a private link resource. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar group_id: The private link resource group id. :vartype group_id: str :ivar required_members: The private link resource required member names. @@ -756,7 +747,9 @@ class PrivateLinkResourceProperties(_model_base.Model): """The private link resource group id.""" required_members: Optional[List[str]] = rest_field(name="requiredMembers", visibility=["read"]) """The private link resource required member names.""" - required_zone_names: Optional[List[str]] = rest_field(name="requiredZoneNames") + required_zone_names: Optional[List[str]] = rest_field( + name="requiredZoneNames", visibility=["read", "create", "update", "delete", "query"] + ) """The private link resource private link DNS zone name.""" @overload @@ -792,12 +785,16 @@ class PrivateLinkServiceConnectionState(_model_base.Model): :vartype actions_required: str """ - status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = rest_field() + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Known values are: \"Pending\", \"Approved\", and \"Rejected\".""" - description: Optional[str] = rest_field() + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The reason for approval/rejection of the connection.""" - actions_required: Optional[str] = rest_field(name="actionsRequired") + actions_required: Optional[str] = rest_field( + name="actionsRequired", visibility=["read", "create", "update", "delete", "query"] + ) """A message indicating if changes on the service provider require any updates on the consumer.""" @overload @@ -839,19 +836,29 @@ class SystemData(_model_base.Model): :vartype last_modified_at: ~datetime.datetime """ - created_by: Optional[str] = rest_field(name="createdBy") + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) """The identity that created the resource.""" - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(name="createdByType") + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) """The type of identity that created the resource. Known values are: \"User\", \"Application\", \"ManagedIdentity\", and \"Key\".""" - created_at: Optional[datetime.datetime] = rest_field(name="createdAt", format="rfc3339") + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The timestamp of resource creation (UTC).""" - last_modified_by: Optional[str] = rest_field(name="lastModifiedBy") + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) """The identity that last modified the resource.""" - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(name="lastModifiedByType") + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) """The type of identity that last modified the resource. Known values are: \"User\", \"Application\", \"ManagedIdentity\", and \"Key\".""" - last_modified_at: Optional[datetime.datetime] = rest_field(name="lastModifiedAt", format="rfc3339") + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The timestamp of resource last modification (UTC).""" @overload @@ -880,15 +887,13 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class UserAssignedIdentity(_model_base.Model): """User assigned identity properties. - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the assigned identity. - :vartype principal_id: str :ivar client_id: The client ID of the assigned identity. :vartype client_id: str + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str """ - principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) - """The principal ID of the assigned identity.""" client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) """The client ID of the assigned identity.""" + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal ID of the assigned identity.""" diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/_patch.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/_patch.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/operations/_operations.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/operations/_operations.py index e3dbc9afd24e..4e55f51a3aac 100644 --- a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/operations/_operations.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -12,6 +12,7 @@ from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -32,8 +33,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._model_base import SdkJSONEncoder, _deserialize -from .._serialization import Serializer +from .._configuration import HealthDataAIServicesMgmtClientConfiguration +from .._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._serialization import Deserializer, Serializer if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -76,7 +78,7 @@ def build_deid_services_get_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -104,7 +106,7 @@ def build_deid_services_list_by_resource_group_request( # pylint: disable=name- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -158,7 +160,7 @@ def build_deid_services_create_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -189,7 +191,7 @@ def build_deid_services_update_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -219,7 +221,7 @@ def build_deid_services_delete_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -251,7 +253,7 @@ def build_private_endpoint_connections_get_request( # pylint: disable=name-too- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -287,7 +289,7 @@ def build_private_endpoint_connections_create_request( # pylint: disable=name-t accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -324,7 +326,7 @@ def build_private_endpoint_connections_delete_request( # pylint: disable=name-t accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -355,7 +357,7 @@ def build_private_endpoint_connections_list_by_deid_service_request( # pylint: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -383,7 +385,7 @@ def build_private_links_list_by_deid_service_request( # pylint: disable=name-to accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateLinkResources" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateLinkResources" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -413,10 +415,12 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: HealthDataAIServicesMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -478,7 +482,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Operation], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -494,7 +498,7 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -514,10 +518,12 @@ class DeidServicesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: HealthDataAIServicesMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get(self, resource_group_name: str, deid_service_name: str, **kwargs: Any) -> _models.DeidService: @@ -572,7 +578,7 @@ def get(self, resource_group_name: str, deid_service_name: str, **kwargs: Any) - except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -650,7 +656,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DeidService], deserialized["value"]) + list_of_elem = _deserialize(List[_models.DeidService], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -666,7 +672,7 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -734,7 +740,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DeidService], deserialized["value"]) + list_of_elem = _deserialize(List[_models.DeidService], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -750,7 +756,7 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -813,7 +819,7 @@ def _create_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1045,7 +1051,7 @@ def _update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1259,7 +1265,7 @@ def _delete_initial(self, resource_group_name: str, deid_service_name: str, **kw except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1344,10 +1350,12 @@ class PrivateEndpointConnectionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: HealthDataAIServicesMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( @@ -1409,7 +1417,7 @@ def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1480,7 +1488,7 @@ def _create_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1721,7 +1729,7 @@ def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1870,7 +1878,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.PrivateEndpointConnectionResource], deserialized["value"]) + list_of_elem = _deserialize(List[_models.PrivateEndpointConnectionResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1886,7 +1894,7 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1906,10 +1914,12 @@ class PrivateLinksOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: HealthDataAIServicesMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_deid_service( @@ -1982,7 +1992,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.PrivateLinkResource], deserialized["value"]) + list_of_elem = _deserialize(List[_models.PrivateLinkResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1998,7 +2008,7 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/operations/_patch.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/operations/_patch.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/setup.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/setup.py index e34f37b6dc01..f9f3a0c8001f 100644 --- a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/setup.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/setup.py @@ -22,11 +22,9 @@ # Version extraction inspired from 'requests' with open( - ( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py") - ), + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py"), "r", ) as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tsp-location.yaml b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tsp-location.yaml index 420eb7b1417e..094419182079 100644 --- a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tsp-location.yaml +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/healthdataaiservices/HealthDataAIServices.Management -commit: 0410d404c68289cb1737d06bba92133bb84b515c +commit: ab072b2effd79895e3ab4ff1c120e61e1c2ea7ba repo: Azure/azure-rest-api-specs additionalDirectories: