Skip to content

Commit 22ef972

Browse files
author
SDKAuto
committed
CodeGen from PR 25875 in Azure/azure-rest-api-specs
Merge e0966eb64ceba97a08ff30df91c04c0bffb65f60 into 68d03f91ea7c30e1ab28fb9d35c13f81bc85b724
1 parent 7fe53da commit 22ef972

File tree

124 files changed

+1819
-706
lines changed

Some content is hidden

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

124 files changed

+1819
-706
lines changed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "dc92283b118284e79f4ed3837763e2bb079ffa09",
2+
"commit": "5d204ea06c977efa02583906feecfbf3d8f5390a",
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/postgresql/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.12 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
10-
"readme": "specification/postgresql/resource-manager/readme.md"
9+
"autorest_command": "autorest specification/mysql/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",
10+
"readme": "specification/mysql/resource-manager/readme.md"
1111
}

sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_serialization.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
662662
_serialized.update(_new_attr) # type: ignore
663663
_new_attr = _new_attr[k] # type: ignore
664664
_serialized = _serialized[k]
665-
except ValueError:
666-
continue
665+
except ValueError as err:
666+
if isinstance(err, SerializationError):
667+
raise
667668

668669
except (AttributeError, KeyError, TypeError) as err:
669670
msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj))
@@ -741,6 +742,8 @@ def query(self, name, data, data_type, **kwargs):
741742
742743
:param data: The data to be serialized.
743744
:param str data_type: The type to be serialized from.
745+
:keyword bool skip_quote: Whether to skip quote the serialized result.
746+
Defaults to False.
744747
:rtype: str
745748
:raises: TypeError if serialization fails.
746749
:raises: ValueError if data is None
@@ -749,10 +752,8 @@ def query(self, name, data, data_type, **kwargs):
749752
# Treat the list aside, since we don't want to encode the div separator
750753
if data_type.startswith("["):
751754
internal_data_type = data_type[1:-1]
752-
data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data]
753-
if not kwargs.get("skip_quote", False):
754-
data = [quote(str(d), safe="") for d in data]
755-
return str(self.serialize_iter(data, internal_data_type, **kwargs))
755+
do_quote = not kwargs.get("skip_quote", False)
756+
return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs))
756757

