Skip to content

Commit 42eec51

Browse files
author
SDKAuto
committed
CodeGen from PR 26672 in Azure/azure-rest-api-specs
Merge adabec83cb1606aecc4fcbde19dbcaa28fbb72f4 into e237298f554742f54ab7e62c4a96080f972bcfa5
1 parent ca7bc6c commit 42eec51

File tree

241 files changed

+8788
-2356
lines changed

Some content is hidden

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

241 files changed

+8788
-2356
lines changed
Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
{
2-
"commit": "8a28143c7271d4496296ed47f70c3cb5a9981e57",
2+
"commit": "eb84a8e87831b63189b700427a973eb7aa9771f1",
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.7",
7-
"@autorest/modelerfour@4.24.3"
6+
"@autorest/python@6.7.1",
7+
"@autorest/modelerfour@4.26.2"
88
],
9-
"autorest_command": "autorest specification/eventhub/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/eventhub/resource-manager/readme.md"
9+
"autorest_command": "autorest specification/eventhub/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/eventhub/resource-manager/readme.md",
11+
"package-2021-11": "2022-11-29 14:20:04 +0530 d85953a9cb1b464824fae7c1fd300a99d086c8e4 Microsoft.EventHub/stable/2021-11-01/namespaces-preview.json",
12+
"package-2022-01-preview": "2023-04-13 07:46:59 +0530 0a5ed101ca3f969cf50d420b5e6717cbdf1edb3c Microsoft.EventHub/preview/2022-01-01-preview/disasterRecoveryConfigs.json",
13+
"package-2022-10-preview": "2023-06-04 23:37:07 -0700 83e7e598117cbd24cd0f032f4404a0711cf70497 Microsoft.EventHub/preview/2022-10-01-preview/eventhubs.json",
14+
"package-2021-06-preview": "2021-09-16 00:30:29 -0700 c9992af7235a6550087d4fed8f081ed35019f605 Microsoft.EventHub/preview/2021-06-01-preview/quotaConfiguration-preview.json",
15+
"package-2021-01-preview": "2021-06-02 19:37:56 -0700 916568aafe943c0be88e7f845d38de5f189d4b68 Microsoft.EventHub/preview/2021-01-01-preview/namespaces-preview.json",
16+
"package-2018-01-preview": "2021-06-02 19:37:56 -0700 916568aafe943c0be88e7f845d38de5f189d4b68 Microsoft.EventHub/preview/2018-01-01-preview/namespaces-preview.json",
17+
"package-2017-04": "2020-09-10 00:27:04 -0700 b813f80c7058b9ee180161f6eeb9ce45f2c7e197 Microsoft.EventHub/stable/2017-04-01/sku.json",
18+
"package-2015-08": "2019-06-23 18:47:43 -0700 724c8cc36785a0a34d0ba5b6a48d1d7855be5ffb Microsoft.EventHub/stable/2015-08-01/EventHub.json"
1119
}

sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_event_hub_management_client.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ def __init__(
7272
profile: KnownProfiles=KnownProfiles.default,
7373
**kwargs: Any
7474
):
75+
if api_version:
76+
kwargs.setdefault('api_version', api_version)
7577
self._config = EventHubManagementClientConfiguration(credential, subscription_id, **kwargs)
7678
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
7779
super(EventHubManagementClient, self).__init__(
@@ -137,7 +139,7 @@ def application_group(self):
137139
else:
138140
raise ValueError("API version {} does not have operation group 'application_group'".format(api_version))
139141
self._config.api_version = api_version
140-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
142+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
141143

142144
@property
143145
def clusters(self):
@@ -163,7 +165,7 @@ def clusters(self):
163165
else:
164166
raise ValueError("API version {} does not have operation group 'clusters'".format(api_version))
165167
self._config.api_version = api_version
166-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
168+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
167169

168170
@property
169171
def configuration(self):
@@ -189,7 +191,7 @@ def configuration(self):
189191
else:
190192
raise ValueError("API version {} does not have operation group 'configuration'".format(api_version))
191193
self._config.api_version = api_version
192-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
194+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
193195

194196
@property
195197
def consumer_groups(self):
@@ -224,7 +226,7 @@ def consumer_groups(self):
224226
else:
225227
raise ValueError("API version {} does not have operation group 'consumer_groups'".format(api_version))
226228
self._config.api_version = api_version
227-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
229+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
228230

229231
@property
230232
def disaster_recovery_configs(self):
@@ -256,7 +258,7 @@ def disaster_recovery_configs(self):
256258
else:
257259
raise ValueError("API version {} does not have operation group 'disaster_recovery_configs'".format(api_version))
258260
self._config.api_version = api_version
259-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
261+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
260262

261263
@property
262264
def event_hubs(self):
@@ -291,7 +293,7 @@ def event_hubs(self):
291293
else:
292294
raise ValueError("API version {} does not have operation group 'event_hubs'".format(api_version))
293295
self._config.api_version = api_version
294-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
296+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
295297

296298
@property
297299
def namespaces(self):
@@ -326,7 +328,7 @@ def namespaces(self):
326328
else:
327329
raise ValueError("API version {} does not have operation group 'namespaces'".format(api_version))
328330
self._config.api_version = api_version
329-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
331+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
330332

331333
@property
332334
def network_security_perimeter_configuration(self):
@@ -343,7 +345,7 @@ def network_security_perimeter_configuration(self):
343345
else:
344346
raise ValueError("API version {} does not have operation group 'network_security_perimeter_configuration'".format(api_version))
345347
self._config.api_version = api_version
346-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
348+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
347349

348350
@property
349351
def network_security_perimeter_configurations(self):
@@ -360,7 +362,7 @@ def network_security_perimeter_configurations(self):
360362
else:
361363
raise ValueError("API version {} does not have operation group 'network_security_perimeter_configurations'".format(api_version))
362364
self._config.api_version = api_version
363-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
365+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
364366

365367
@property
366368
def operations(self):
@@ -395,7 +397,7 @@ def operations(self):
395397
else:
396398
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
397399
self._config.api_version = api_version
398-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
400+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
399401

400402
@property
401403
def private_endpoint_connections(self):
@@ -424,7 +426,7 @@ def private_endpoint_connections(self):
424426
else:
425427
raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version))
426428
self._config.api_version = api_version
427-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
429+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
428430

429431
@property
430432
def private_link_resources(self):
@@ -453,7 +455,7 @@ def private_link_resources(self):
453455
else:
454456
raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version))
455457
self._config.api_version = api_version
456-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
458+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
457459

458460
@property
459461
def regions(self):
@@ -470,7 +472,7 @@ def regions(self):
470472
else:
471473
raise ValueError("API version {} does not have operation group 'regions'".format(api_version))
472474
self._config.api_version = api_version
473-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
475+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
474476

475477
@property
476478
def schema_registry(self):
@@ -490,7 +492,7 @@ def schema_registry(self):
490492
else:
491493
raise ValueError("API version {} does not have operation group 'schema_registry'".format(api_version))
492494
self._config.api_version = api_version
493-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
495+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
494496

495497
def close(self):
496498
self._client.close()

sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_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)