azure-mgmt-storage 22.1.1__py3-none-any.whl → 23.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. azure/mgmt/storage/__init__.py +19 -7
  2. azure/mgmt/storage/_configuration.py +27 -29
  3. azure/mgmt/storage/{v2016_01_01/models/_patch.py → _patch.py} +5 -4
  4. azure/mgmt/storage/_storage_management_client.py +184 -499
  5. azure/mgmt/storage/{v2016_01_01/_version.py → _utils/__init__.py} +0 -3
  6. azure/mgmt/storage/{_serialization.py → _utils/serialization.py} +46 -131
  7. azure/mgmt/storage/_version.py +1 -1
  8. azure/mgmt/storage/aio/__init__.py +21 -2
  9. azure/mgmt/storage/aio/_configuration.py +27 -29
  10. azure/mgmt/storage/{v2017_10_01/aio/operations → aio}/_patch.py +5 -4
  11. azure/mgmt/storage/aio/_storage_management_client.py +188 -497
  12. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/__init__.py +1 -0
  13. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_blob_containers_operations.py +66 -69
  14. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_blob_inventory_policies_operations.py +26 -34
  15. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_blob_services_operations.py +20 -22
  16. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_deleted_accounts_operations.py +14 -17
  17. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_encryption_scopes_operations.py +27 -30
  18. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_file_services_operations.py +24 -27
  19. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_file_shares_operations.py +36 -39
  20. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_local_users_operations.py +26 -29
  21. azure/mgmt/storage/{v2019_06_01/aio → aio}/operations/_management_policies_operations.py +23 -30
  22. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_network_security_perimeter_configurations_operations.py +16 -19
  23. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_object_replication_policies_operations.py +21 -23
  24. azure/mgmt/storage/{v2017_10_01/aio → aio}/operations/_operations.py +12 -15
  25. azure/mgmt/storage/{v2016_01_01/aio → aio}/operations/_patch.py +5 -4
  26. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_private_endpoint_connections_operations.py +21 -23
  27. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_private_link_resources_operations.py +11 -13
  28. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_queue_operations.py +27 -30
  29. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_queue_services_operations.py +19 -21
  30. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_skus_operations.py +12 -15
  31. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_storage_accounts_operations.py +81 -96
  32. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_storage_task_assignment_instances_report_operations.py +14 -16
  33. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_storage_task_assignments_instances_report_operations.py +14 -16
  34. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_storage_task_assignments_operations.py +30 -39
  35. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_table_operations.py +27 -29
  36. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_table_services_operations.py +19 -21
  37. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_usages_operations.py +12 -14
  38. azure/mgmt/storage/{v2024_01_01/models → models}/_models_py3.py +870 -927
  39. azure/mgmt/storage/{v2016_01_01/operations → models}/_patch.py +5 -4
  40. azure/mgmt/storage/{v2024_01_01/models → models}/_storage_management_client_enums.py +1 -0
  41. azure/mgmt/storage/{v2024_01_01/operations → operations}/__init__.py +1 -0
  42. azure/mgmt/storage/{v2024_01_01/operations → operations}/_blob_containers_operations.py +81 -84
  43. azure/mgmt/storage/{v2024_01_01/operations → operations}/_blob_inventory_policies_operations.py +31 -39
  44. azure/mgmt/storage/{v2024_01_01/operations → operations}/_blob_services_operations.py +24 -27
  45. azure/mgmt/storage/{v2024_01_01/operations → operations}/_deleted_accounts_operations.py +16 -18
  46. azure/mgmt/storage/{v2024_01_01/operations → operations}/_encryption_scopes_operations.py +32 -34
  47. azure/mgmt/storage/{v2024_01_01/operations → operations}/_file_services_operations.py +30 -32
  48. azure/mgmt/storage/{v2024_01_01/operations → operations}/_file_shares_operations.py +44 -47
  49. azure/mgmt/storage/{v2024_01_01/operations → operations}/_local_users_operations.py +33 -35
  50. azure/mgmt/storage/{v2024_01_01/operations → operations}/_management_policies_operations.py +27 -34
  51. azure/mgmt/storage/{v2024_01_01/operations → operations}/_network_security_perimeter_configurations_operations.py +20 -22
  52. azure/mgmt/storage/{v2024_01_01/operations → operations}/_object_replication_policies_operations.py +26 -29
  53. azure/mgmt/storage/{v2024_01_01/operations → operations}/_operations.py +12 -15
  54. azure/mgmt/storage/operations/_patch.py +21 -0
  55. azure/mgmt/storage/{v2024_01_01/operations → operations}/_private_endpoint_connections_operations.py +26 -29
  56. azure/mgmt/storage/{v2024_01_01/operations → operations}/_private_link_resources_operations.py +13 -15
  57. azure/mgmt/storage/{v2024_01_01/operations → operations}/_queue_operations.py +33 -35
  58. azure/mgmt/storage/{v2024_01_01/operations → operations}/_queue_services_operations.py +23 -25
  59. azure/mgmt/storage/{v2024_01_01/operations → operations}/_skus_operations.py +12 -15
  60. azure/mgmt/storage/{v2024_01_01/operations → operations}/_storage_accounts_operations.py +98 -106
  61. azure/mgmt/storage/{v2024_01_01/operations → operations}/_storage_task_assignment_instances_report_operations.py +15 -19
  62. azure/mgmt/storage/{v2024_01_01/operations → operations}/_storage_task_assignments_instances_report_operations.py +15 -19
  63. azure/mgmt/storage/{v2024_01_01/operations → operations}/_storage_task_assignments_operations.py +36 -47
  64. azure/mgmt/storage/{v2024_01_01/operations → operations}/_table_operations.py +33 -35
  65. azure/mgmt/storage/{v2024_01_01/operations → operations}/_table_services_operations.py +23 -25
  66. azure/mgmt/storage/{v2024_01_01/operations → operations}/_usages_operations.py +13 -16
  67. {azure_mgmt_storage-22.1.1.dist-info → azure_mgmt_storage-23.0.0.dist-info}/METADATA +20 -10
  68. azure_mgmt_storage-23.0.0.dist-info/RECORD +73 -0
  69. {azure_mgmt_storage-22.1.1.dist-info → azure_mgmt_storage-23.0.0.dist-info}/WHEEL +1 -1
  70. azure/mgmt/storage/models.py +0 -8
  71. azure/mgmt/storage/v2016_01_01/__init__.py +0 -32
  72. azure/mgmt/storage/v2016_01_01/_configuration.py +0 -65
  73. azure/mgmt/storage/v2016_01_01/_patch.py +0 -32
  74. azure/mgmt/storage/v2016_01_01/_storage_management_client.py +0 -117
  75. azure/mgmt/storage/v2016_01_01/aio/__init__.py +0 -29
  76. azure/mgmt/storage/v2016_01_01/aio/_configuration.py +0 -65
  77. azure/mgmt/storage/v2016_01_01/aio/_patch.py +0 -32
  78. azure/mgmt/storage/v2016_01_01/aio/_storage_management_client.py +0 -120
  79. azure/mgmt/storage/v2016_01_01/aio/operations/__init__.py +0 -27
  80. azure/mgmt/storage/v2016_01_01/aio/operations/_storage_accounts_operations.py +0 -1023
  81. azure/mgmt/storage/v2016_01_01/aio/operations/_usage_operations.py +0 -130
  82. azure/mgmt/storage/v2016_01_01/models/__init__.py +0 -88
  83. azure/mgmt/storage/v2016_01_01/models/_models_py3.py +0 -829
  84. azure/mgmt/storage/v2016_01_01/models/_storage_management_client_enums.py +0 -99
  85. azure/mgmt/storage/v2016_01_01/operations/__init__.py +0 -27
  86. azure/mgmt/storage/v2016_01_01/operations/_storage_accounts_operations.py +0 -1278
  87. azure/mgmt/storage/v2016_01_01/operations/_usage_operations.py +0 -157
  88. azure/mgmt/storage/v2016_01_01/py.typed +0 -1
  89. azure/mgmt/storage/v2017_10_01/__init__.py +0 -32
  90. azure/mgmt/storage/v2017_10_01/_configuration.py +0 -65
  91. azure/mgmt/storage/v2017_10_01/_patch.py +0 -32
  92. azure/mgmt/storage/v2017_10_01/_storage_management.py +0 -121
  93. azure/mgmt/storage/v2017_10_01/_version.py +0 -9
  94. azure/mgmt/storage/v2017_10_01/aio/__init__.py +0 -29
  95. azure/mgmt/storage/v2017_10_01/aio/_configuration.py +0 -65
  96. azure/mgmt/storage/v2017_10_01/aio/_patch.py +0 -32
  97. azure/mgmt/storage/v2017_10_01/aio/_storage_management.py +0 -124
  98. azure/mgmt/storage/v2017_10_01/aio/operations/__init__.py +0 -31
  99. azure/mgmt/storage/v2017_10_01/aio/operations/_skus_operations.py +0 -130
  100. azure/mgmt/storage/v2017_10_01/aio/operations/_storage_accounts_operations.py +0 -1299
  101. azure/mgmt/storage/v2017_10_01/aio/operations/_usage_operations.py +0 -130
  102. azure/mgmt/storage/v2017_10_01/models/__init__.py +0 -140
  103. azure/mgmt/storage/v2017_10_01/models/_models_py3.py +0 -1851
  104. azure/mgmt/storage/v2017_10_01/models/_patch.py +0 -20
  105. azure/mgmt/storage/v2017_10_01/models/_storage_management_enums.py +0 -192
  106. azure/mgmt/storage/v2017_10_01/operations/__init__.py +0 -31
  107. azure/mgmt/storage/v2017_10_01/operations/_operations.py +0 -151
  108. azure/mgmt/storage/v2017_10_01/operations/_patch.py +0 -20
  109. azure/mgmt/storage/v2017_10_01/operations/_skus_operations.py +0 -157
  110. azure/mgmt/storage/v2017_10_01/operations/_storage_accounts_operations.py +0 -1638
  111. azure/mgmt/storage/v2017_10_01/operations/_usage_operations.py +0 -157
  112. azure/mgmt/storage/v2017_10_01/py.typed +0 -1
  113. azure/mgmt/storage/v2019_06_01/__init__.py +0 -32
  114. azure/mgmt/storage/v2019_06_01/_configuration.py +0 -64
  115. azure/mgmt/storage/v2019_06_01/_patch.py +0 -32
  116. azure/mgmt/storage/v2019_06_01/_storage_management_client.py +0 -213
  117. azure/mgmt/storage/v2019_06_01/_version.py +0 -9
  118. azure/mgmt/storage/v2019_06_01/aio/__init__.py +0 -29
  119. azure/mgmt/storage/v2019_06_01/aio/_configuration.py +0 -64
  120. azure/mgmt/storage/v2019_06_01/aio/_patch.py +0 -32
  121. azure/mgmt/storage/v2019_06_01/aio/_storage_management_client.py +0 -217
  122. azure/mgmt/storage/v2019_06_01/aio/operations/__init__.py +0 -59
  123. azure/mgmt/storage/v2019_06_01/aio/operations/_blob_containers_operations.py +0 -1725
  124. azure/mgmt/storage/v2019_06_01/aio/operations/_blob_inventory_policies_operations.py +0 -437
  125. azure/mgmt/storage/v2019_06_01/aio/operations/_blob_services_operations.py +0 -368
  126. azure/mgmt/storage/v2019_06_01/aio/operations/_encryption_scopes_operations.py +0 -538
  127. azure/mgmt/storage/v2019_06_01/aio/operations/_file_services_operations.py +0 -335
  128. azure/mgmt/storage/v2019_06_01/aio/operations/_file_shares_operations.py +0 -771
  129. azure/mgmt/storage/v2019_06_01/aio/operations/_object_replication_policies_operations.py +0 -428
  130. azure/mgmt/storage/v2019_06_01/aio/operations/_operations.py +0 -130
  131. azure/mgmt/storage/v2019_06_01/aio/operations/_patch.py +0 -20
  132. azure/mgmt/storage/v2019_06_01/aio/operations/_private_endpoint_connections_operations.py +0 -424
  133. azure/mgmt/storage/v2019_06_01/aio/operations/_private_link_resources_operations.py +0 -113
  134. azure/mgmt/storage/v2019_06_01/aio/operations/_queue_operations.py +0 -597
  135. azure/mgmt/storage/v2019_06_01/aio/operations/_queue_services_operations.py +0 -335
  136. azure/mgmt/storage/v2019_06_01/aio/operations/_skus_operations.py +0 -131
  137. azure/mgmt/storage/v2019_06_01/aio/operations/_storage_accounts_operations.py +0 -1696
  138. azure/mgmt/storage/v2019_06_01/aio/operations/_table_operations.py +0 -394
  139. azure/mgmt/storage/v2019_06_01/aio/operations/_table_services_operations.py +0 -335
  140. azure/mgmt/storage/v2019_06_01/aio/operations/_usages_operations.py +0 -134
  141. azure/mgmt/storage/v2019_06_01/models/__init__.py +0 -364
  142. azure/mgmt/storage/v2019_06_01/models/_models_py3.py +0 -6038
  143. azure/mgmt/storage/v2019_06_01/models/_patch.py +0 -20
  144. azure/mgmt/storage/v2019_06_01/models/_storage_management_client_enums.py +0 -456
  145. azure/mgmt/storage/v2019_06_01/operations/__init__.py +0 -59
  146. azure/mgmt/storage/v2019_06_01/operations/_blob_containers_operations.py +0 -2226
  147. azure/mgmt/storage/v2019_06_01/operations/_blob_inventory_policies_operations.py +0 -582
  148. azure/mgmt/storage/v2019_06_01/operations/_blob_services_operations.py +0 -476
  149. azure/mgmt/storage/v2019_06_01/operations/_encryption_scopes_operations.py +0 -677
  150. azure/mgmt/storage/v2019_06_01/operations/_file_services_operations.py +0 -444
  151. azure/mgmt/storage/v2019_06_01/operations/_file_shares_operations.py +0 -1000
  152. azure/mgmt/storage/v2019_06_01/operations/_management_policies_operations.py +0 -453
  153. azure/mgmt/storage/v2019_06_01/operations/_object_replication_policies_operations.py +0 -567
  154. azure/mgmt/storage/v2019_06_01/operations/_operations.py +0 -151
  155. azure/mgmt/storage/v2019_06_01/operations/_patch.py +0 -20
  156. azure/mgmt/storage/v2019_06_01/operations/_private_endpoint_connections_operations.py +0 -575
  157. azure/mgmt/storage/v2019_06_01/operations/_private_link_resources_operations.py +0 -149
  158. azure/mgmt/storage/v2019_06_01/operations/_queue_operations.py +0 -805
  159. azure/mgmt/storage/v2019_06_01/operations/_queue_services_operations.py +0 -444
  160. azure/mgmt/storage/v2019_06_01/operations/_skus_operations.py +0 -157
  161. azure/mgmt/storage/v2019_06_01/operations/_storage_accounts_operations.py +0 -2122
  162. azure/mgmt/storage/v2019_06_01/operations/_table_operations.py +0 -563
  163. azure/mgmt/storage/v2019_06_01/operations/_table_services_operations.py +0 -444
  164. azure/mgmt/storage/v2019_06_01/operations/_usages_operations.py +0 -164
  165. azure/mgmt/storage/v2019_06_01/py.typed +0 -1
  166. azure/mgmt/storage/v2024_01_01/__init__.py +0 -32
  167. azure/mgmt/storage/v2024_01_01/_configuration.py +0 -64
  168. azure/mgmt/storage/v2024_01_01/_patch.py +0 -20
  169. azure/mgmt/storage/v2024_01_01/_storage_management_client.py +0 -256
  170. azure/mgmt/storage/v2024_01_01/_version.py +0 -9
  171. azure/mgmt/storage/v2024_01_01/aio/__init__.py +0 -29
  172. azure/mgmt/storage/v2024_01_01/aio/_configuration.py +0 -64
  173. azure/mgmt/storage/v2024_01_01/aio/_patch.py +0 -20
  174. azure/mgmt/storage/v2024_01_01/aio/_storage_management_client.py +0 -261
  175. azure/mgmt/storage/v2024_01_01/aio/operations/_management_policies_operations.py +0 -343
  176. azure/mgmt/storage/v2024_01_01/aio/operations/_operations.py +0 -130
  177. azure/mgmt/storage/v2024_01_01/aio/operations/_patch.py +0 -20
  178. azure/mgmt/storage/v2024_01_01/models/_patch.py +0 -20
  179. azure/mgmt/storage/v2024_01_01/operations/_patch.py +0 -20
  180. azure/mgmt/storage/v2024_01_01/py.typed +0 -1
  181. azure_mgmt_storage-22.1.1.dist-info/RECORD +0 -183
  182. /azure/mgmt/storage/{v2024_01_01/models → models}/__init__.py +0 -0
  183. {azure_mgmt_storage-22.1.1.dist-info → azure_mgmt_storage-23.0.0.dist-info}/LICENSE +0 -0
  184. {azure_mgmt_storage-22.1.1.dist-info → azure_mgmt_storage-23.0.0.dist-info}/top_level.txt +0 -0