757758
# Not a list, regular serialization
758759
output = self.serialize_data(data, data_type, **kwargs)
@@ -891,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
891892
not be None or empty.
892893
:param str div: If set, this str will be used to combine the elements
893894
in the iterable into a combined string. Default is 'None'.
895+
:keyword bool do_quote: Whether to quote the serialized result of each iterable element.
896+
Defaults to False.
894897
:rtype: list, str
895898
"""
896899
if isinstance(data, str):
@@ -903,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
903906
for d in data:
904907
try:
905908
serialized.append(self.serialize_data(d, iter_type, **kwargs))
906-
except ValueError:
909+
except ValueError as err:
910+
if isinstance(err, SerializationError):
911+
raise
907912
serialized.append(None)
908913

914+
if kwargs.get("do_quote", False):
915+
serialized = ["" if s is None else quote(str(s), safe="") for s in serialized]
916+
909917
if div:
910918
serialized = ["" if s is None else str(s) for s in serialized]
911919
serialized = div.join(serialized)
@@ -950,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs):
950958
for key, value in attr.items():
951959
try:
952960
serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs)
953-
except ValueError:
961+
except ValueError as err:
962+
if isinstance(err, SerializationError):
963+
raise
954964
serialized[self.serialize_unicode(key)] = None
955965

956966
if "xml" in serialization_ctxt:

sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_vendor.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# --------------------------------------------------------------------------
77

88
from abc import ABC
9-
from typing import List, TYPE_CHECKING, cast
9+
from typing import TYPE_CHECKING
1010

1111
from azure.core.pipeline.transport import HttpRequest
1212

@@ -27,18 +27,6 @@ def _convert_request(request, files=None):
2727
return request
2828

2929

30-
def _format_url_section(template, **kwargs):
31-
components = template.split("/")
32-
while components:
33-
try:
34-
return template.format(**kwargs)
35-
except KeyError as key:
36-
# Need the cast, as for some reasons "split" is typed as list[str | Any]
37-
formatted_components = cast(List[str], template.split("/"))
38-
components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
39-
template = "/".join(components)
40-
41-
4230
class MySQLManagementClientMixinABC(ABC):
4331
"""DO NOT use this class. It is for internal typing use only."""
4432

sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
VERSION = "10.2.0b10"
9+
VERSION = "1.0.0b1"

sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_check_name_availability_operations.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# Code generated by Microsoft (R) AutoRest Code Generator.
77
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
88
# --------------------------------------------------------------------------
9+
from io import IOBase
910
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
1011

1112
from azure.core.exceptions import (
@@ -126,7 +127,7 @@ async def execute(
126127
content_type = content_type or "application/json"
127128
_json = None
128129
_content = None
129-
if isinstance(name_availability_request, (IO, bytes)):
130+
if isinstance(name_availability_request, (IOBase, bytes)):
130131
_content = name_availability_request
131132
else:
132133
_json = self._serialize.body(name_availability_request, "NameAvailabilityRequest")

sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_configurations_operations.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# Code generated by Microsoft (R) AutoRest Code Generator.
77
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
88
# --------------------------------------------------------------------------
9+
from io import IOBase
910
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
1011

1112
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -85,7 +86,7 @@ async def _create_or_update_initial(
8586
content_type = content_type or "application/json"
8687
_json = None
8788
_content = None
88-
if isinstance(parameters, (IO, bytes)):
89+
if isinstance(parameters, (IOBase, bytes)):
8990
_content = parameters
9091
else:
9192
_json = self._serialize.body(parameters, "Configuration")

sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_databases_operations.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# Code generated by Microsoft (R) AutoRest Code Generator.
77
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
88
# --------------------------------------------------------------------------
9+
from io import IOBase
910
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
1011

1112
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -86,7 +87,7 @@ async def _create_or_update_initial(
8687
content_type = content_type or "application/json"
8788
_json = None
8889
_content = None
89-
if isinstance(parameters, (IO, bytes)):
90+
if isinstance(parameters, (IOBase, bytes)):
9091
_content = parameters
9192
else:
9293
_json = self._serialize.body(parameters, "Database")

sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_firewall_rules_operations.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# Code generated by Microsoft (R) AutoRest Code Generator.
77
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
88
# --------------------------------------------------------------------------
9+
from io import IOBase
910
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
1011

1112
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -86,7 +87,7 @@ async def _create_or_update_initial(
8687
content_type = content_type or "application/json"
8788
_json = None
8889
_content = None
89-
if isinstance(parameters, (IO, bytes)):
90+
if isinstance(parameters, (IOBase, bytes)):
9091
_content = parameters
9192
else:
9293
_json = self._serialize.body(parameters, "FirewallRule")

sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_my_sql_management_client_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ async def reset_query_performance_insight_data(
102102
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/resetQueryPerformanceInsightData"
103103
}
104104

105-
async def _create_recommended_action_session_initial( # pylint: disable=inconsistent-return-statements,name-too-long
105+
async def _create_recommended_action_session_initial( # pylint: disable=inconsistent-return-statements
106106
self, resource_group_name: str, server_name: str, advisor_name: str, database_name: str, **kwargs: Any
107107
) -> None:
108108
error_map = {

sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_private_endpoint_connections_operations.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# Code generated by Microsoft (R) AutoRest Code Generator.
77
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
88
# --------------------------------------------------------------------------
9+
from io import IOBase
910
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
1011

1112
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -154,7 +155,7 @@ async def _create_or_update_initial(
154155
content_type = content_type or "application/json"
155156
_json = None
156157
_content = None
157-
if isinstance(parameters, (IO, bytes)):
158+
if isinstance(parameters, (IOBase, bytes)):
158159
_content = parameters
159160
else:
160161
_json = self._serialize.body(parameters, "PrivateEndpointConnection")
@@ -508,7 +509,7 @@ async def _update_tags_initial(
508509
content_type = content_type or "application/json"
509510
_json = None
510511
_content = None
511-
if isinstance(parameters, (IO, bytes)):
512+
if isinstance(parameters, (IOBase, bytes)):
512513
_content = parameters
513514
else:
514515
_json = self._serialize.body(parameters, "TagsObject")

0 commit comments

Comments
 (0)