Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR track2_azure-mgmt-eventhub] Ericchoi/main/event hub/2024 01 01 #5352

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions sdk/eventhub/azure-mgmt-eventhub/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
{
"commit": "8a28143c7271d4496296ed47f70c3cb5a9981e57",
"commit": "eb84a8e87831b63189b700427a973eb7aa9771f1",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"autorest": "3.9.7",
"use": [
"@autorest/python@6.4.7",
"@autorest/modelerfour@4.24.3"
"@autorest/python@6.7.1",
"@autorest/modelerfour@4.26.2"
],
"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/python@6.4.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
"readme": "specification/eventhub/resource-manager/readme.md"
"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/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
"readme": "specification/eventhub/resource-manager/readme.md",
"package-2021-11": "2022-11-29 14:20:04 +0530 d85953a9cb1b464824fae7c1fd300a99d086c8e4 Microsoft.EventHub/stable/2021-11-01/namespaces-preview.json",
"package-2022-01-preview": "2023-04-13 07:46:59 +0530 0a5ed101ca3f969cf50d420b5e6717cbdf1edb3c Microsoft.EventHub/preview/2022-01-01-preview/disasterRecoveryConfigs.json",
"package-2022-10-preview": "2023-06-04 23:37:07 -0700 83e7e598117cbd24cd0f032f4404a0711cf70497 Microsoft.EventHub/preview/2022-10-01-preview/eventhubs.json",
"package-2021-06-preview": "2021-09-16 00:30:29 -0700 c9992af7235a6550087d4fed8f081ed35019f605 Microsoft.EventHub/preview/2021-06-01-preview/quotaConfiguration-preview.json",
"package-2021-01-preview": "2021-06-02 19:37:56 -0700 916568aafe943c0be88e7f845d38de5f189d4b68 Microsoft.EventHub/preview/2021-01-01-preview/namespaces-preview.json",
"package-2018-01-preview": "2021-06-02 19:37:56 -0700 916568aafe943c0be88e7f845d38de5f189d4b68 Microsoft.EventHub/preview/2018-01-01-preview/namespaces-preview.json",
"package-2017-04": "2020-09-10 00:27:04 -0700 b813f80c7058b9ee180161f6eeb9ce45f2c7e197 Microsoft.EventHub/stable/2017-04-01/sku.json",
"package-2015-08": "2019-06-23 18:47:43 -0700 724c8cc36785a0a34d0ba5b6a48d1d7855be5ffb Microsoft.EventHub/stable/2015-08-01/EventHub.json"
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def __init__(
profile: KnownProfiles=KnownProfiles.default,
**kwargs: Any
):
if api_version:
kwargs.setdefault('api_version', api_version)
self._config = EventHubManagementClientConfiguration(credential, subscription_id, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
super(EventHubManagementClient, self).__init__(
Expand Down Expand Up @@ -137,7 +139,7 @@ def application_group(self):
else:
raise ValueError("API version {} does not have operation group 'application_group'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def clusters(self):
Expand All @@ -163,7 +165,7 @@ def clusters(self):
else:
raise ValueError("API version {} does not have operation group 'clusters'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def configuration(self):
Expand All @@ -189,7 +191,7 @@ def configuration(self):
else:
raise ValueError("API version {} does not have operation group 'configuration'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def consumer_groups(self):
Expand Down Expand Up @@ -224,7 +226,7 @@ def consumer_groups(self):
else:
raise ValueError("API version {} does not have operation group 'consumer_groups'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def disaster_recovery_configs(self):
Expand Down Expand Up @@ -256,7 +258,7 @@ def disaster_recovery_configs(self):
else:
raise ValueError("API version {} does not have operation group 'disaster_recovery_configs'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def event_hubs(self):
Expand Down Expand Up @@ -291,7 +293,7 @@ def event_hubs(self):
else:
raise ValueError("API version {} does not have operation group 'event_hubs'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def namespaces(self):
Expand Down Expand Up @@ -326,7 +328,7 @@ def namespaces(self):
else:
raise ValueError("API version {} does not have operation group 'namespaces'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def network_security_perimeter_configuration(self):
Expand All @@ -343,7 +345,7 @@ def network_security_perimeter_configuration(self):
else:
raise ValueError("API version {} does not have operation group 'network_security_perimeter_configuration'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def network_security_perimeter_configurations(self):
Expand All @@ -360,7 +362,7 @@ def network_security_perimeter_configurations(self):
else:
raise ValueError("API version {} does not have operation group 'network_security_perimeter_configurations'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def operations(self):
Expand Down Expand Up @@ -395,7 +397,7 @@ def operations(self):
else:
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def private_endpoint_connections(self):
Expand Down Expand Up @@ -424,7 +426,7 @@ def private_endpoint_connections(self):
else:
raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def private_link_resources(self):
Expand Down Expand Up @@ -453,7 +455,7 @@ def private_link_resources(self):
else:
raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def regions(self):
Expand All @@ -470,7 +472,7 @@ def regions(self):
else:
raise ValueError("API version {} does not have operation group 'regions'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def schema_registry(self):
Expand All @@ -490,7 +492,7 @@ def schema_registry(self):
else:
raise ValueError("API version {} does not have operation group 'schema_registry'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

def close(self):
self._client.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,8 +664,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
_serialized.update(_new_attr) # type: ignore
_new_attr = _new_attr[k] # type: ignore
_serialized = _serialized[k]
except ValueError:
continue
except ValueError as err:
if isinstance(err, SerializationError):
raise

except (AttributeError, KeyError, TypeError) as err:
msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj))
Expand Down Expand Up @@ -743,6 +744,8 @@ def query(self, name, data, data_type, **kwargs):

:param data: The data to be serialized.
:param str data_type: The type to be serialized from.
:keyword bool skip_quote: Whether to skip quote the serialized result.
Defaults to False.
:rtype: str
:raises: TypeError if serialization fails.
:raises: ValueError if data is None
Expand All @@ -751,10 +754,8 @@ def query(self, name, data, data_type, **kwargs):
# Treat the list aside, since we don't want to encode the div separator
if data_type.startswith("["):
internal_data_type = data_type[1:-1]
data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data]
if not kwargs.get("skip_quote", False):
data = [quote(str(d), safe="") for d in data]
return str(self.serialize_iter(data, internal_data_type, **kwargs))
do_quote = not kwargs.get('skip_quote', False)
return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs))

# Not a list, regular serialization
output = self.serialize_data(data, data_type, **kwargs)
Expand Down Expand Up @@ -893,6 +894,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
not be None or empty.
:param str div: If set, this str will be used to combine the elements
in the iterable into a combined string. Default is 'None'.
:keyword bool do_quote: Whether to quote the serialized result of each iterable element.
Defaults to False.
:rtype: list, str
"""
if isinstance(data, str):
Expand All @@ -905,9 +908,18 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
for d in data:
try:
serialized.append(self.serialize_data(d, iter_type, **kwargs))
except ValueError:
except ValueError as err:
if isinstance(err, SerializationError):
raise
serialized.append(None)

if kwargs.get('do_quote', False):
serialized = [
'' if s is None else quote(str(s), safe='')
for s
in serialized
]

if div:
serialized = ["" if s is None else str(s) for s in serialized]
serialized = div.join(serialized)
Expand Down Expand Up @@ -952,7 +964,9 @@ def serialize_dict(self, attr, dict_type, **kwargs):
for key, value in attr.items():
try:
serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs)
except ValueError:
except ValueError as err:
if isinstance(err, SerializationError):
raise
serialized[self.serialize_unicode(key)] = None

if "xml" in serialization_ctxt:
Expand Down
Loading