@@ -1,2122 +0,0 @@
1
- # pylint: disable=too-many-lines
2
- # coding=utf-8
3
- # --------------------------------------------------------------------------
4
- # Copyright (c) Microsoft Corporation. All rights reserved.
5
- # Licensed under the MIT License. See License.txt in the project root for license information.
6
- # Code generated by Microsoft (R) AutoRest Code Generator.
7
- # Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
- # --------------------------------------------------------------------------
9
- from io import IOBase
10
- import sys
11
- from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload
12
- import urllib.parse
13
-
14
- from azure.core.exceptions import (
15
- ClientAuthenticationError,
16
- HttpResponseError,
17
- ResourceExistsError,
18
- ResourceNotFoundError,
19
- ResourceNotModifiedError,
20
- StreamClosedError,
21
- StreamConsumedError,
22
- map_error,
23
- )
24
- from azure.core.paging import ItemPaged
25
- from azure.core.pipeline import PipelineResponse
26
- from azure.core.polling import LROPoller, NoPolling, PollingMethod
27
- from azure.core.rest import HttpRequest, HttpResponse
28
- from azure.core.tracing.decorator import distributed_trace
29
- from azure.core.utils import case_insensitive_dict
30
- from azure.mgmt.core.exceptions import ARMErrorFormat
31
- from azure.mgmt.core.polling.arm_polling import ARMPolling
32
-
33
- from .. import models as _models
34
- from ..._serialization import Serializer
35
-
36
- if sys.version_info >= (3, 9):
37
- from collections.abc import MutableMapping
38
- else:
39
- from typing import MutableMapping # type: ignore
40
- T = TypeVar("T")
41
- ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
42
-
43
- _SERIALIZER = Serializer()
44
- _SERIALIZER.client_side_validation = False
45
-
46
-
47
- def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
48
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
49
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
50
-
51
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01"))
52
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
53
- accept = _headers.pop("Accept", "application/json")
54
-
55
- # Construct URL
56
- _url = kwargs.pop(
57
- "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability"
58
- )
59
- path_format_arguments = {
60
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
61
- }
62
-
63
- _url: str = _url.format(**path_format_arguments) # type: ignore
64
-
65
- # Construct parameters
66
- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
67
-
68
- # Construct headers
69
- if content_type is not None:
70
- _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
71
- _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
72
-
73
- return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
74
-
75
-
76
- def build_create_request(
77
- resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any
78
- ) -> HttpRequest:
79
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
80
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
81
-
82
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01"))
83
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
84
- accept = _headers.pop("Accept", "application/json")
85
-
86
- # Construct URL
87
- _url = kwargs.pop(
88
- "template_url",
89
- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}",
90
- ) # pylint: disable=line-too-long
91
- path_format_arguments = {
92
- "resourceGroupName": _SERIALIZER.url(
93
- "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$"
94
- ),
95
- "accountName": _SERIALIZER.url("account_name", account_name, "str", max_length=24, min_length=3),
96
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
97
- }
98
-
99
- _url: str = _url.format(**path_format_arguments) # type: ignore
100
-
101
- # Construct parameters
102
- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
103
-
104
- # Construct headers
105
- if content_type is not None:
106
- _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
107
- _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
108
-
109
- return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
110
-
111
-
112
- def build_delete_request(
113
- resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any
114
- ) -> HttpRequest:
115
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
116
-
117
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01"))
118
- # Construct URL
119
- _url = kwargs.pop(
120
- "template_url",
121
- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}",
122
- ) # pylint: disable=line-too-long
123
- path_format_arguments = {
124
- "resourceGroupName": _SERIALIZER.url(
125
- "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$"
126
- ),
127
- "accountName": _SERIALIZER.url("account_name", account_name, "str", max_length=24, min_length=3),
128
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
129
- }
130
-
131
- _url: str = _url.format(**path_format_arguments) # type: ignore
132
-
133
- # Construct parameters
134
- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
135
-
136
- return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs)
137
-
138
-
139
- def build_get_properties_request(
140
- resource_group_name: str,
141
- account_name: str,
142
- subscription_id: str,
143
- *,
144
- expand: Optional[Union[str, _models.StorageAccountExpand]] = None,
145
- **kwargs: Any
146
- ) -> HttpRequest:
147
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
148
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
149
-
150
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01"))
151
- accept = _headers.pop("Accept", "application/json")
152
-
153
- # Construct URL
154
- _url = kwargs.pop(
155
- "template_url",
156
- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}",
157
- ) # pylint: disable=line-too-long
158
- path_format_arguments = {
159
- "resourceGroupName": _SERIALIZER.url(
160
- "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$"
161
- ),
162
- "accountName": _SERIALIZER.url("account_name", account_name, "str", max_length=24, min_length=3),
163
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
164
- }
165
-
166
- _url: str = _url.format(**path_format_arguments) # type: ignore
167
-
168
- # Construct parameters
169
- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
170
- if expand is not None:
171
- _params["$expand"] = _SERIALIZER.query("expand", expand, "str")
172
-
173
- # Construct headers
174
- _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
175
-
176
- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
177
-
178
-
179
- def build_update_request(
180
- resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any
181
- ) -> HttpRequest:
182
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
183
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
184
-
185
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01"))
186
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
187
- accept = _headers.pop("Accept", "application/json")
188
-
189
- # Construct URL
190
- _url = kwargs.pop(
191
- "template_url",
192
- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}",
193
- ) # pylint: disable=line-too-long
194
- path_format_arguments = {
195
- "resourceGroupName": _SERIALIZER.url(
196
- "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$"
197
- ),
198
- "accountName": _SERIALIZER.url("account_name", account_name, "str", max_length=24, min_length=3),
199
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
200
- }
201
-
202
- _url: str = _url.format(**path_format_arguments) # type: ignore
203
-
204
- # Construct parameters
205
- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
206
-
207
- # Construct headers
208
- if content_type is not None:
209
- _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
210
- _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
211
-
212
- return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
213
-
214
-
215
- def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
216
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
217
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
218
-
219
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01"))
220
- accept = _headers.pop("Accept", "application/json")
221
-
222
- # Construct URL
223
- _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts")
224
- path_format_arguments = {
225
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
226
- }
227
-
228
- _url: str = _url.format(**path_format_arguments) # type: ignore
229
-
230
- # Construct parameters
231
- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
232
-
233
- # Construct headers
234
- _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
235
-
236
- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
237
-
238
-
239
- def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
240
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
241
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
242
-
243
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01"))
244
- accept = _headers.pop("Accept", "application/json")
245
-
246
- # Construct URL
247
- _url = kwargs.pop(
248
- "template_url",
249
- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts",
250
- ) # pylint: disable=line-too-long
251
- path_format_arguments = {
252
- "resourceGroupName": _SERIALIZER.url(
253
- "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$"
254
- ),
255
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
256
- }
257
-
258
- _url: str = _url.format(**path_format_arguments) # type: ignore
259
-
260
- # Construct parameters
261
- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
262
-
263
- # Construct headers
264
- _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
265
-
266
- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
267
-
268
-
269
- def build_list_keys_request(
270
- resource_group_name: str,
271
- account_name: str,
272
- subscription_id: str,
273
- *,
274
- expand: Literal["kerb"] = "kerb",
275
- **kwargs: Any
276
- ) -> HttpRequest:
277
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
278
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
279
-
280
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01"))
281
- accept = _headers.pop("Accept", "application/json")
282
-
283
- # Construct URL
284
- _url = kwargs.pop(
285
- "template_url",
286
- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys",
287
- ) # pylint: disable=line-too-long
288
- path_format_arguments = {
289
- "resourceGroupName": _SERIALIZER.url(
290
- "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$"
291
- ),
292
- "accountName": _SERIALIZER.url("account_name", account_name, "str", max_length=24, min_length=3),
293
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
294
- }
295
-
296
- _url: str = _url.format(**path_format_arguments) # type: ignore
297
-
298
- # Construct parameters
299
- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
300
- if expand is not None:
301
- _params["$expand"] = _SERIALIZER.query("expand", expand, "str")
302
-
303
- # Construct headers
304
- _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
305
-
306
- return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
307
-
308
-
309
- def build_regenerate_key_request(
310
- resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any
311
- ) -> HttpRequest:
312
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
313
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
314
-
315
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01"))
316
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
317
- accept = _headers.pop("Accept", "application/json")
318
-
319
- # Construct URL
320
- _url = kwargs.pop(
321
- "template_url",
322
- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey",
323
- ) # pylint: disable=line-too-long
324
- path_format_arguments = {
325
- "resourceGroupName": _SERIALIZER.url(
326
- "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$"
327
- ),
328
- "accountName": _SERIALIZER.url("account_name", account_name, "str", max_length=24, min_length=3),
329
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
330
- }
331
-
332
- _url: str = _url.format(**path_format_arguments) # type: ignore
333
-
334
- # Construct parameters
335
- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
336
-
337
- # Construct headers
338
- if content_type is not None:
339
- _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
340
- _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
341
-
342
- return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
343
-
344
-
345
- def build_list_account_sas_request(
346
- resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any
347
- ) -> HttpRequest:
348
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
349
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
350
-
351
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01"))
352
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
353
- accept = _headers.pop("Accept", "application/json")
354
-
355
- # Construct URL
356
- _url = kwargs.pop(
357
- "template_url",
358
- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas",
359
- ) # pylint: disable=line-too-long
360
- path_format_arguments = {
361
- "resourceGroupName": _SERIALIZER.url(
362
- "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$"
363
- ),
364
- "accountName": _SERIALIZER.url("account_name", account_name, "str", max_length=24, min_length=3),
365
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
366
- }
367
-
368
- _url: str = _url.format(**path_format_arguments) # type: ignore
369
-
370
- # Construct parameters
371
- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
372
-
373
- # Construct headers
374
- if content_type is not None:
375
- _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
376
- _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
377
-
378
- return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
379
-
380
-
381
- def build_list_service_sas_request(
382
- resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any
383
- ) -> HttpRequest:
384
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
385
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
386
-
387
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01"))
388
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
389
- accept = _headers.pop("Accept", "application/json")
390
-
391
- # Construct URL
392
- _url = kwargs.pop(
393
- "template_url",
394
- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas",
395
- ) # pylint: disable=line-too-long
396
- path_format_arguments = {
397
- "resourceGroupName": _SERIALIZER.url(
398
- "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$"
399
- ),
400
- "accountName": _SERIALIZER.url("account_name", account_name, "str", max_length=24, min_length=3),
401
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
402
- }
403
-
404
- _url: str = _url.format(**path_format_arguments) # type: ignore
405
-
406
- # Construct parameters
407
- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
408
-
409
- # Construct headers
410
- if content_type is not None:
411
- _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
412
- _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
413
-
414
- return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
415
-
416
-
417
- def build_failover_request(
418
- resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any
419
- ) -> HttpRequest:
420
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
421
-
422
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01"))
423
- # Construct URL
424
- _url = kwargs.pop(
425
- "template_url",
426
- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover",
427
- ) # pylint: disable=line-too-long
428
- path_format_arguments = {
429
- "resourceGroupName": _SERIALIZER.url(
430
- "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$"
431
- ),
432
- "accountName": _SERIALIZER.url("account_name", account_name, "str", max_length=24, min_length=3),
433
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
434
- }
435
-
436
- _url: str = _url.format(**path_format_arguments) # type: ignore
437
-
438
- # Construct parameters
439
- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
440
-
441
- return HttpRequest(method="POST", url=_url, params=_params, **kwargs)
442
-
443
-
444
- def build_restore_blob_ranges_request(
445
- resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any
446
- ) -> HttpRequest:
447
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
448
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
449
-
450
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01"))
451
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
452
- accept = _headers.pop("Accept", "application/json")
453
-
454
- # Construct URL
455
- _url = kwargs.pop(
456
- "template_url",
457
- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges",
458
- ) # pylint: disable=line-too-long
459
- path_format_arguments = {
460
- "resourceGroupName": _SERIALIZER.url(
461
- "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$"
462
- ),
463
- "accountName": _SERIALIZER.url("account_name", account_name, "str", max_length=24, min_length=3),
464
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
465
- }
466
-
467
- _url: str = _url.format(**path_format_arguments) # type: ignore
468
-
469
- # Construct parameters
470
- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
471
-
472
- # Construct headers
473
- if content_type is not None:
474
- _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
475
- _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
476
-
477
- return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
478
-
479
-
480
- def build_revoke_user_delegation_keys_request( # pylint: disable=name-too-long
481
- resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any
482
- ) -> HttpRequest:
483
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
484
-
485
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01"))
486
- # Construct URL
487
- _url = kwargs.pop(
488
- "template_url",
489
- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys",
490
- ) # pylint: disable=line-too-long
491
- path_format_arguments = {
492
- "resourceGroupName": _SERIALIZER.url(
493
- "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$"
494
- ),
495
- "accountName": _SERIALIZER.url("account_name", account_name, "str", max_length=24, min_length=3),
496
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
497
- }
498
-
499
- _url: str = _url.format(**path_format_arguments) # type: ignore
500
-
501
- # Construct parameters
502
- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
503
-
504
- return HttpRequest(method="POST", url=_url, params=_params, **kwargs)
505
-
506
-
507
- class StorageAccountsOperations:
508
- """
509
- .. warning::
510
- **DO NOT** instantiate this class directly.
511
-
512
- Instead, you should access the following operations through
513
- :class:`~azure.mgmt.storage.v2019_06_01.StorageManagementClient`'s
514
- :attr:`storage_accounts` attribute.
515
- """
516
-
517
- models = _models
518
-
519
- def __init__(self, *args, **kwargs):
520
- input_args = list(args)
521
- self._client = input_args.pop(0) if input_args else kwargs.pop("client")
522
- self._config = input_args.pop(0) if input_args else kwargs.pop("config")
523
- self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
524
- self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
525
- self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
526
-
527
- @overload
528
- def check_name_availability(
529
- self,
530
- account_name: _models.StorageAccountCheckNameAvailabilityParameters,
531
- *,
532
- content_type: str = "application/json",
533
- **kwargs: Any
534
- ) -> _models.CheckNameAvailabilityResult:
535
- """Checks that the storage account name is valid and is not already in use.
536
-
537
- :param account_name: The name of the storage account within the specified resource group.
538
- Storage account names must be between 3 and 24 characters in length and use numbers and
539
- lower-case letters only. Required.
540
- :type account_name:
541
- ~azure.mgmt.storage.v2019_06_01.models.StorageAccountCheckNameAvailabilityParameters
542
- :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
543
- Default value is "application/json".
544
- :paramtype content_type: str
545
- :return: CheckNameAvailabilityResult or the result of cls(response)
546
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.CheckNameAvailabilityResult
547
- :raises ~azure.core.exceptions.HttpResponseError:
548
- """
549
-
550
- @overload
551
- def check_name_availability(
552
- self, account_name: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
553
- ) -> _models.CheckNameAvailabilityResult:
554
- """Checks that the storage account name is valid and is not already in use.
555
-
556
- :param account_name: The name of the storage account within the specified resource group.
557
- Storage account names must be between 3 and 24 characters in length and use numbers and
558
- lower-case letters only. Required.
559
- :type account_name: IO[bytes]
560
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
561
- Default value is "application/json".
562
- :paramtype content_type: str
563
- :return: CheckNameAvailabilityResult or the result of cls(response)
564
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.CheckNameAvailabilityResult
565
- :raises ~azure.core.exceptions.HttpResponseError:
566
- """
567
-
568
- @distributed_trace
569
- def check_name_availability(
570
- self, account_name: Union[_models.StorageAccountCheckNameAvailabilityParameters, IO[bytes]], **kwargs: Any
571
- ) -> _models.CheckNameAvailabilityResult:
572
- """Checks that the storage account name is valid and is not already in use.
573
-
574
- :param account_name: The name of the storage account within the specified resource group.
575
- Storage account names must be between 3 and 24 characters in length and use numbers and
576
- lower-case letters only. Is either a StorageAccountCheckNameAvailabilityParameters type or a
577
- IO[bytes] type. Required.
578
- :type account_name:
579
- ~azure.mgmt.storage.v2019_06_01.models.StorageAccountCheckNameAvailabilityParameters or
580
- IO[bytes]
581
- :return: CheckNameAvailabilityResult or the result of cls(response)
582
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.CheckNameAvailabilityResult
583
- :raises ~azure.core.exceptions.HttpResponseError:
584
- """
585
- error_map: MutableMapping = {
586
- 401: ClientAuthenticationError,
587
- 404: ResourceNotFoundError,
588
- 409: ResourceExistsError,
589
- 304: ResourceNotModifiedError,
590
- }
591
- error_map.update(kwargs.pop("error_map", {}) or {})
592
-
593
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
594
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
595
-
596
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
597
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
598
- cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None)
599
-
600
- content_type = content_type or "application/json"
601
- _json = None
602
- _content = None
603
- if isinstance(account_name, (IOBase, bytes)):
604
- _content = account_name
605
- else:
606
- _json = self._serialize.body(account_name, "StorageAccountCheckNameAvailabilityParameters")
607
-
608
- _request = build_check_name_availability_request(
609
- subscription_id=self._config.subscription_id,
610
- api_version=api_version,
611
- content_type=content_type,
612
- json=_json,
613
- content=_content,
614
- headers=_headers,
615
- params=_params,
616
- )
617
- _request.url = self._client.format_url(_request.url)
618
-
619
- _stream = False
620
- pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
621
- _request, stream=_stream, **kwargs
622
- )
623
-
624
- response = pipeline_response.http_response
625
-
626
- if response.status_code not in [200]:
627
- map_error(status_code=response.status_code, response=response, error_map=error_map)
628
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
629
-
630
- deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response)
631
-
632
- if cls:
633
- return cls(pipeline_response, deserialized, {}) # type: ignore
634
-
635
- return deserialized # type: ignore
636
-
637
- def _create_initial(
638
- self,
639
- resource_group_name: str,
640
- account_name: str,
641
- parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]],
642
- **kwargs: Any
643
- ) -> Iterator[bytes]:
644
- error_map: MutableMapping = {
645
- 401: ClientAuthenticationError,
646
- 404: ResourceNotFoundError,
647
- 409: ResourceExistsError,
648
- 304: ResourceNotModifiedError,
649
- }
650
- error_map.update(kwargs.pop("error_map", {}) or {})
651
-
652
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
653
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
654
-
655
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
656
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
657
- cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
658
-
659
- content_type = content_type or "application/json"
660
- _json = None
661
- _content = None
662
- if isinstance(parameters, (IOBase, bytes)):
663
- _content = parameters
664
- else:
665
- _json = self._serialize.body(parameters, "StorageAccountCreateParameters")
666
-
667
- _request = build_create_request(
668
- resource_group_name=resource_group_name,
669
- account_name=account_name,
670
- subscription_id=self._config.subscription_id,
671
- api_version=api_version,
672
- content_type=content_type,
673
- json=_json,
674
- content=_content,
675
- headers=_headers,
676
- params=_params,
677
- )
678
- _request.url = self._client.format_url(_request.url)
679
-
680
- _decompress = kwargs.pop("decompress", True)
681
- _stream = True
682
- pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
683
- _request, stream=_stream, **kwargs
684
- )
685
-
686
- response = pipeline_response.http_response
687
-
688
- if response.status_code not in [200, 202]:
689
- try:
690
- response.read() # Load the body in memory and close the socket
691
- except (StreamConsumedError, StreamClosedError):
692
- pass
693
- map_error(status_code=response.status_code, response=response, error_map=error_map)
694
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
695
-
696
- deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
697
-
698
- if cls:
699
- return cls(pipeline_response, deserialized, {}) # type: ignore
700
-
701
- return deserialized # type: ignore
702
-
703
- @overload
704
- def begin_create(
705
- self,
706
- resource_group_name: str,
707
- account_name: str,
708
- parameters: _models.StorageAccountCreateParameters,
709
- *,
710
- content_type: str = "application/json",
711
- **kwargs: Any
712
- ) -> LROPoller[_models.StorageAccount]:
713
- """Asynchronously creates a new storage account with the specified parameters. If an account is
714
- already created and a subsequent create request is issued with different properties, the
715
- account properties will be updated. If an account is already created and a subsequent create or
716
- update request is issued with the exact same set of properties, the request will succeed.
717
-
718
- :param resource_group_name: The name of the resource group within the user's subscription. The
719
- name is case insensitive. Required.
720
- :type resource_group_name: str
721
- :param account_name: The name of the storage account within the specified resource group.
722
- Storage account names must be between 3 and 24 characters in length and use numbers and
723
- lower-case letters only. Required.
724
- :type account_name: str
725
- :param parameters: The parameters to provide for the created account. Required.
726
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountCreateParameters
727
- :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
728
- Default value is "application/json".
729
- :paramtype content_type: str
730
- :return: An instance of LROPoller that returns either StorageAccount or the result of
731
- cls(response)
732
- :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2019_06_01.models.StorageAccount]
733
- :raises ~azure.core.exceptions.HttpResponseError:
734
- """
735
-
736
- @overload
737
- def begin_create(
738
- self,
739
- resource_group_name: str,
740
- account_name: str,
741
- parameters: IO[bytes],
742
- *,
743
- content_type: str = "application/json",
744
- **kwargs: Any
745
- ) -> LROPoller[_models.StorageAccount]:
746
- """Asynchronously creates a new storage account with the specified parameters. If an account is
747
- already created and a subsequent create request is issued with different properties, the
748
- account properties will be updated. If an account is already created and a subsequent create or
749
- update request is issued with the exact same set of properties, the request will succeed.
750
-
751
- :param resource_group_name: The name of the resource group within the user's subscription. The
752
- name is case insensitive. Required.
753
- :type resource_group_name: str
754
- :param account_name: The name of the storage account within the specified resource group.
755
- Storage account names must be between 3 and 24 characters in length and use numbers and
756
- lower-case letters only. Required.
757
- :type account_name: str
758
- :param parameters: The parameters to provide for the created account. Required.
759
- :type parameters: IO[bytes]
760
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
761
- Default value is "application/json".
762
- :paramtype content_type: str
763
- :return: An instance of LROPoller that returns either StorageAccount or the result of
764
- cls(response)
765
- :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2019_06_01.models.StorageAccount]
766
- :raises ~azure.core.exceptions.HttpResponseError:
767
- """
768
-
769
- @distributed_trace
770
- def begin_create(
771
- self,
772
- resource_group_name: str,
773
- account_name: str,
774
- parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]],
775
- **kwargs: Any
776
- ) -> LROPoller[_models.StorageAccount]:
777
- """Asynchronously creates a new storage account with the specified parameters. If an account is
778
- already created and a subsequent create request is issued with different properties, the
779
- account properties will be updated. If an account is already created and a subsequent create or
780
- update request is issued with the exact same set of properties, the request will succeed.
781
-
782
- :param resource_group_name: The name of the resource group within the user's subscription. The
783
- name is case insensitive. Required.
784
- :type resource_group_name: str
785
- :param account_name: The name of the storage account within the specified resource group.
786
- Storage account names must be between 3 and 24 characters in length and use numbers and
787
- lower-case letters only. Required.
788
- :type account_name: str
789
- :param parameters: The parameters to provide for the created account. Is either a
790
- StorageAccountCreateParameters type or a IO[bytes] type. Required.
791
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountCreateParameters or
792
- IO[bytes]
793
- :return: An instance of LROPoller that returns either StorageAccount or the result of
794
- cls(response)
795
- :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2019_06_01.models.StorageAccount]
796
- :raises ~azure.core.exceptions.HttpResponseError:
797
- """
798
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
799
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
800
-
801
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
802
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
803
- cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None)
804
- polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
805
- lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
806
- cont_token: Optional[str] = kwargs.pop("continuation_token", None)
807
- if cont_token is None:
808
- raw_result = self._create_initial(
809
- resource_group_name=resource_group_name,
810
- account_name=account_name,
811
- parameters=parameters,
812
- api_version=api_version,
813
- content_type=content_type,
814
- cls=lambda x, y, z: x,
815
- headers=_headers,
816
- params=_params,
817
- **kwargs
818
- )
819
- raw_result.http_response.read() # type: ignore
820
- kwargs.pop("error_map", None)
821
-
822
- def get_long_running_output(pipeline_response):
823
- deserialized = self._deserialize("StorageAccount", pipeline_response.http_response)
824
- if cls:
825
- return cls(pipeline_response, deserialized, {}) # type: ignore
826
- return deserialized
827
-
828
- if polling is True:
829
- polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
830
- elif polling is False:
831
- polling_method = cast(PollingMethod, NoPolling())
832
- else:
833
- polling_method = polling
834
- if cont_token:
835
- return LROPoller[_models.StorageAccount].from_continuation_token(
836
- polling_method=polling_method,
837
- continuation_token=cont_token,
838
- client=self._client,
839
- deserialization_callback=get_long_running_output,
840
- )
841
- return LROPoller[_models.StorageAccount](
842
- self._client, raw_result, get_long_running_output, polling_method # type: ignore
843
- )
844
-
845
- @distributed_trace
846
- def delete( # pylint: disable=inconsistent-return-statements
847
- self, resource_group_name: str, account_name: str, **kwargs: Any
848
- ) -> None:
849
- """Deletes a storage account in Microsoft Azure.
850
-
851
- :param resource_group_name: The name of the resource group within the user's subscription. The
852
- name is case insensitive. Required.
853
- :type resource_group_name: str
854
- :param account_name: The name of the storage account within the specified resource group.
855
- Storage account names must be between 3 and 24 characters in length and use numbers and
856
- lower-case letters only. Required.
857
- :type account_name: str
858
- :return: None or the result of cls(response)
859
- :rtype: None
860
- :raises ~azure.core.exceptions.HttpResponseError:
861
- """
862
- error_map: MutableMapping = {
863
- 401: ClientAuthenticationError,
864
- 404: ResourceNotFoundError,
865
- 409: ResourceExistsError,
866
- 304: ResourceNotModifiedError,
867
- }
868
- error_map.update(kwargs.pop("error_map", {}) or {})
869
-
870
- _headers = kwargs.pop("headers", {}) or {}
871
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
872
-
873
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
874
- cls: ClsType[None] = kwargs.pop("cls", None)
875
-
876
- _request = build_delete_request(
877
- resource_group_name=resource_group_name,
878
- account_name=account_name,
879
- subscription_id=self._config.subscription_id,
880
- api_version=api_version,
881
- headers=_headers,
882
- params=_params,
883
- )
884
- _request.url = self._client.format_url(_request.url)
885
-
886
- _stream = False
887
- pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
888
- _request, stream=_stream, **kwargs
889
- )
890
-
891
- response = pipeline_response.http_response
892
-
893
- if response.status_code not in [200, 204]:
894
- map_error(status_code=response.status_code, response=response, error_map=error_map)
895
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
896
-
897
- if cls:
898
- return cls(pipeline_response, None, {}) # type: ignore
899
-
900
- @distributed_trace
901
- def get_properties(
902
- self,
903
- resource_group_name: str,
904
- account_name: str,
905
- expand: Optional[Union[str, _models.StorageAccountExpand]] = None,
906
- **kwargs: Any
907
- ) -> _models.StorageAccount:
908
- """Returns the properties for the specified storage account including but not limited to name, SKU
909
- name, location, and account status. The ListKeys operation should be used to retrieve storage
910
- keys.
911
-
912
- :param resource_group_name: The name of the resource group within the user's subscription. The
913
- name is case insensitive. Required.
914
- :type resource_group_name: str
915
- :param account_name: The name of the storage account within the specified resource group.
916
- Storage account names must be between 3 and 24 characters in length and use numbers and
917
- lower-case letters only. Required.
918
- :type account_name: str
919
- :param expand: May be used to expand the properties within account's properties. By default,
920
- data is not included when fetching properties. Currently we only support geoReplicationStats
921
- and blobRestoreStatus. Known values are: "geoReplicationStats" and "blobRestoreStatus". Default
922
- value is None.
923
- :type expand: str or ~azure.mgmt.storage.v2019_06_01.models.StorageAccountExpand
924
- :return: StorageAccount or the result of cls(response)
925
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccount
926
- :raises ~azure.core.exceptions.HttpResponseError:
927
- """
928
- error_map: MutableMapping = {
929
- 401: ClientAuthenticationError,
930
- 404: ResourceNotFoundError,
931
- 409: ResourceExistsError,
932
- 304: ResourceNotModifiedError,
933
- }
934
- error_map.update(kwargs.pop("error_map", {}) or {})
935
-
936
- _headers = kwargs.pop("headers", {}) or {}
937
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
938
-
939
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
940
- cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None)
941
-
942
- _request = build_get_properties_request(
943
- resource_group_name=resource_group_name,
944
- account_name=account_name,
945
- subscription_id=self._config.subscription_id,
946
- expand=expand,
947
- api_version=api_version,
948
- headers=_headers,
949
- params=_params,
950
- )
951
- _request.url = self._client.format_url(_request.url)
952
-
953
- _stream = False
954
- pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
955
- _request, stream=_stream, **kwargs
956
- )
957
-
958
- response = pipeline_response.http_response
959
-
960
- if response.status_code not in [200]:
961
- map_error(status_code=response.status_code, response=response, error_map=error_map)
962
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
963
-
964
- deserialized = self._deserialize("StorageAccount", pipeline_response.http_response)
965
-
966
- if cls:
967
- return cls(pipeline_response, deserialized, {}) # type: ignore
968
-
969
- return deserialized # type: ignore
970
-
971
- @overload
972
- def update(
973
- self,
974
- resource_group_name: str,
975
- account_name: str,
976
- parameters: _models.StorageAccountUpdateParameters,
977
- *,
978
- content_type: str = "application/json",
979
- **kwargs: Any
980
- ) -> _models.StorageAccount:
981
- """The update operation can be used to update the SKU, encryption, access tier, or tags for a
982
- storage account. It can also be used to map the account to a custom domain. Only one custom
983
- domain is supported per storage account; the replacement/change of custom domain is not
984
- supported. In order to replace an old custom domain, the old value must be cleared/unregistered
985
- before a new value can be set. The update of multiple properties is supported. This call does
986
- not change the storage keys for the account. If you want to change the storage account keys,
987
- use the regenerate keys operation. The location and name of the storage account cannot be
988
- changed after creation.
989
-
990
- :param resource_group_name: The name of the resource group within the user's subscription. The
991
- name is case insensitive. Required.
992
- :type resource_group_name: str
993
- :param account_name: The name of the storage account within the specified resource group.
994
- Storage account names must be between 3 and 24 characters in length and use numbers and
995
- lower-case letters only. Required.
996
- :type account_name: str
997
- :param parameters: The parameters to provide for the updated account. Required.
998
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountUpdateParameters
999
- :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
1000
- Default value is "application/json".
1001
- :paramtype content_type: str
1002
- :return: StorageAccount or the result of cls(response)
1003
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccount
1004
- :raises ~azure.core.exceptions.HttpResponseError:
1005
- """
1006
-
1007
- @overload
1008
- def update(
1009
- self,
1010
- resource_group_name: str,
1011
- account_name: str,
1012
- parameters: IO[bytes],
1013
- *,
1014
- content_type: str = "application/json",
1015
- **kwargs: Any
1016
- ) -> _models.StorageAccount:
1017
- """The update operation can be used to update the SKU, encryption, access tier, or tags for a
1018
- storage account. It can also be used to map the account to a custom domain. Only one custom
1019
- domain is supported per storage account; the replacement/change of custom domain is not
1020
- supported. In order to replace an old custom domain, the old value must be cleared/unregistered
1021
- before a new value can be set. The update of multiple properties is supported. This call does
1022
- not change the storage keys for the account. If you want to change the storage account keys,
1023
- use the regenerate keys operation. The location and name of the storage account cannot be
1024
- changed after creation.
1025
-
1026
- :param resource_group_name: The name of the resource group within the user's subscription. The
1027
- name is case insensitive. Required.
1028
- :type resource_group_name: str
1029
- :param account_name: The name of the storage account within the specified resource group.
1030
- Storage account names must be between 3 and 24 characters in length and use numbers and
1031
- lower-case letters only. Required.
1032
- :type account_name: str
1033
- :param parameters: The parameters to provide for the updated account. Required.
1034
- :type parameters: IO[bytes]
1035
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1036
- Default value is "application/json".
1037
- :paramtype content_type: str
1038
- :return: StorageAccount or the result of cls(response)
1039
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccount
1040
- :raises ~azure.core.exceptions.HttpResponseError:
1041
- """
1042
-
1043
- @distributed_trace
1044
- def update(
1045
- self,
1046
- resource_group_name: str,
1047
- account_name: str,
1048
- parameters: Union[_models.StorageAccountUpdateParameters, IO[bytes]],
1049
- **kwargs: Any
1050
- ) -> _models.StorageAccount:
1051
- """The update operation can be used to update the SKU, encryption, access tier, or tags for a
1052
- storage account. It can also be used to map the account to a custom domain. Only one custom
1053
- domain is supported per storage account; the replacement/change of custom domain is not
1054
- supported. In order to replace an old custom domain, the old value must be cleared/unregistered
1055
- before a new value can be set. The update of multiple properties is supported. This call does
1056
- not change the storage keys for the account. If you want to change the storage account keys,
1057
- use the regenerate keys operation. The location and name of the storage account cannot be
1058
- changed after creation.
1059
-
1060
- :param resource_group_name: The name of the resource group within the user's subscription. The
1061
- name is case insensitive. Required.
1062
- :type resource_group_name: str
1063
- :param account_name: The name of the storage account within the specified resource group.
1064
- Storage account names must be between 3 and 24 characters in length and use numbers and
1065
- lower-case letters only. Required.
1066
- :type account_name: str
1067
- :param parameters: The parameters to provide for the updated account. Is either a
1068
- StorageAccountUpdateParameters type or a IO[bytes] type. Required.
1069
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountUpdateParameters or
1070
- IO[bytes]
1071
- :return: StorageAccount or the result of cls(response)
1072
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccount
1073
- :raises ~azure.core.exceptions.HttpResponseError:
1074
- """
1075
- error_map: MutableMapping = {
1076
- 401: ClientAuthenticationError,
1077
- 404: ResourceNotFoundError,
1078
- 409: ResourceExistsError,
1079
- 304: ResourceNotModifiedError,
1080
- }
1081
- error_map.update(kwargs.pop("error_map", {}) or {})
1082
-
1083
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1084
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1085
-
1086
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
1087
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
1088
- cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None)
1089
-
1090
- content_type = content_type or "application/json"
1091
- _json = None
1092
- _content = None
1093
- if isinstance(parameters, (IOBase, bytes)):
1094
- _content = parameters
1095
- else:
1096
- _json = self._serialize.body(parameters, "StorageAccountUpdateParameters")
1097
-
1098
- _request = build_update_request(
1099
- resource_group_name=resource_group_name,
1100
- account_name=account_name,
1101
- subscription_id=self._config.subscription_id,
1102
- api_version=api_version,
1103
- content_type=content_type,
1104
- json=_json,
1105
- content=_content,
1106
- headers=_headers,
1107
- params=_params,
1108
- )
1109
- _request.url = self._client.format_url(_request.url)
1110
-
1111
- _stream = False
1112
- pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
1113
- _request, stream=_stream, **kwargs
1114
- )
1115
-
1116
- response = pipeline_response.http_response
1117
-
1118
- if response.status_code not in [200]:
1119
- map_error(status_code=response.status_code, response=response, error_map=error_map)
1120
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1121
-
1122
- deserialized = self._deserialize("StorageAccount", pipeline_response.http_response)
1123
-
1124
- if cls:
1125
- return cls(pipeline_response, deserialized, {}) # type: ignore
1126
-
1127
- return deserialized # type: ignore
1128
-
1129
- @distributed_trace
1130
- def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]:
1131
- """Lists all the storage accounts available under the subscription. Note that storage keys are not
1132
- returned; use the ListKeys operation for this.
1133
-
1134
- :return: An iterator like instance of either StorageAccount or the result of cls(response)
1135
- :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_06_01.models.StorageAccount]
1136
- :raises ~azure.core.exceptions.HttpResponseError:
1137
- """
1138
- _headers = kwargs.pop("headers", {}) or {}
1139
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1140
-
1141
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
1142
- cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None)
1143
-
1144
- error_map: MutableMapping = {
1145
- 401: ClientAuthenticationError,
1146
- 404: ResourceNotFoundError,
1147
- 409: ResourceExistsError,
1148
- 304: ResourceNotModifiedError,
1149
- }
1150
- error_map.update(kwargs.pop("error_map", {}) or {})
1151
-
1152
- def prepare_request(next_link=None):
1153
- if not next_link:
1154
-
1155
- _request = build_list_request(
1156
- subscription_id=self._config.subscription_id,
1157
- api_version=api_version,
1158
- headers=_headers,
1159
- params=_params,
1160
- )
1161
- _request.url = self._client.format_url(_request.url)
1162
-
1163
- else:
1164
- # make call to next link with the client's api-version
1165
- _parsed_next_link = urllib.parse.urlparse(next_link)
1166
- _next_request_params = case_insensitive_dict(
1167
- {
1168
- key: [urllib.parse.quote(v) for v in value]
1169
- for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
1170
- }
1171
- )
1172
- _next_request_params["api-version"] = self._api_version
1173
- _request = HttpRequest(
1174
- "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
1175
- )
1176
- _request.url = self._client.format_url(_request.url)
1177
- _request.method = "GET"
1178
- return _request
1179
-
1180
- def extract_data(pipeline_response):
1181
- deserialized = self._deserialize("StorageAccountListResult", pipeline_response)
1182
- list_of_elem = deserialized.value
1183
- if cls:
1184
- list_of_elem = cls(list_of_elem) # type: ignore
1185
- return deserialized.next_link or None, iter(list_of_elem)
1186
-
1187
- def get_next(next_link=None):
1188
- _request = prepare_request(next_link)
1189
-
1190
- _stream = False
1191
- pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
1192
- _request, stream=_stream, **kwargs
1193
- )
1194
- response = pipeline_response.http_response
1195
-
1196
- if response.status_code not in [200]:
1197
- map_error(status_code=response.status_code, response=response, error_map=error_map)
1198
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1199
-
1200
- return pipeline_response
1201
-
1202
- return ItemPaged(get_next, extract_data)
1203
-
1204
- @distributed_trace
1205
- def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.StorageAccount"]:
1206
- """Lists all the storage accounts available under the given resource group. Note that storage keys
1207
- are not returned; use the ListKeys operation for this.
1208
-
1209
- :param resource_group_name: The name of the resource group within the user's subscription. The
1210
- name is case insensitive. Required.
1211
- :type resource_group_name: str
1212
- :return: An iterator like instance of either StorageAccount or the result of cls(response)
1213
- :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_06_01.models.StorageAccount]
1214
- :raises ~azure.core.exceptions.HttpResponseError:
1215
- """
1216
- _headers = kwargs.pop("headers", {}) or {}
1217
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1218
-
1219
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
1220
- cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None)
1221
-
1222
- error_map: MutableMapping = {
1223
- 401: ClientAuthenticationError,
1224
- 404: ResourceNotFoundError,
1225
- 409: ResourceExistsError,
1226
- 304: ResourceNotModifiedError,
1227
- }
1228
- error_map.update(kwargs.pop("error_map", {}) or {})
1229
-
1230
- def prepare_request(next_link=None):
1231
- if not next_link:
1232
-
1233
- _request = build_list_by_resource_group_request(
1234
- resource_group_name=resource_group_name,
1235
- subscription_id=self._config.subscription_id,
1236
- api_version=api_version,
1237
- headers=_headers,
1238
- params=_params,
1239
- )
1240
- _request.url = self._client.format_url(_request.url)
1241
-
1242
- else:
1243
- # make call to next link with the client's api-version
1244
- _parsed_next_link = urllib.parse.urlparse(next_link)
1245
- _next_request_params = case_insensitive_dict(
1246
- {
1247
- key: [urllib.parse.quote(v) for v in value]
1248
- for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
1249
- }
1250
- )
1251
- _next_request_params["api-version"] = self._api_version
1252
- _request = HttpRequest(
1253
- "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
1254
- )
1255
- _request.url = self._client.format_url(_request.url)
1256
- _request.method = "GET"
1257
- return _request
1258
-
1259
- def extract_data(pipeline_response):
1260
- deserialized = self._deserialize("StorageAccountListResult", pipeline_response)
1261
- list_of_elem = deserialized.value
1262
- if cls:
1263
- list_of_elem = cls(list_of_elem) # type: ignore
1264
- return None, iter(list_of_elem)
1265
-
1266
- def get_next(next_link=None):
1267
- _request = prepare_request(next_link)
1268
-
1269
- _stream = False
1270
- pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
1271
- _request, stream=_stream, **kwargs
1272
- )
1273
- response = pipeline_response.http_response
1274
-
1275
- if response.status_code not in [200]:
1276
- map_error(status_code=response.status_code, response=response, error_map=error_map)
1277
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1278
-
1279
- return pipeline_response
1280
-
1281
- return ItemPaged(get_next, extract_data)
1282
-
1283
- @distributed_trace
1284
- def list_keys(
1285
- self, resource_group_name: str, account_name: str, expand: Literal["kerb"] = "kerb", **kwargs: Any
1286
- ) -> _models.StorageAccountListKeysResult:
1287
- """Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage
1288
- account.
1289
-
1290
- :param resource_group_name: The name of the resource group within the user's subscription. The
1291
- name is case insensitive. Required.
1292
- :type resource_group_name: str
1293
- :param account_name: The name of the storage account within the specified resource group.
1294
- Storage account names must be between 3 and 24 characters in length and use numbers and
1295
- lower-case letters only. Required.
1296
- :type account_name: str
1297
- :param expand: Specifies type of the key to be listed. Possible value is kerb. Known values are
1298
- "kerb" and None. Default value is "kerb".
1299
- :type expand: str
1300
- :return: StorageAccountListKeysResult or the result of cls(response)
1301
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountListKeysResult
1302
- :raises ~azure.core.exceptions.HttpResponseError:
1303
- """
1304
- error_map: MutableMapping = {
1305
- 401: ClientAuthenticationError,
1306
- 404: ResourceNotFoundError,
1307
- 409: ResourceExistsError,
1308
- 304: ResourceNotModifiedError,
1309
- }
1310
- error_map.update(kwargs.pop("error_map", {}) or {})
1311
-
1312
- _headers = kwargs.pop("headers", {}) or {}
1313
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1314
-
1315
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
1316
- cls: ClsType[_models.StorageAccountListKeysResult] = kwargs.pop("cls", None)
1317
-
1318
- _request = build_list_keys_request(
1319
- resource_group_name=resource_group_name,
1320
- account_name=account_name,
1321
- subscription_id=self._config.subscription_id,
1322
- expand=expand,
1323
- api_version=api_version,
1324
- headers=_headers,
1325
- params=_params,
1326
- )
1327
- _request.url = self._client.format_url(_request.url)
1328
-
1329
- _stream = False
1330
- pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
1331
- _request, stream=_stream, **kwargs
1332
- )
1333
-
1334
- response = pipeline_response.http_response
1335
-
1336
- if response.status_code not in [200]:
1337
- map_error(status_code=response.status_code, response=response, error_map=error_map)
1338
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1339
-
1340
- deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response)
1341
-
1342
- if cls:
1343
- return cls(pipeline_response, deserialized, {}) # type: ignore
1344
-
1345
- return deserialized # type: ignore
1346
-
1347
- @overload
1348
- def regenerate_key(
1349
- self,
1350
- resource_group_name: str,
1351
- account_name: str,
1352
- regenerate_key: _models.StorageAccountRegenerateKeyParameters,
1353
- *,
1354
- content_type: str = "application/json",
1355
- **kwargs: Any
1356
- ) -> _models.StorageAccountListKeysResult:
1357
- """Regenerates one of the access keys or Kerberos keys for the specified storage account.
1358
-
1359
- :param resource_group_name: The name of the resource group within the user's subscription. The
1360
- name is case insensitive. Required.
1361
- :type resource_group_name: str
1362
- :param account_name: The name of the storage account within the specified resource group.
1363
- Storage account names must be between 3 and 24 characters in length and use numbers and
1364
- lower-case letters only. Required.
1365
- :type account_name: str
1366
- :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2,
1367
- kerb1, kerb2. Required.
1368
- :type regenerate_key:
1369
- ~azure.mgmt.storage.v2019_06_01.models.StorageAccountRegenerateKeyParameters
1370
- :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
1371
- Default value is "application/json".
1372
- :paramtype content_type: str
1373
- :return: StorageAccountListKeysResult or the result of cls(response)
1374
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountListKeysResult
1375
- :raises ~azure.core.exceptions.HttpResponseError:
1376
- """
1377
-
1378
- @overload
1379
- def regenerate_key(
1380
- self,
1381
- resource_group_name: str,
1382
- account_name: str,
1383
- regenerate_key: IO[bytes],
1384
- *,
1385
- content_type: str = "application/json",
1386
- **kwargs: Any
1387
- ) -> _models.StorageAccountListKeysResult:
1388
- """Regenerates one of the access keys or Kerberos keys for the specified storage account.
1389
-
1390
- :param resource_group_name: The name of the resource group within the user's subscription. The
1391
- name is case insensitive. Required.
1392
- :type resource_group_name: str
1393
- :param account_name: The name of the storage account within the specified resource group.
1394
- Storage account names must be between 3 and 24 characters in length and use numbers and
1395
- lower-case letters only. Required.
1396
- :type account_name: str
1397
- :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2,
1398
- kerb1, kerb2. Required.
1399
- :type regenerate_key: IO[bytes]
1400
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1401
- Default value is "application/json".
1402
- :paramtype content_type: str
1403
- :return: StorageAccountListKeysResult or the result of cls(response)
1404
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountListKeysResult
1405
- :raises ~azure.core.exceptions.HttpResponseError:
1406
- """
1407
-
1408
- @distributed_trace
1409
- def regenerate_key(
1410
- self,
1411
- resource_group_name: str,
1412
- account_name: str,
1413
- regenerate_key: Union[_models.StorageAccountRegenerateKeyParameters, IO[bytes]],
1414
- **kwargs: Any
1415
- ) -> _models.StorageAccountListKeysResult:
1416
- """Regenerates one of the access keys or Kerberos keys for the specified storage account.
1417
-
1418
- :param resource_group_name: The name of the resource group within the user's subscription. The
1419
- name is case insensitive. Required.
1420
- :type resource_group_name: str
1421
- :param account_name: The name of the storage account within the specified resource group.
1422
- Storage account names must be between 3 and 24 characters in length and use numbers and
1423
- lower-case letters only. Required.
1424
- :type account_name: str
1425
- :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2,
1426
- kerb1, kerb2. Is either a StorageAccountRegenerateKeyParameters type or a IO[bytes] type.
1427
- Required.
1428
- :type regenerate_key:
1429
- ~azure.mgmt.storage.v2019_06_01.models.StorageAccountRegenerateKeyParameters or IO[bytes]
1430
- :return: StorageAccountListKeysResult or the result of cls(response)
1431
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountListKeysResult
1432
- :raises ~azure.core.exceptions.HttpResponseError:
1433
- """
1434
- error_map: MutableMapping = {
1435
- 401: ClientAuthenticationError,
1436
- 404: ResourceNotFoundError,
1437
- 409: ResourceExistsError,
1438
- 304: ResourceNotModifiedError,
1439
- }
1440
- error_map.update(kwargs.pop("error_map", {}) or {})
1441
-
1442
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1443
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1444
-
1445
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
1446
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
1447
- cls: ClsType[_models.StorageAccountListKeysResult] = kwargs.pop("cls", None)
1448
-
1449
- content_type = content_type or "application/json"
1450
- _json = None
1451
- _content = None
1452
- if isinstance(regenerate_key, (IOBase, bytes)):
1453
- _content = regenerate_key
1454
- else:
1455
- _json = self._serialize.body(regenerate_key, "StorageAccountRegenerateKeyParameters")
1456
-
1457
- _request = build_regenerate_key_request(
1458
- resource_group_name=resource_group_name,
1459
- account_name=account_name,
1460
- subscription_id=self._config.subscription_id,
1461
- api_version=api_version,
1462
- content_type=content_type,
1463
- json=_json,
1464
- content=_content,
1465
- headers=_headers,
1466
- params=_params,
1467
- )
1468
- _request.url = self._client.format_url(_request.url)
1469
-
1470
- _stream = False
1471
- pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
1472
- _request, stream=_stream, **kwargs
1473
- )
1474
-
1475
- response = pipeline_response.http_response
1476
-
1477
- if response.status_code not in [200]:
1478
- map_error(status_code=response.status_code, response=response, error_map=error_map)
1479
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1480
-
1481
- deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response)
1482
-
1483
- if cls:
1484
- return cls(pipeline_response, deserialized, {}) # type: ignore
1485
-
1486
- return deserialized # type: ignore
1487
-
1488
- @overload
1489
- def list_account_sas(
1490
- self,
1491
- resource_group_name: str,
1492
- account_name: str,
1493
- parameters: _models.AccountSasParameters,
1494
- *,
1495
- content_type: str = "application/json",
1496
- **kwargs: Any
1497
- ) -> _models.ListAccountSasResponse:
1498
- """List SAS credentials of a storage account.
1499
-
1500
- :param resource_group_name: The name of the resource group within the user's subscription. The
1501
- name is case insensitive. Required.
1502
- :type resource_group_name: str
1503
- :param account_name: The name of the storage account within the specified resource group.
1504
- Storage account names must be between 3 and 24 characters in length and use numbers and
1505
- lower-case letters only. Required.
1506
- :type account_name: str
1507
- :param parameters: The parameters to provide to list SAS credentials for the storage account.
1508
- Required.
1509
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.AccountSasParameters
1510
- :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
1511
- Default value is "application/json".
1512
- :paramtype content_type: str
1513
- :return: ListAccountSasResponse or the result of cls(response)
1514
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListAccountSasResponse
1515
- :raises ~azure.core.exceptions.HttpResponseError:
1516
- """
1517
-
1518
- @overload
1519
- def list_account_sas(
1520
- self,
1521
- resource_group_name: str,
1522
- account_name: str,
1523
- parameters: IO[bytes],
1524
- *,
1525
- content_type: str = "application/json",
1526
- **kwargs: Any
1527
- ) -> _models.ListAccountSasResponse:
1528
- """List SAS credentials of a storage account.
1529
-
1530
- :param resource_group_name: The name of the resource group within the user's subscription. The
1531
- name is case insensitive. Required.
1532
- :type resource_group_name: str
1533
- :param account_name: The name of the storage account within the specified resource group.
1534
- Storage account names must be between 3 and 24 characters in length and use numbers and
1535
- lower-case letters only. Required.
1536
- :type account_name: str
1537
- :param parameters: The parameters to provide to list SAS credentials for the storage account.
1538
- Required.
1539
- :type parameters: IO[bytes]
1540
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1541
- Default value is "application/json".
1542
- :paramtype content_type: str
1543
- :return: ListAccountSasResponse or the result of cls(response)
1544
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListAccountSasResponse
1545
- :raises ~azure.core.exceptions.HttpResponseError:
1546
- """
1547
-
1548
- @distributed_trace
1549
- def list_account_sas(
1550
- self,
1551
- resource_group_name: str,
1552
- account_name: str,
1553
- parameters: Union[_models.AccountSasParameters, IO[bytes]],
1554
- **kwargs: Any
1555
- ) -> _models.ListAccountSasResponse:
1556
- """List SAS credentials of a storage account.
1557
-
1558
- :param resource_group_name: The name of the resource group within the user's subscription. The
1559
- name is case insensitive. Required.
1560
- :type resource_group_name: str
1561
- :param account_name: The name of the storage account within the specified resource group.
1562
- Storage account names must be between 3 and 24 characters in length and use numbers and
1563
- lower-case letters only. Required.
1564
- :type account_name: str
1565
- :param parameters: The parameters to provide to list SAS credentials for the storage account.
1566
- Is either a AccountSasParameters type or a IO[bytes] type. Required.
1567
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.AccountSasParameters or IO[bytes]
1568
- :return: ListAccountSasResponse or the result of cls(response)
1569
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListAccountSasResponse
1570
- :raises ~azure.core.exceptions.HttpResponseError:
1571
- """
1572
- error_map: MutableMapping = {
1573
- 401: ClientAuthenticationError,
1574
- 404: ResourceNotFoundError,
1575
- 409: ResourceExistsError,
1576
- 304: ResourceNotModifiedError,
1577
- }
1578
- error_map.update(kwargs.pop("error_map", {}) or {})
1579
-
1580
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1581
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1582
-
1583
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
1584
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
1585
- cls: ClsType[_models.ListAccountSasResponse] = kwargs.pop("cls", None)
1586
-
1587
- content_type = content_type or "application/json"
1588
- _json = None
1589
- _content = None
1590
- if isinstance(parameters, (IOBase, bytes)):
1591
- _content = parameters
1592
- else:
1593
- _json = self._serialize.body(parameters, "AccountSasParameters")
1594
-
1595
- _request = build_list_account_sas_request(
1596
- resource_group_name=resource_group_name,
1597
- account_name=account_name,
1598
- subscription_id=self._config.subscription_id,
1599
- api_version=api_version,
1600
- content_type=content_type,
1601
- json=_json,
1602
- content=_content,
1603
- headers=_headers,
1604
- params=_params,
1605
- )
1606
- _request.url = self._client.format_url(_request.url)
1607
-
1608
- _stream = False
1609
- pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
1610
- _request, stream=_stream, **kwargs
1611
- )
1612
-
1613
- response = pipeline_response.http_response
1614
-
1615
- if response.status_code not in [200]:
1616
- map_error(status_code=response.status_code, response=response, error_map=error_map)
1617
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1618
-
1619
- deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response)
1620
-
1621
- if cls:
1622
- return cls(pipeline_response, deserialized, {}) # type: ignore
1623
-
1624
- return deserialized # type: ignore
1625
-
1626
- @overload
1627
- def list_service_sas(
1628
- self,
1629
- resource_group_name: str,
1630
- account_name: str,
1631
- parameters: _models.ServiceSasParameters,
1632
- *,
1633
- content_type: str = "application/json",
1634
- **kwargs: Any
1635
- ) -> _models.ListServiceSasResponse:
1636
- """List service SAS credentials of a specific resource.
1637
-
1638
- :param resource_group_name: The name of the resource group within the user's subscription. The
1639
- name is case insensitive. Required.
1640
- :type resource_group_name: str
1641
- :param account_name: The name of the storage account within the specified resource group.
1642
- Storage account names must be between 3 and 24 characters in length and use numbers and
1643
- lower-case letters only. Required.
1644
- :type account_name: str
1645
- :param parameters: The parameters to provide to list service SAS credentials. Required.
1646
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.ServiceSasParameters
1647
- :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
1648
- Default value is "application/json".
1649
- :paramtype content_type: str
1650
- :return: ListServiceSasResponse or the result of cls(response)
1651
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListServiceSasResponse
1652
- :raises ~azure.core.exceptions.HttpResponseError:
1653
- """
1654
-
1655
- @overload
1656
- def list_service_sas(
1657
- self,
1658
- resource_group_name: str,
1659
- account_name: str,
1660
- parameters: IO[bytes],
1661
- *,
1662
- content_type: str = "application/json",
1663
- **kwargs: Any
1664
- ) -> _models.ListServiceSasResponse:
1665
- """List service SAS credentials of a specific resource.
1666
-
1667
- :param resource_group_name: The name of the resource group within the user's subscription. The
1668
- name is case insensitive. Required.
1669
- :type resource_group_name: str
1670
- :param account_name: The name of the storage account within the specified resource group.
1671
- Storage account names must be between 3 and 24 characters in length and use numbers and
1672
- lower-case letters only. Required.
1673
- :type account_name: str
1674
- :param parameters: The parameters to provide to list service SAS credentials. Required.
1675
- :type parameters: IO[bytes]
1676
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1677
- Default value is "application/json".
1678
- :paramtype content_type: str
1679
- :return: ListServiceSasResponse or the result of cls(response)
1680
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListServiceSasResponse
1681
- :raises ~azure.core.exceptions.HttpResponseError:
1682
- """
1683
-
1684
- @distributed_trace
1685
- def list_service_sas(
1686
- self,
1687
- resource_group_name: str,
1688
- account_name: str,
1689
- parameters: Union[_models.ServiceSasParameters, IO[bytes]],
1690
- **kwargs: Any
1691
- ) -> _models.ListServiceSasResponse:
1692
- """List service SAS credentials of a specific resource.
1693
-
1694
- :param resource_group_name: The name of the resource group within the user's subscription. The
1695
- name is case insensitive. Required.
1696
- :type resource_group_name: str
1697
- :param account_name: The name of the storage account within the specified resource group.
1698
- Storage account names must be between 3 and 24 characters in length and use numbers and
1699
- lower-case letters only. Required.
1700
- :type account_name: str
1701
- :param parameters: The parameters to provide to list service SAS credentials. Is either a
1702
- ServiceSasParameters type or a IO[bytes] type. Required.
1703
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.ServiceSasParameters or IO[bytes]
1704
- :return: ListServiceSasResponse or the result of cls(response)
1705
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListServiceSasResponse
1706
- :raises ~azure.core.exceptions.HttpResponseError:
1707
- """
1708
- error_map: MutableMapping = {
1709
- 401: ClientAuthenticationError,
1710
- 404: ResourceNotFoundError,
1711
- 409: ResourceExistsError,
1712
- 304: ResourceNotModifiedError,
1713
- }
1714
- error_map.update(kwargs.pop("error_map", {}) or {})
1715
-
1716
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1717
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1718
-
1719
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
1720
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
1721
- cls: ClsType[_models.ListServiceSasResponse] = kwargs.pop("cls", None)
1722
-
1723
- content_type = content_type or "application/json"
1724
- _json = None
1725
- _content = None
1726
- if isinstance(parameters, (IOBase, bytes)):
1727
- _content = parameters
1728
- else:
1729
- _json = self._serialize.body(parameters, "ServiceSasParameters")
1730
-
1731
- _request = build_list_service_sas_request(
1732
- resource_group_name=resource_group_name,
1733
- account_name=account_name,
1734
- subscription_id=self._config.subscription_id,
1735
- api_version=api_version,
1736
- content_type=content_type,
1737
- json=_json,
1738
- content=_content,
1739
- headers=_headers,
1740
- params=_params,
1741
- )
1742
- _request.url = self._client.format_url(_request.url)
1743
-
1744
- _stream = False
1745
- pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
1746
- _request, stream=_stream, **kwargs
1747
- )
1748
-
1749
- response = pipeline_response.http_response
1750
-
1751
- if response.status_code not in [200]:
1752
- map_error(status_code=response.status_code, response=response, error_map=error_map)
1753
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1754
-
1755
- deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response)
1756
-
1757
- if cls:
1758
- return cls(pipeline_response, deserialized, {}) # type: ignore
1759
-
1760
- return deserialized # type: ignore
1761
-
1762
- def _failover_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]:
1763
- error_map: MutableMapping = {
1764
- 401: ClientAuthenticationError,
1765
- 404: ResourceNotFoundError,
1766
- 409: ResourceExistsError,
1767
- 304: ResourceNotModifiedError,
1768
- }
1769
- error_map.update(kwargs.pop("error_map", {}) or {})
1770
-
1771
- _headers = kwargs.pop("headers", {}) or {}
1772
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1773
-
1774
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
1775
- cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
1776
-
1777
- _request = build_failover_request(
1778
- resource_group_name=resource_group_name,
1779
- account_name=account_name,
1780
- subscription_id=self._config.subscription_id,
1781
- api_version=api_version,
1782
- headers=_headers,
1783
- params=_params,
1784
- )
1785
- _request.url = self._client.format_url(_request.url)
1786
-
1787
- _decompress = kwargs.pop("decompress", True)
1788
- _stream = True
1789
- pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
1790
- _request, stream=_stream, **kwargs
1791
- )
1792
-
1793
- response = pipeline_response.http_response
1794
-
1795
- if response.status_code not in [200, 202]:
1796
- try:
1797
- response.read() # Load the body in memory and close the socket
1798
- except (StreamConsumedError, StreamClosedError):
1799
- pass
1800
- map_error(status_code=response.status_code, response=response, error_map=error_map)
1801
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1802
-
1803
- deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
1804
-
1805
- if cls:
1806
- return cls(pipeline_response, deserialized, {}) # type: ignore
1807
-
1808
- return deserialized # type: ignore
1809
-
1810
- @distributed_trace
1811
- def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]:
1812
- """Failover request can be triggered for a storage account in case of availability issues. The
1813
- failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS
1814
- accounts. The secondary cluster will become primary after failover.
1815
-
1816
- :param resource_group_name: The name of the resource group within the user's subscription. The
1817
- name is case insensitive. Required.
1818
- :type resource_group_name: str
1819
- :param account_name: The name of the storage account within the specified resource group.
1820
- Storage account names must be between 3 and 24 characters in length and use numbers and
1821
- lower-case letters only. Required.
1822
- :type account_name: str
1823
- :return: An instance of LROPoller that returns either None or the result of cls(response)
1824
- :rtype: ~azure.core.polling.LROPoller[None]
1825
- :raises ~azure.core.exceptions.HttpResponseError:
1826
- """
1827
- _headers = kwargs.pop("headers", {}) or {}
1828
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1829
-
1830
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
1831
- cls: ClsType[None] = kwargs.pop("cls", None)
1832
- polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
1833
- lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
1834
- cont_token: Optional[str] = kwargs.pop("continuation_token", None)
1835
- if cont_token is None:
1836
- raw_result = self._failover_initial(
1837
- resource_group_name=resource_group_name,
1838
- account_name=account_name,
1839
- api_version=api_version,
1840
- cls=lambda x, y, z: x,
1841
- headers=_headers,
1842
- params=_params,
1843
- **kwargs
1844
- )
1845
- raw_result.http_response.read() # type: ignore
1846
- kwargs.pop("error_map", None)
1847
-
1848
- def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
1849
- if cls:
1850
- return cls(pipeline_response, None, {}) # type: ignore
1851
-
1852
- if polling is True:
1853
- polling_method: PollingMethod = cast(
1854
- PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
1855
- )
1856
- elif polling is False:
1857
- polling_method = cast(PollingMethod, NoPolling())
1858
- else:
1859
- polling_method = polling
1860
- if cont_token:
1861
- return LROPoller[None].from_continuation_token(
1862
- polling_method=polling_method,
1863
- continuation_token=cont_token,
1864
- client=self._client,
1865
- deserialization_callback=get_long_running_output,
1866
- )
1867
- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
1868
-
1869
- def _restore_blob_ranges_initial(
1870
- self,
1871
- resource_group_name: str,
1872
- account_name: str,
1873
- parameters: Union[_models.BlobRestoreParameters, IO[bytes]],
1874
- **kwargs: Any
1875
- ) -> Iterator[bytes]:
1876
- error_map: MutableMapping = {
1877
- 401: ClientAuthenticationError,
1878
- 404: ResourceNotFoundError,
1879
- 409: ResourceExistsError,
1880
- 304: ResourceNotModifiedError,
1881
- }
1882
- error_map.update(kwargs.pop("error_map", {}) or {})
1883
-
1884
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1885
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1886
-
1887
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
1888
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
1889
- cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
1890
-
1891
- content_type = content_type or "application/json"
1892
- _json = None
1893
- _content = None
1894
- if isinstance(parameters, (IOBase, bytes)):
1895
- _content = parameters
1896
- else:
1897
- _json = self._serialize.body(parameters, "BlobRestoreParameters")
1898
-
1899
- _request = build_restore_blob_ranges_request(
1900
- resource_group_name=resource_group_name,
1901
- account_name=account_name,
1902
- subscription_id=self._config.subscription_id,
1903
- api_version=api_version,
1904
- content_type=content_type,
1905
- json=_json,
1906
- content=_content,
1907
- headers=_headers,
1908
- params=_params,
1909
- )
1910
- _request.url = self._client.format_url(_request.url)
1911
-
1912
- _decompress = kwargs.pop("decompress", True)
1913
- _stream = True
1914
- pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
1915
- _request, stream=_stream, **kwargs
1916
- )
1917
-
1918
- response = pipeline_response.http_response
1919
-
1920
- if response.status_code not in [200, 202]:
1921
- try:
1922
- response.read() # Load the body in memory and close the socket
1923
- except (StreamConsumedError, StreamClosedError):
1924
- pass
1925
- map_error(status_code=response.status_code, response=response, error_map=error_map)
1926
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1927
-
1928
- deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
1929
-
1930
- if cls:
1931
- return cls(pipeline_response, deserialized, {}) # type: ignore
1932
-
1933
- return deserialized # type: ignore
1934
-
1935
- @overload
1936
- def begin_restore_blob_ranges(
1937
- self,
1938
- resource_group_name: str,
1939
- account_name: str,
1940
- parameters: _models.BlobRestoreParameters,
1941
- *,
1942
- content_type: str = "application/json",
1943
- **kwargs: Any
1944
- ) -> LROPoller[_models.BlobRestoreStatus]:
1945
- """Restore blobs in the specified blob ranges.
1946
-
1947
- :param resource_group_name: The name of the resource group within the user's subscription. The
1948
- name is case insensitive. Required.
1949
- :type resource_group_name: str
1950
- :param account_name: The name of the storage account within the specified resource group.
1951
- Storage account names must be between 3 and 24 characters in length and use numbers and
1952
- lower-case letters only. Required.
1953
- :type account_name: str
1954
- :param parameters: The parameters to provide for restore blob ranges. Required.
1955
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.BlobRestoreParameters
1956
- :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
1957
- Default value is "application/json".
1958
- :paramtype content_type: str
1959
- :return: An instance of LROPoller that returns either BlobRestoreStatus or the result of
1960
- cls(response)
1961
- :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2019_06_01.models.BlobRestoreStatus]
1962
- :raises ~azure.core.exceptions.HttpResponseError:
1963
- """
1964
-
1965
- @overload
1966
- def begin_restore_blob_ranges(
1967
- self,
1968
- resource_group_name: str,
1969
- account_name: str,
1970
- parameters: IO[bytes],
1971
- *,
1972
- content_type: str = "application/json",
1973
- **kwargs: Any
1974
- ) -> LROPoller[_models.BlobRestoreStatus]:
1975
- """Restore blobs in the specified blob ranges.
1976
-
1977
- :param resource_group_name: The name of the resource group within the user's subscription. The
1978
- name is case insensitive. Required.
1979
- :type resource_group_name: str
1980
- :param account_name: The name of the storage account within the specified resource group.
1981
- Storage account names must be between 3 and 24 characters in length and use numbers and
1982
- lower-case letters only. Required.
1983
- :type account_name: str
1984
- :param parameters: The parameters to provide for restore blob ranges. Required.
1985
- :type parameters: IO[bytes]
1986
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1987
- Default value is "application/json".
1988
- :paramtype content_type: str
1989
- :return: An instance of LROPoller that returns either BlobRestoreStatus or the result of
1990
- cls(response)
1991
- :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2019_06_01.models.BlobRestoreStatus]
1992
- :raises ~azure.core.exceptions.HttpResponseError:
1993
- """
1994
-
1995
- @distributed_trace
1996
- def begin_restore_blob_ranges(
1997
- self,
1998
- resource_group_name: str,
1999
- account_name: str,
2000
- parameters: Union[_models.BlobRestoreParameters, IO[bytes]],
2001
- **kwargs: Any
2002
- ) -> LROPoller[_models.BlobRestoreStatus]:
2003
- """Restore blobs in the specified blob ranges.
2004
-
2005
- :param resource_group_name: The name of the resource group within the user's subscription. The
2006
- name is case insensitive. Required.
2007
- :type resource_group_name: str
2008
- :param account_name: The name of the storage account within the specified resource group.
2009
- Storage account names must be between 3 and 24 characters in length and use numbers and
2010
- lower-case letters only. Required.
2011
- :type account_name: str
2012
- :param parameters: The parameters to provide for restore blob ranges. Is either a
2013
- BlobRestoreParameters type or a IO[bytes] type. Required.
2014
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.BlobRestoreParameters or IO[bytes]
2015
- :return: An instance of LROPoller that returns either BlobRestoreStatus or the result of
2016
- cls(response)
2017
- :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2019_06_01.models.BlobRestoreStatus]
2018
- :raises ~azure.core.exceptions.HttpResponseError:
2019
- """
2020
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
2021
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
2022
-
2023
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
2024
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
2025
- cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None)
2026
- polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
2027
- lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
2028
- cont_token: Optional[str] = kwargs.pop("continuation_token", None)
2029
- if cont_token is None:
2030
- raw_result = self._restore_blob_ranges_initial(
2031
- resource_group_name=resource_group_name,
2032
- account_name=account_name,
2033
- parameters=parameters,
2034
- api_version=api_version,
2035
- content_type=content_type,
2036
- cls=lambda x, y, z: x,
2037
- headers=_headers,
2038
- params=_params,
2039
- **kwargs
2040
- )
2041
- raw_result.http_response.read() # type: ignore
2042
- kwargs.pop("error_map", None)
2043
-
2044
- def get_long_running_output(pipeline_response):
2045
- deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response)
2046
- if cls:
2047
- return cls(pipeline_response, deserialized, {}) # type: ignore
2048
- return deserialized
2049
-
2050
- if polling is True:
2051
- polling_method: PollingMethod = cast(
2052
- PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
2053
- )
2054
- elif polling is False:
2055
- polling_method = cast(PollingMethod, NoPolling())
2056
- else:
2057
- polling_method = polling
2058
- if cont_token:
2059
- return LROPoller[_models.BlobRestoreStatus].from_continuation_token(
2060
- polling_method=polling_method,
2061
- continuation_token=cont_token,
2062
- client=self._client,
2063
- deserialization_callback=get_long_running_output,
2064
- )
2065
- return LROPoller[_models.BlobRestoreStatus](
2066
- self._client, raw_result, get_long_running_output, polling_method # type: ignore
2067
- )
2068
-
2069
- @distributed_trace
2070
- def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statements
2071
- self, resource_group_name: str, account_name: str, **kwargs: Any
2072
- ) -> None:
2073
- """Revoke user delegation keys.
2074
-
2075
- :param resource_group_name: The name of the resource group within the user's subscription. The
2076
- name is case insensitive. Required.
2077
- :type resource_group_name: str
2078
- :param account_name: The name of the storage account within the specified resource group.
2079
- Storage account names must be between 3 and 24 characters in length and use numbers and
2080
- lower-case letters only. Required.
2081
- :type account_name: str
2082
- :return: None or the result of cls(response)
2083
- :rtype: None
2084
- :raises ~azure.core.exceptions.HttpResponseError:
2085
- """
2086
- error_map: MutableMapping = {
2087
- 401: ClientAuthenticationError,
2088
- 404: ResourceNotFoundError,
2089
- 409: ResourceExistsError,
2090
- 304: ResourceNotModifiedError,
2091
- }
2092
- error_map.update(kwargs.pop("error_map", {}) or {})
2093
-
2094
- _headers = kwargs.pop("headers", {}) or {}
2095
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
2096
-
2097
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
2098
- cls: ClsType[None] = kwargs.pop("cls", None)
2099
-
2100
- _request = build_revoke_user_delegation_keys_request(
2101
- resource_group_name=resource_group_name,
2102
- account_name=account_name,
2103
- subscription_id=self._config.subscription_id,
2104
- api_version=api_version,
2105
- headers=_headers,
2106
- params=_params,
2107
- )
2108
- _request.url = self._client.format_url(_request.url)
2109
-
2110
- _stream = False
2111
- pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
2112
- _request, stream=_stream, **kwargs
2113
- )
2114
-
2115
- response = pipeline_response.http_response
2116
-
2117
- if response.status_code not in [200]:
2118
- map_error(status_code=response.status_code, response=response, error_map=error_map)
2119
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
2120
-
2121
- if cls:
2122
- return cls(pipeline_response, None, {}) # type: ignore