Skip to content

Commit cf9067b

Browse files
authored
code and test (Azure#31490)
Co-authored-by: azure-sdk <PythonSdkPipelines>
1 parent 5f796d3 commit cf9067b

File tree

853 files changed

+50412
-11645
lines changed

Some content is hidden

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

853 files changed

+50412
-11645
lines changed

sdk/storage/azure-mgmt-storage/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Release History
22

3+
## 21.1.0 (2023-08-18)
4+
5+
### Features Added
6+
7+
- Added operation StorageAccountsOperations.begin_customer_initiated_migration
8+
- Added operation StorageAccountsOperations.get_customer_initiated_migration
9+
- Model BlobInventoryPolicyFilter has a new parameter creation_time
10+
- Model GeoReplicationStats has a new parameter can_planned_failover
11+
- Model GeoReplicationStats has a new parameter post_failover_redundancy
12+
- Model GeoReplicationStats has a new parameter post_planned_failover_redundancy
13+
- Model StorageAccount has a new parameter account_migration_in_progress
14+
- Model StorageAccount has a new parameter is_sku_conversion_blocked
15+
316
## 21.1.0b1 (2023-02-20)
417

518
### Other Changes

sdk/storage/azure-mgmt-storage/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ client = StorageManagementClient(credential=DefaultAzureCredential(), subscripti
4545

4646
## Examples
4747

48-
49-
Code samples for this package can be found at [Storage Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
48+
Code samples for this package can be found at:
49+
- [Search Storage Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com
50+
- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
5051

5152

5253
## Troubleshooting
Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
11
{
2-
"commit": "b9fb4f928d43473893bff4d6291098a8a75f3870",
2+
"commit": "a3089b2764df11b10a8a43e2a5a33dbe4d3653ca",
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.0",
7-
"@autorest/modelerfour@4.24.3"
6+
"@autorest/python@6.7.1",
7+
"@autorest/modelerfour@4.26.2"
88
],
9-
"autorest_command": "autorest specification/storage/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.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
10-
"readme": "specification/storage/resource-manager/readme.md"
9+
"autorest_command": "autorest specification/storage/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
10+
"readme": "specification/storage/resource-manager/readme.md",
11+
"package-2023-01": "2023-07-20 11:56:40 -0700 3e6b4ddca225530c27273d0f816466a905c0151b Microsoft.Storage/stable/2023-01-01/table.json",
12+
"package-2022-09": "2022-11-13 19:43:16 -0800 da0cfefaa0e6c237e1e3819f1cb2e11d7606878d Microsoft.Storage/stable/2022-09-01/table.json",
13+
"package-2022-05": "2022-08-10 02:57:56 +0000 a98a48c6aced55dcf941778feb4f64c61a4599d2 Microsoft.Storage/stable/2022-05-01/blob.json",
14+
"package-2021-09": "2022-03-23 21:52:24 -0700 ce6e1414f546d09834a24dc24814b2b8e932b1de Microsoft.Storage/stable/2021-09-01/table.json",
15+
"package-2021-08": "2022-01-25 09:45:23 +0800 d830271b241897bad300f9275ff7b27d502aa6c5 Microsoft.Storage/stable/2021-08-01/storage.json",
16+
"package-2021-06": "2021-12-15 14:27:32 +0800 58891380ba22c3565ca884dee3831445f638b545 Microsoft.Storage/stable/2021-06-01/table.json",
17+
"package-2021-04": "2021-05-25 21:31:32 -0700 603a4b41fe1100e273b79ef2de752710af724648 Microsoft.Storage/stable/2021-04-01/storage.json",
18+
"package-2021-02": "2021-04-08 13:28:48 +0800 4ab6b694b0e02e21b6db2ad4c543b84b8ea5599e Microsoft.Storage/stable/2021-02-01/storage.json",
19+
"package-2021-01": "2021-02-20 10:57:16 +0800 882cf967542d55b4c0ebeaaf18bd75429202219a Microsoft.Storage/stable/2021-01-01/file.json",
20+
"package-2020-08-preview": "2021-01-28 19:00:27 -0800 d1d09824d124b1b3f9e8ee477e4aeb553bcc3d98 Microsoft.Storage/preview/2020-08-01-preview/storage.json",
21+
"package-2019-06": "2021-01-29 00:17:50 -0800 9599cc10bee310950af608411568666585bdd7ba Microsoft.Storage/stable/2019-06-01/storage.json",
22+
"package-2019-04": "2021-01-28 18:52:41 -0800 007802587ab816c811c353c524df63b2958f3b89 Microsoft.Storage/stable/2019-04-01/storage.json",
23+
"package-2018-11": "2020-02-26 11:14:18 +0800 5181e9f4625fe5a20c86fb6ea8f2f798fce88593 Microsoft.Storage/stable/2018-11-01/storage.json",
24+
"package-2018-07-only": "2019-06-26 12:38:19 -0400 26df0a691d94445b2c96d348f5ecc31f6f9a2099 Microsoft.Storage/stable/2018-07-01/storage.json",
25+
"package-2018-03-preview-only": "2019-06-26 12:38:19 -0400 26df0a691d94445b2c96d348f5ecc31f6f9a2099 Microsoft.Storage/preview/2018-03-01-preview/storage.json",
26+
"package-2018-02": "2019-06-26 12:38:19 -0400 26df0a691d94445b2c96d348f5ecc31f6f9a2099 Microsoft.Storage/stable/2018-02-01/storage.json",
27+
"package-2017-10": "2019-06-26 12:38:19 -0400 26df0a691d94445b2c96d348f5ecc31f6f9a2099 Microsoft.Storage/stable/2017-10-01/storage.json",
28+
"package-2017-06": "2019-06-26 12:38:19 -0400 26df0a691d94445b2c96d348f5ecc31f6f9a2099 Microsoft.Storage/stable/2017-06-01/storage.json",
29+
"package-2016-12": "2020-05-21 10:20:08 +0200 db0f437ba79086e20570d648fe932c4266e7a7ed Microsoft.Storage/stable/2016-12-01/storage.json",
30+
"package-2016-01": "2019-06-26 12:38:19 -0400 26df0a691d94445b2c96d348f5ecc31f6f9a2099 Microsoft.Storage/stable/2016-01-01/storage.json",
31+
"package-2015-06": "2019-06-26 12:38:19 -0400 26df0a691d94445b2c96d348f5ecc31f6f9a2099 Microsoft.Storage/stable/2015-06-15/storage.json"
1132
}

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

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
631631
if xml_desc.get("attr", False):
632632
if xml_ns:
633633
ET.register_namespace(xml_prefix, xml_ns)
634-
xml_name = "{}{}".format(xml_ns, xml_name)
634+
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
635635
serialized.set(xml_name, new_attr) # type: ignore
636636
continue
637637
if xml_desc.get("text", False):
@@ -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:
@@ -1273,7 +1287,7 @@ def _extract_name_from_internal_type(internal_type):
12731287
xml_name = internal_type_xml_map.get("name", internal_type.__name__)
12741288
xml_ns = internal_type_xml_map.get("ns", None)
12751289
if xml_ns:
1276-
xml_name = "{}{}".format(xml_ns, xml_name)
1290+
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
12771291
return xml_name
12781292

12791293

@@ -1297,7 +1311,7 @@ def xml_key_extractor(attr, attr_desc, data):
12971311
# Integrate namespace if necessary
12981312
xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None))
12991313
if xml_ns:
1300-
xml_name = "{}{}".format(xml_ns, xml_name)
1314+
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
13011315

13021316
# If it's an attribute, that's simple
13031317
if xml_desc.get("attr", False):

0 commit comments

Comments
 (0)