Skip to content

Commit a10324b

Browse files
author
SDKAuto
committed
CodeGen from PR 26207 in Azure/azure-rest-api-specs
Merge 93bc86baad6b726606f2e1115b93663c04fb021b into fe3f311a4d963b0e9b1c39d6f3859175189f0e90
1 parent e6127b6 commit a10324b

File tree

94 files changed

+9643
-257
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+9643
-257
lines changed
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
{
2-
"commit": "1fea23ac36b111293dc3efc30f725e9ebb790f7f",
2+
"commit": "0c115976508540feb1ecb3216b1d875d4ad1bb48",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.2",
4+
"autorest": "3.9.7",
55
"use": [
6-
"@autorest/python@6.4.12",
7-
"@autorest/modelerfour@4.24.3"
6+
"@autorest/python@6.7.1",
7+
"@autorest/modelerfour@4.26.2"
88
],
9-
"autorest_command": "autorest specification/resourcehealth/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
10-
"readme": "specification/resourcehealth/resource-manager/readme.md"
9+
"autorest_command": "autorest specification/resourcehealth/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.9.7 --version-tolerant=False",
10+
"readme": "specification/resourcehealth/resource-manager/readme.md",
11+
"package-preview-2023-10": "2023-10-09 01:38:27 -0700 d9f13b4f513be56ca9bb14e97f8a699ac9a5a1cc Microsoft.ResourceHealth/preview/2023-10-01-preview/ResourceHealth.json",
12+
"package-2022-10": "2023-03-30 22:08:54 -0700 635b756c218c138de49cf3f4a3204e75630fc300 Microsoft.ResourceHealth/stable/2022-10-01/ResourceHealth.json",
13+
"package-2018-07-01": "2023-03-29 21:56:50 -0700 f0e86b9b4ab51cddbc451c9ead25781b552342f0 Microsoft.ResourceHealth/stable/2018-07-01/ResourceHealth.json",
14+
"package-2015-01": "2023-03-29 21:56:50 -0700 f0e86b9b4ab51cddbc451c9ead25781b552342f0 Microsoft.ResourceHealth/stable/2015-01-01/resourcehealth.json"
1115
}

sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_resource_health_mgmt_client.py

Lines changed: 46 additions & 10 deletions
Large diffs are not rendered by default.

sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_serialization.py

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -664,8 +664,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
664664
_serialized.update(_new_attr) # type: ignore
665665
_new_attr = _new_attr[k] # type: ignore
666666
_serialized = _serialized[k]
667-
except ValueError:
668-
continue
667+
except ValueError as err:
668+
if isinstance(err, SerializationError):
669+
raise
669670

670671
except (AttributeError, KeyError, TypeError) as err:
671672
msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj))
@@ -743,6 +744,8 @@ def query(self, name, data, data_type, **kwargs):
743744
744745
:param data: The data to be serialized.
745746
:param str data_type: The type to be serialized from.
747+
:keyword bool skip_quote: Whether to skip quote the serialized result.
748+
Defaults to False.
746749
:rtype: str
747750
:raises: TypeError if serialization fails.
748751
:raises: ValueError if data is None
@@ -751,10 +754,8 @@ def query(self, name, data, data_type, **kwargs):
751754
# Treat the list aside, since we don't want to encode the div separator
752755
if data_type.startswith("["):
753756
internal_data_type = data_type[1:-1]
754-
data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data]
755-
if not kwargs.get("skip_quote", False):
756-
data = [quote(str(d), safe="") for d in data]
757-
return str(self.serialize_iter(data, internal_data_type, **kwargs))
757+
do_quote = not kwargs.get('skip_quote', False)
758+
return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs))
758759

759760
# Not a list, regular serialization
760761
output = self.serialize_data(data, data_type, **kwargs)
@@ -893,6 +894,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
893894
not be None or empty.
894895
:param str div: If set, this str will be used to combine the elements
895896
in the iterable into a combined string. Default is 'None'.
897+
:keyword bool do_quote: Whether to quote the serialized result of each iterable element.
898+
Defaults to False.
896899
:rtype: list, str
897900
"""
898901
if isinstance(data, str):
@@ -905,9 +908,18 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
905908
for d in data:
906909
try:
907910
serialized.append(self.serialize_data(d, iter_type, **kwargs))
908-
except ValueError:
911+
except ValueError as err:
912+
if isinstance(err, SerializationError):
913+
raise
909914
serialized.append(None)
910915

916+
if kwargs.get('do_quote', False):
917+
serialized = [
918+
'' if s is None else quote(str(s), safe='')
919+
for s
920+
in serialized
921+
]
922+
911923
if div:
912924
serialized = ["" if s is None else str(s) for s in serialized]
913925
serialized = div.join(serialized)
@@ -952,7 +964,9 @@ def serialize_dict(self, attr, dict_type, **kwargs):
952964
for key, value in attr.items():
953965
try:
954966
serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs)
955-
except ValueError:
967+
except ValueError as err:
968+
if isinstance(err, SerializationError):
969+
raise
956970
serialized[self.serialize_unicode(key)] = None
957971

958972
if "xml" in serialization_ctxt:

0 commit comments

Comments
 (0)