azure-mgmt-storage 22.2.0__py3-none-any.whl → 23.0.1__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 +68 -84
  14. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_blob_inventory_policies_operations.py +28 -36
  15. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_blob_services_operations.py +22 -24
  16. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_deleted_accounts_operations.py +16 -19
  17. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_encryption_scopes_operations.py +29 -32
  18. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_file_services_operations.py +26 -29
  19. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_file_shares_operations.py +38 -41
  20. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_local_users_operations.py +28 -31
  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 +18 -21
  23. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_object_replication_policies_operations.py +23 -25
  24. azure/mgmt/storage/{v2017_10_01/aio → aio}/operations/_operations.py +14 -17
  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 +23 -25
  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 +29 -32
  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 +14 -17
  31. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_storage_accounts_operations.py +83 -111
  32. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_storage_task_assignment_instances_report_operations.py +15 -17
  33. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_storage_task_assignments_instances_report_operations.py +15 -17
  34. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_storage_task_assignments_operations.py +38 -44
  35. azure/mgmt/storage/{v2024_01_01/aio → aio}/operations/_table_operations.py +29 -31
  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 +14 -16
  38. azure/mgmt/storage/{v2024_01_01/models → models}/_models_py3.py +857 -912
  39. azure/mgmt/storage/{v2016_01_01/operations → models}/_patch.py +5 -4
  40. azure/mgmt/storage/{v2024_01_01/operations → operations}/__init__.py +1 -0
  41. azure/mgmt/storage/{v2024_01_01/operations → operations}/_blob_containers_operations.py +84 -87
  42. azure/mgmt/storage/{v2024_01_01/operations → operations}/_blob_inventory_policies_operations.py +34 -42
  43. azure/mgmt/storage/{v2024_01_01/operations → operations}/_blob_services_operations.py +27 -30
  44. azure/mgmt/storage/{v2024_01_01/operations → operations}/_deleted_accounts_operations.py +19 -21
  45. azure/mgmt/storage/{v2024_01_01/operations → operations}/_encryption_scopes_operations.py +35 -37
  46. azure/mgmt/storage/{v2024_01_01/operations → operations}/_file_services_operations.py +33 -35
  47. azure/mgmt/storage/{v2024_01_01/operations → operations}/_file_shares_operations.py +47 -50
  48. azure/mgmt/storage/{v2024_01_01/operations → operations}/_local_users_operations.py +36 -38
  49. azure/mgmt/storage/{v2024_01_01/operations → operations}/_management_policies_operations.py +28 -35
  50. azure/mgmt/storage/{v2024_01_01/operations → operations}/_network_security_perimeter_configurations_operations.py +23 -25
  51. azure/mgmt/storage/{v2024_01_01/operations → operations}/_object_replication_policies_operations.py +29 -32
  52. azure/mgmt/storage/{v2024_01_01/operations → operations}/_operations.py +15 -18
  53. azure/mgmt/storage/operations/_patch.py +21 -0
  54. azure/mgmt/storage/{v2024_01_01/operations → operations}/_private_endpoint_connections_operations.py +29 -32
  55. azure/mgmt/storage/{v2024_01_01/operations → operations}/_private_link_resources_operations.py +14 -16
  56. azure/mgmt/storage/{v2024_01_01/operations → operations}/_queue_operations.py +36 -38
  57. azure/mgmt/storage/{v2024_01_01/operations → operations}/_queue_services_operations.py +24 -26
  58. azure/mgmt/storage/{v2024_01_01/operations → operations}/_skus_operations.py +15 -18
  59. azure/mgmt/storage/{v2024_01_01/operations → operations}/_storage_accounts_operations.py +101 -109
  60. azure/mgmt/storage/{v2024_01_01/operations → operations}/_storage_task_assignment_instances_report_operations.py +17 -21
  61. azure/mgmt/storage/{v2024_01_01/operations → operations}/_storage_task_assignments_instances_report_operations.py +17 -21
  62. azure/mgmt/storage/{v2024_01_01/operations → operations}/_storage_task_assignments_operations.py +42 -53
  63. azure/mgmt/storage/{v2024_01_01/operations → operations}/_table_operations.py +36 -38
  64. azure/mgmt/storage/{v2024_01_01/operations → operations}/_table_services_operations.py +24 -26
  65. azure/mgmt/storage/{v2024_01_01/operations → operations}/_usages_operations.py +16 -19
  66. {azure_mgmt_storage-22.2.0.dist-info → azure_mgmt_storage-23.0.1.dist-info}/METADATA +17 -6
  67. azure_mgmt_storage-23.0.1.dist-info/RECORD +73 -0
  68. azure/mgmt/storage/models.py +0 -8
  69. azure/mgmt/storage/v2016_01_01/__init__.py +0 -32
  70. azure/mgmt/storage/v2016_01_01/_configuration.py +0 -65
  71. azure/mgmt/storage/v2016_01_01/_patch.py +0 -32
  72. azure/mgmt/storage/v2016_01_01/_storage_management_client.py +0 -117
  73. azure/mgmt/storage/v2016_01_01/aio/__init__.py +0 -29
  74. azure/mgmt/storage/v2016_01_01/aio/_configuration.py +0 -65
  75. azure/mgmt/storage/v2016_01_01/aio/_patch.py +0 -32
  76. azure/mgmt/storage/v2016_01_01/aio/_storage_management_client.py +0 -120
  77. azure/mgmt/storage/v2016_01_01/aio/operations/__init__.py +0 -27
  78. azure/mgmt/storage/v2016_01_01/aio/operations/_storage_accounts_operations.py +0 -1023
  79. azure/mgmt/storage/v2016_01_01/aio/operations/_usage_operations.py +0 -130
  80. azure/mgmt/storage/v2016_01_01/models/__init__.py +0 -88
  81. azure/mgmt/storage/v2016_01_01/models/_models_py3.py +0 -829
  82. azure/mgmt/storage/v2016_01_01/models/_storage_management_client_enums.py +0 -99
  83. azure/mgmt/storage/v2016_01_01/operations/__init__.py +0 -27
  84. azure/mgmt/storage/v2016_01_01/operations/_storage_accounts_operations.py +0 -1278
  85. azure/mgmt/storage/v2016_01_01/operations/_usage_operations.py +0 -157
  86. azure/mgmt/storage/v2016_01_01/py.typed +0 -1
  87. azure/mgmt/storage/v2017_10_01/__init__.py +0 -32
  88. azure/mgmt/storage/v2017_10_01/_configuration.py +0 -65
  89. azure/mgmt/storage/v2017_10_01/_patch.py +0 -32
  90. azure/mgmt/storage/v2017_10_01/_storage_management.py +0 -121
  91. azure/mgmt/storage/v2017_10_01/_version.py +0 -9
  92. azure/mgmt/storage/v2017_10_01/aio/__init__.py +0 -29
  93. azure/mgmt/storage/v2017_10_01/aio/_configuration.py +0 -65
  94. azure/mgmt/storage/v2017_10_01/aio/_patch.py +0 -32
  95. azure/mgmt/storage/v2017_10_01/aio/_storage_management.py +0 -124
  96. azure/mgmt/storage/v2017_10_01/aio/operations/__init__.py +0 -31
  97. azure/mgmt/storage/v2017_10_01/aio/operations/_skus_operations.py +0 -130
  98. azure/mgmt/storage/v2017_10_01/aio/operations/_storage_accounts_operations.py +0 -1299
  99. azure/mgmt/storage/v2017_10_01/aio/operations/_usage_operations.py +0 -130
  100. azure/mgmt/storage/v2017_10_01/models/__init__.py +0 -140
  101. azure/mgmt/storage/v2017_10_01/models/_models_py3.py +0 -1851
  102. azure/mgmt/storage/v2017_10_01/models/_patch.py +0 -20
  103. azure/mgmt/storage/v2017_10_01/models/_storage_management_enums.py +0 -192
  104. azure/mgmt/storage/v2017_10_01/operations/__init__.py +0 -31
  105. azure/mgmt/storage/v2017_10_01/operations/_operations.py +0 -151
  106. azure/mgmt/storage/v2017_10_01/operations/_patch.py +0 -20
  107. azure/mgmt/storage/v2017_10_01/operations/_skus_operations.py +0 -157
  108. azure/mgmt/storage/v2017_10_01/operations/_storage_accounts_operations.py +0 -1638
  109. azure/mgmt/storage/v2017_10_01/operations/_usage_operations.py +0 -157
  110. azure/mgmt/storage/v2017_10_01/py.typed +0 -1
  111. azure/mgmt/storage/v2019_06_01/__init__.py +0 -32
  112. azure/mgmt/storage/v2019_06_01/_configuration.py +0 -64
  113. azure/mgmt/storage/v2019_06_01/_patch.py +0 -32
  114. azure/mgmt/storage/v2019_06_01/_storage_management_client.py +0 -213
  115. azure/mgmt/storage/v2019_06_01/_version.py +0 -9
  116. azure/mgmt/storage/v2019_06_01/aio/__init__.py +0 -29
  117. azure/mgmt/storage/v2019_06_01/aio/_configuration.py +0 -64
  118. azure/mgmt/storage/v2019_06_01/aio/_patch.py +0 -32
  119. azure/mgmt/storage/v2019_06_01/aio/_storage_management_client.py +0 -217
  120. azure/mgmt/storage/v2019_06_01/aio/operations/__init__.py +0 -59
  121. azure/mgmt/storage/v2019_06_01/aio/operations/_blob_containers_operations.py +0 -1725
  122. azure/mgmt/storage/v2019_06_01/aio/operations/_blob_inventory_policies_operations.py +0 -437
  123. azure/mgmt/storage/v2019_06_01/aio/operations/_blob_services_operations.py +0 -368
  124. azure/mgmt/storage/v2019_06_01/aio/operations/_encryption_scopes_operations.py +0 -538
  125. azure/mgmt/storage/v2019_06_01/aio/operations/_file_services_operations.py +0 -335
  126. azure/mgmt/storage/v2019_06_01/aio/operations/_file_shares_operations.py +0 -771
  127. azure/mgmt/storage/v2019_06_01/aio/operations/_object_replication_policies_operations.py +0 -428
  128. azure/mgmt/storage/v2019_06_01/aio/operations/_operations.py +0 -130
  129. azure/mgmt/storage/v2019_06_01/aio/operations/_patch.py +0 -20
  130. azure/mgmt/storage/v2019_06_01/aio/operations/_private_endpoint_connections_operations.py +0 -424
  131. azure/mgmt/storage/v2019_06_01/aio/operations/_private_link_resources_operations.py +0 -113
  132. azure/mgmt/storage/v2019_06_01/aio/operations/_queue_operations.py +0 -597
  133. azure/mgmt/storage/v2019_06_01/aio/operations/_queue_services_operations.py +0 -335
  134. azure/mgmt/storage/v2019_06_01/aio/operations/_skus_operations.py +0 -131
  135. azure/mgmt/storage/v2019_06_01/aio/operations/_storage_accounts_operations.py +0 -1696
  136. azure/mgmt/storage/v2019_06_01/aio/operations/_table_operations.py +0 -394
  137. azure/mgmt/storage/v2019_06_01/aio/operations/_table_services_operations.py +0 -335
  138. azure/mgmt/storage/v2019_06_01/aio/operations/_usages_operations.py +0 -134
  139. azure/mgmt/storage/v2019_06_01/models/__init__.py +0 -364
  140. azure/mgmt/storage/v2019_06_01/models/_models_py3.py +0 -6038
  141. azure/mgmt/storage/v2019_06_01/models/_patch.py +0 -20
  142. azure/mgmt/storage/v2019_06_01/models/_storage_management_client_enums.py +0 -456
  143. azure/mgmt/storage/v2019_06_01/operations/__init__.py +0 -59
  144. azure/mgmt/storage/v2019_06_01/operations/_blob_containers_operations.py +0 -2226
  145. azure/mgmt/storage/v2019_06_01/operations/_blob_inventory_policies_operations.py +0 -582
  146. azure/mgmt/storage/v2019_06_01/operations/_blob_services_operations.py +0 -476
  147. azure/mgmt/storage/v2019_06_01/operations/_encryption_scopes_operations.py +0 -677
  148. azure/mgmt/storage/v2019_06_01/operations/_file_services_operations.py +0 -444
  149. azure/mgmt/storage/v2019_06_01/operations/_file_shares_operations.py +0 -1000
  150. azure/mgmt/storage/v2019_06_01/operations/_management_policies_operations.py +0 -453
  151. azure/mgmt/storage/v2019_06_01/operations/_object_replication_policies_operations.py +0 -567
  152. azure/mgmt/storage/v2019_06_01/operations/_operations.py +0 -151
  153. azure/mgmt/storage/v2019_06_01/operations/_patch.py +0 -20
  154. azure/mgmt/storage/v2019_06_01/operations/_private_endpoint_connections_operations.py +0 -575
  155. azure/mgmt/storage/v2019_06_01/operations/_private_link_resources_operations.py +0 -149
  156. azure/mgmt/storage/v2019_06_01/operations/_queue_operations.py +0 -805
  157. azure/mgmt/storage/v2019_06_01/operations/_queue_services_operations.py +0 -444
  158. azure/mgmt/storage/v2019_06_01/operations/_skus_operations.py +0 -157
  159. azure/mgmt/storage/v2019_06_01/operations/_storage_accounts_operations.py +0 -2122
  160. azure/mgmt/storage/v2019_06_01/operations/_table_operations.py +0 -563
  161. azure/mgmt/storage/v2019_06_01/operations/_table_services_operations.py +0 -444
  162. azure/mgmt/storage/v2019_06_01/operations/_usages_operations.py +0 -164
  163. azure/mgmt/storage/v2019_06_01/py.typed +0 -1
  164. azure/mgmt/storage/v2024_01_01/__init__.py +0 -32
  165. azure/mgmt/storage/v2024_01_01/_configuration.py +0 -64
  166. azure/mgmt/storage/v2024_01_01/_patch.py +0 -20
  167. azure/mgmt/storage/v2024_01_01/_storage_management_client.py +0 -256
  168. azure/mgmt/storage/v2024_01_01/_version.py +0 -9
  169. azure/mgmt/storage/v2024_01_01/aio/__init__.py +0 -29
  170. azure/mgmt/storage/v2024_01_01/aio/_configuration.py +0 -64
  171. azure/mgmt/storage/v2024_01_01/aio/_patch.py +0 -20
  172. azure/mgmt/storage/v2024_01_01/aio/_storage_management_client.py +0 -261
  173. azure/mgmt/storage/v2024_01_01/aio/operations/_management_policies_operations.py +0 -343
  174. azure/mgmt/storage/v2024_01_01/aio/operations/_operations.py +0 -130
  175. azure/mgmt/storage/v2024_01_01/aio/operations/_patch.py +0 -20
  176. azure/mgmt/storage/v2024_01_01/models/_patch.py +0 -20
  177. azure/mgmt/storage/v2024_01_01/operations/_patch.py +0 -20
  178. azure/mgmt/storage/v2024_01_01/py.typed +0 -1
  179. azure_mgmt_storage-22.2.0.dist-info/RECORD +0 -183
  180. /azure/mgmt/storage/{v2024_01_01/models → models}/__init__.py +0 -0
  181. /azure/mgmt/storage/{v2024_01_01/models → models}/_storage_management_client_enums.py +0 -0
  182. {azure_mgmt_storage-22.2.0.dist-info → azure_mgmt_storage-23.0.1.dist-info}/LICENSE +0 -0
  183. {azure_mgmt_storage-22.2.0.dist-info → azure_mgmt_storage-23.0.1.dist-info}/WHEEL +0 -0
  184. {azure_mgmt_storage-22.2.0.dist-info → azure_mgmt_storage-23.0.1.dist-info}/top_level.txt +0 -0
@@ -1,1696 +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 (
12
- Any,
13
- AsyncIterable,
14
- AsyncIterator,
15
- Callable,
16
- Dict,
17
- IO,
18
- Literal,
19
- Optional,
20
- TypeVar,
21
- Union,
22
- cast,
23
- overload,
24
- )
25
- import urllib.parse
26
-
27
- from azure.core.async_paging import AsyncItemPaged, AsyncList
28
- from azure.core.exceptions import (
29
- ClientAuthenticationError,
30
- HttpResponseError,
31
- ResourceExistsError,
32
- ResourceNotFoundError,
33
- ResourceNotModifiedError,
34
- StreamClosedError,
35
- StreamConsumedError,
36
- map_error,
37
- )
38
- from azure.core.pipeline import PipelineResponse
39
- from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
40
- from azure.core.rest import AsyncHttpResponse, HttpRequest
41
- from azure.core.tracing.decorator import distributed_trace
42
- from azure.core.tracing.decorator_async import distributed_trace_async
43
- from azure.core.utils import case_insensitive_dict
44
- from azure.mgmt.core.exceptions import ARMErrorFormat
45
- from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
46
-
47
- from ... import models as _models
48
- from ...operations._storage_accounts_operations import (
49
- build_check_name_availability_request,
50
- build_create_request,
51
- build_delete_request,
52
- build_failover_request,
53
- build_get_properties_request,
54
- build_list_account_sas_request,
55
- build_list_by_resource_group_request,
56
- build_list_keys_request,
57
- build_list_request,
58
- build_list_service_sas_request,
59
- build_regenerate_key_request,
60
- build_restore_blob_ranges_request,
61
- build_revoke_user_delegation_keys_request,
62
- build_update_request,
63
- )
64
-
65
- if sys.version_info >= (3, 9):
66
- from collections.abc import MutableMapping
67
- else:
68
- from typing import MutableMapping # type: ignore
69
- T = TypeVar("T")
70
- ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
71
-
72
-
73
- class StorageAccountsOperations:
74
- """
75
- .. warning::
76
- **DO NOT** instantiate this class directly.
77
-
78
- Instead, you should access the following operations through
79
- :class:`~azure.mgmt.storage.v2019_06_01.aio.StorageManagementClient`'s
80
- :attr:`storage_accounts` attribute.
81
- """
82
-
83
- models = _models
84
-
85
- def __init__(self, *args, **kwargs) -> None:
86
- input_args = list(args)
87
- self._client = input_args.pop(0) if input_args else kwargs.pop("client")
88
- self._config = input_args.pop(0) if input_args else kwargs.pop("config")
89
- self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
90
- self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
91
- self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
92
-
93
- @overload
94
- async def check_name_availability(
95
- self,
96
- account_name: _models.StorageAccountCheckNameAvailabilityParameters,
97
- *,
98
- content_type: str = "application/json",
99
- **kwargs: Any
100
- ) -> _models.CheckNameAvailabilityResult:
101
- """Checks that the storage account name is valid and is not already in use.
102
-
103
- :param account_name: The name of the storage account within the specified resource group.
104
- Storage account names must be between 3 and 24 characters in length and use numbers and
105
- lower-case letters only. Required.
106
- :type account_name:
107
- ~azure.mgmt.storage.v2019_06_01.models.StorageAccountCheckNameAvailabilityParameters
108
- :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
109
- Default value is "application/json".
110
- :paramtype content_type: str
111
- :return: CheckNameAvailabilityResult or the result of cls(response)
112
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.CheckNameAvailabilityResult
113
- :raises ~azure.core.exceptions.HttpResponseError:
114
- """
115
-
116
- @overload
117
- async def check_name_availability(
118
- self, account_name: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
119
- ) -> _models.CheckNameAvailabilityResult:
120
- """Checks that the storage account name is valid and is not already in use.
121
-
122
- :param account_name: The name of the storage account within the specified resource group.
123
- Storage account names must be between 3 and 24 characters in length and use numbers and
124
- lower-case letters only. Required.
125
- :type account_name: IO[bytes]
126
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
127
- Default value is "application/json".
128
- :paramtype content_type: str
129
- :return: CheckNameAvailabilityResult or the result of cls(response)
130
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.CheckNameAvailabilityResult
131
- :raises ~azure.core.exceptions.HttpResponseError:
132
- """
133
-
134
- @distributed_trace_async
135
- async def check_name_availability(
136
- self, account_name: Union[_models.StorageAccountCheckNameAvailabilityParameters, IO[bytes]], **kwargs: Any
137
- ) -> _models.CheckNameAvailabilityResult:
138
- """Checks that the storage account name is valid and is not already in use.
139
-
140
- :param account_name: The name of the storage account within the specified resource group.
141
- Storage account names must be between 3 and 24 characters in length and use numbers and
142
- lower-case letters only. Is either a StorageAccountCheckNameAvailabilityParameters type or a
143
- IO[bytes] type. Required.
144
- :type account_name:
145
- ~azure.mgmt.storage.v2019_06_01.models.StorageAccountCheckNameAvailabilityParameters or
146
- IO[bytes]
147
- :return: CheckNameAvailabilityResult or the result of cls(response)
148
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.CheckNameAvailabilityResult
149
- :raises ~azure.core.exceptions.HttpResponseError:
150
- """
151
- error_map: MutableMapping = {
152
- 401: ClientAuthenticationError,
153
- 404: ResourceNotFoundError,
154
- 409: ResourceExistsError,
155
- 304: ResourceNotModifiedError,
156
- }
157
- error_map.update(kwargs.pop("error_map", {}) or {})
158
-
159
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
160
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
161
-
162
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
163
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
164
- cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None)
165
-
166
- content_type = content_type or "application/json"
167
- _json = None
168
- _content = None
169
- if isinstance(account_name, (IOBase, bytes)):
170
- _content = account_name
171
- else:
172
- _json = self._serialize.body(account_name, "StorageAccountCheckNameAvailabilityParameters")
173
-
174
- _request = build_check_name_availability_request(
175
- subscription_id=self._config.subscription_id,
176
- api_version=api_version,
177
- content_type=content_type,
178
- json=_json,
179
- content=_content,
180
- headers=_headers,
181
- params=_params,
182
- )
183
- _request.url = self._client.format_url(_request.url)
184
-
185
- _stream = False
186
- pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
187
- _request, stream=_stream, **kwargs
188
- )
189
-
190
- response = pipeline_response.http_response
191
-
192
- if response.status_code not in [200]:
193
- map_error(status_code=response.status_code, response=response, error_map=error_map)
194
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
195
-
196
- deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response)
197
-
198
- if cls:
199
- return cls(pipeline_response, deserialized, {}) # type: ignore
200
-
201
- return deserialized # type: ignore
202
-
203
- async def _create_initial(
204
- self,
205
- resource_group_name: str,
206
- account_name: str,
207
- parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]],
208
- **kwargs: Any
209
- ) -> AsyncIterator[bytes]:
210
- error_map: MutableMapping = {
211
- 401: ClientAuthenticationError,
212
- 404: ResourceNotFoundError,
213
- 409: ResourceExistsError,
214
- 304: ResourceNotModifiedError,
215
- }
216
- error_map.update(kwargs.pop("error_map", {}) or {})
217
-
218
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
219
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
220
-
221
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
222
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
223
- cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
224
-
225
- content_type = content_type or "application/json"
226
- _json = None
227
- _content = None
228
- if isinstance(parameters, (IOBase, bytes)):
229
- _content = parameters
230
- else:
231
- _json = self._serialize.body(parameters, "StorageAccountCreateParameters")
232
-
233
- _request = build_create_request(
234
- resource_group_name=resource_group_name,
235
- account_name=account_name,
236
- subscription_id=self._config.subscription_id,
237
- api_version=api_version,
238
- content_type=content_type,
239
- json=_json,
240
- content=_content,
241
- headers=_headers,
242
- params=_params,
243
- )
244
- _request.url = self._client.format_url(_request.url)
245
-
246
- _decompress = kwargs.pop("decompress", True)
247
- _stream = True
248
- pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
249
- _request, stream=_stream, **kwargs
250
- )
251
-
252
- response = pipeline_response.http_response
253
-
254
- if response.status_code not in [200, 202]:
255
- try:
256
- await response.read() # Load the body in memory and close the socket
257
- except (StreamConsumedError, StreamClosedError):
258
- pass
259
- map_error(status_code=response.status_code, response=response, error_map=error_map)
260
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
261
-
262
- deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
263
-
264
- if cls:
265
- return cls(pipeline_response, deserialized, {}) # type: ignore
266
-
267
- return deserialized # type: ignore
268
-
269
- @overload
270
- async def begin_create(
271
- self,
272
- resource_group_name: str,
273
- account_name: str,
274
- parameters: _models.StorageAccountCreateParameters,
275
- *,
276
- content_type: str = "application/json",
277
- **kwargs: Any
278
- ) -> AsyncLROPoller[_models.StorageAccount]:
279
- """Asynchronously creates a new storage account with the specified parameters. If an account is
280
- already created and a subsequent create request is issued with different properties, the
281
- account properties will be updated. If an account is already created and a subsequent create or
282
- update request is issued with the exact same set of properties, the request will succeed.
283
-
284
- :param resource_group_name: The name of the resource group within the user's subscription. The
285
- name is case insensitive. Required.
286
- :type resource_group_name: str
287
- :param account_name: The name of the storage account within the specified resource group.
288
- Storage account names must be between 3 and 24 characters in length and use numbers and
289
- lower-case letters only. Required.
290
- :type account_name: str
291
- :param parameters: The parameters to provide for the created account. Required.
292
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountCreateParameters
293
- :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
294
- Default value is "application/json".
295
- :paramtype content_type: str
296
- :return: An instance of AsyncLROPoller that returns either StorageAccount or the result of
297
- cls(response)
298
- :rtype:
299
- ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2019_06_01.models.StorageAccount]
300
- :raises ~azure.core.exceptions.HttpResponseError:
301
- """
302
-
303
- @overload
304
- async def begin_create(
305
- self,
306
- resource_group_name: str,
307
- account_name: str,
308
- parameters: IO[bytes],
309
- *,
310
- content_type: str = "application/json",
311
- **kwargs: Any
312
- ) -> AsyncLROPoller[_models.StorageAccount]:
313
- """Asynchronously creates a new storage account with the specified parameters. If an account is
314
- already created and a subsequent create request is issued with different properties, the
315
- account properties will be updated. If an account is already created and a subsequent create or
316
- update request is issued with the exact same set of properties, the request will succeed.
317
-
318
- :param resource_group_name: The name of the resource group within the user's subscription. The
319
- name is case insensitive. Required.
320
- :type resource_group_name: str
321
- :param account_name: The name of the storage account within the specified resource group.
322
- Storage account names must be between 3 and 24 characters in length and use numbers and
323
- lower-case letters only. Required.
324
- :type account_name: str
325
- :param parameters: The parameters to provide for the created account. Required.
326
- :type parameters: IO[bytes]
327
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
328
- Default value is "application/json".
329
- :paramtype content_type: str
330
- :return: An instance of AsyncLROPoller that returns either StorageAccount or the result of
331
- cls(response)
332
- :rtype:
333
- ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2019_06_01.models.StorageAccount]
334
- :raises ~azure.core.exceptions.HttpResponseError:
335
- """
336
-
337
- @distributed_trace_async
338
- async def begin_create(
339
- self,
340
- resource_group_name: str,
341
- account_name: str,
342
- parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]],
343
- **kwargs: Any
344
- ) -> AsyncLROPoller[_models.StorageAccount]:
345
- """Asynchronously creates a new storage account with the specified parameters. If an account is
346
- already created and a subsequent create request is issued with different properties, the
347
- account properties will be updated. If an account is already created and a subsequent create or
348
- update request is issued with the exact same set of properties, the request will succeed.
349
-
350
- :param resource_group_name: The name of the resource group within the user's subscription. The
351
- name is case insensitive. Required.
352
- :type resource_group_name: str
353
- :param account_name: The name of the storage account within the specified resource group.
354
- Storage account names must be between 3 and 24 characters in length and use numbers and
355
- lower-case letters only. Required.
356
- :type account_name: str
357
- :param parameters: The parameters to provide for the created account. Is either a
358
- StorageAccountCreateParameters type or a IO[bytes] type. Required.
359
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountCreateParameters or
360
- IO[bytes]
361
- :return: An instance of AsyncLROPoller that returns either StorageAccount or the result of
362
- cls(response)
363
- :rtype:
364
- ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2019_06_01.models.StorageAccount]
365
- :raises ~azure.core.exceptions.HttpResponseError:
366
- """
367
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
368
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
369
-
370
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
371
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
372
- cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None)
373
- polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
374
- lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
375
- cont_token: Optional[str] = kwargs.pop("continuation_token", None)
376
- if cont_token is None:
377
- raw_result = await self._create_initial(
378
- resource_group_name=resource_group_name,
379
- account_name=account_name,
380
- parameters=parameters,
381
- api_version=api_version,
382
- content_type=content_type,
383
- cls=lambda x, y, z: x,
384
- headers=_headers,
385
- params=_params,
386
- **kwargs
387
- )
388
- await raw_result.http_response.read() # type: ignore
389
- kwargs.pop("error_map", None)
390
-
391
- def get_long_running_output(pipeline_response):
392
- deserialized = self._deserialize("StorageAccount", pipeline_response.http_response)
393
- if cls:
394
- return cls(pipeline_response, deserialized, {}) # type: ignore
395
- return deserialized
396
-
397
- if polling is True:
398
- polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
399
- elif polling is False:
400
- polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
401
- else:
402
- polling_method = polling
403
- if cont_token:
404
- return AsyncLROPoller[_models.StorageAccount].from_continuation_token(
405
- polling_method=polling_method,
406
- continuation_token=cont_token,
407
- client=self._client,
408
- deserialization_callback=get_long_running_output,
409
- )
410
- return AsyncLROPoller[_models.StorageAccount](
411
- self._client, raw_result, get_long_running_output, polling_method # type: ignore
412
- )
413
-
414
- @distributed_trace_async
415
- async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None:
416
- """Deletes a storage account in Microsoft Azure.
417
-
418
- :param resource_group_name: The name of the resource group within the user's subscription. The
419
- name is case insensitive. Required.
420
- :type resource_group_name: str
421
- :param account_name: The name of the storage account within the specified resource group.
422
- Storage account names must be between 3 and 24 characters in length and use numbers and
423
- lower-case letters only. Required.
424
- :type account_name: str
425
- :return: None or the result of cls(response)
426
- :rtype: None
427
- :raises ~azure.core.exceptions.HttpResponseError:
428
- """
429
- error_map: MutableMapping = {
430
- 401: ClientAuthenticationError,
431
- 404: ResourceNotFoundError,
432
- 409: ResourceExistsError,
433
- 304: ResourceNotModifiedError,
434
- }
435
- error_map.update(kwargs.pop("error_map", {}) or {})
436
-
437
- _headers = kwargs.pop("headers", {}) or {}
438
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
439
-
440
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
441
- cls: ClsType[None] = kwargs.pop("cls", None)
442
-
443
- _request = build_delete_request(
444
- resource_group_name=resource_group_name,
445
- account_name=account_name,
446
- subscription_id=self._config.subscription_id,
447
- api_version=api_version,
448
- headers=_headers,
449
- params=_params,
450
- )
451
- _request.url = self._client.format_url(_request.url)
452
-
453
- _stream = False
454
- pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
455
- _request, stream=_stream, **kwargs
456
- )
457
-
458
- response = pipeline_response.http_response
459
-
460
- if response.status_code not in [200, 204]:
461
- map_error(status_code=response.status_code, response=response, error_map=error_map)
462
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
463
-
464
- if cls:
465
- return cls(pipeline_response, None, {}) # type: ignore
466
-
467
- @distributed_trace_async
468
- async def get_properties(
469
- self,
470
- resource_group_name: str,
471
- account_name: str,
472
- expand: Optional[Union[str, _models.StorageAccountExpand]] = None,
473
- **kwargs: Any
474
- ) -> _models.StorageAccount:
475
- """Returns the properties for the specified storage account including but not limited to name, SKU
476
- name, location, and account status. The ListKeys operation should be used to retrieve storage
477
- keys.
478
-
479
- :param resource_group_name: The name of the resource group within the user's subscription. The
480
- name is case insensitive. Required.
481
- :type resource_group_name: str
482
- :param account_name: The name of the storage account within the specified resource group.
483
- Storage account names must be between 3 and 24 characters in length and use numbers and
484
- lower-case letters only. Required.
485
- :type account_name: str
486
- :param expand: May be used to expand the properties within account's properties. By default,
487
- data is not included when fetching properties. Currently we only support geoReplicationStats
488
- and blobRestoreStatus. Known values are: "geoReplicationStats" and "blobRestoreStatus". Default
489
- value is None.
490
- :type expand: str or ~azure.mgmt.storage.v2019_06_01.models.StorageAccountExpand
491
- :return: StorageAccount or the result of cls(response)
492
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccount
493
- :raises ~azure.core.exceptions.HttpResponseError:
494
- """
495
- error_map: MutableMapping = {
496
- 401: ClientAuthenticationError,
497
- 404: ResourceNotFoundError,
498
- 409: ResourceExistsError,
499
- 304: ResourceNotModifiedError,
500
- }
501
- error_map.update(kwargs.pop("error_map", {}) or {})
502
-
503
- _headers = kwargs.pop("headers", {}) or {}
504
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
505
-
506
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
507
- cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None)
508
-
509
- _request = build_get_properties_request(
510
- resource_group_name=resource_group_name,
511
- account_name=account_name,
512
- subscription_id=self._config.subscription_id,
513
- expand=expand,
514
- api_version=api_version,
515
- headers=_headers,
516
- params=_params,
517
- )
518
- _request.url = self._client.format_url(_request.url)
519
-
520
- _stream = False
521
- pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
522
- _request, stream=_stream, **kwargs
523
- )
524
-
525
- response = pipeline_response.http_response
526
-
527
- if response.status_code not in [200]:
528
- map_error(status_code=response.status_code, response=response, error_map=error_map)
529
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
530
-
531
- deserialized = self._deserialize("StorageAccount", pipeline_response.http_response)
532
-
533
- if cls:
534
- return cls(pipeline_response, deserialized, {}) # type: ignore
535
-
536
- return deserialized # type: ignore
537
-
538
- @overload
539
- async def update(
540
- self,
541
- resource_group_name: str,
542
- account_name: str,
543
- parameters: _models.StorageAccountUpdateParameters,
544
- *,
545
- content_type: str = "application/json",
546
- **kwargs: Any
547
- ) -> _models.StorageAccount:
548
- """The update operation can be used to update the SKU, encryption, access tier, or tags for a
549
- storage account. It can also be used to map the account to a custom domain. Only one custom
550
- domain is supported per storage account; the replacement/change of custom domain is not
551
- supported. In order to replace an old custom domain, the old value must be cleared/unregistered
552
- before a new value can be set. The update of multiple properties is supported. This call does
553
- not change the storage keys for the account. If you want to change the storage account keys,
554
- use the regenerate keys operation. The location and name of the storage account cannot be
555
- changed after creation.
556
-
557
- :param resource_group_name: The name of the resource group within the user's subscription. The
558
- name is case insensitive. Required.
559
- :type resource_group_name: str
560
- :param account_name: The name of the storage account within the specified resource group.
561
- Storage account names must be between 3 and 24 characters in length and use numbers and
562
- lower-case letters only. Required.
563
- :type account_name: str
564
- :param parameters: The parameters to provide for the updated account. Required.
565
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountUpdateParameters
566
- :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
567
- Default value is "application/json".
568
- :paramtype content_type: str
569
- :return: StorageAccount or the result of cls(response)
570
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccount
571
- :raises ~azure.core.exceptions.HttpResponseError:
572
- """
573
-
574
- @overload
575
- async def update(
576
- self,
577
- resource_group_name: str,
578
- account_name: str,
579
- parameters: IO[bytes],
580
- *,
581
- content_type: str = "application/json",
582
- **kwargs: Any
583
- ) -> _models.StorageAccount:
584
- """The update operation can be used to update the SKU, encryption, access tier, or tags for a
585
- storage account. It can also be used to map the account to a custom domain. Only one custom
586
- domain is supported per storage account; the replacement/change of custom domain is not
587
- supported. In order to replace an old custom domain, the old value must be cleared/unregistered
588
- before a new value can be set. The update of multiple properties is supported. This call does
589
- not change the storage keys for the account. If you want to change the storage account keys,
590
- use the regenerate keys operation. The location and name of the storage account cannot be
591
- changed after creation.
592
-
593
- :param resource_group_name: The name of the resource group within the user's subscription. The
594
- name is case insensitive. Required.
595
- :type resource_group_name: str
596
- :param account_name: The name of the storage account within the specified resource group.
597
- Storage account names must be between 3 and 24 characters in length and use numbers and
598
- lower-case letters only. Required.
599
- :type account_name: str
600
- :param parameters: The parameters to provide for the updated account. Required.
601
- :type parameters: IO[bytes]
602
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
603
- Default value is "application/json".
604
- :paramtype content_type: str
605
- :return: StorageAccount or the result of cls(response)
606
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccount
607
- :raises ~azure.core.exceptions.HttpResponseError:
608
- """
609
-
610
- @distributed_trace_async
611
- async def update(
612
- self,
613
- resource_group_name: str,
614
- account_name: str,
615
- parameters: Union[_models.StorageAccountUpdateParameters, IO[bytes]],
616
- **kwargs: Any
617
- ) -> _models.StorageAccount:
618
- """The update operation can be used to update the SKU, encryption, access tier, or tags for a
619
- storage account. It can also be used to map the account to a custom domain. Only one custom
620
- domain is supported per storage account; the replacement/change of custom domain is not
621
- supported. In order to replace an old custom domain, the old value must be cleared/unregistered
622
- before a new value can be set. The update of multiple properties is supported. This call does
623
- not change the storage keys for the account. If you want to change the storage account keys,
624
- use the regenerate keys operation. The location and name of the storage account cannot be
625
- changed after creation.
626
-
627
- :param resource_group_name: The name of the resource group within the user's subscription. The
628
- name is case insensitive. Required.
629
- :type resource_group_name: str
630
- :param account_name: The name of the storage account within the specified resource group.
631
- Storage account names must be between 3 and 24 characters in length and use numbers and
632
- lower-case letters only. Required.
633
- :type account_name: str
634
- :param parameters: The parameters to provide for the updated account. Is either a
635
- StorageAccountUpdateParameters type or a IO[bytes] type. Required.
636
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountUpdateParameters or
637
- IO[bytes]
638
- :return: StorageAccount or the result of cls(response)
639
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccount
640
- :raises ~azure.core.exceptions.HttpResponseError:
641
- """
642
- error_map: MutableMapping = {
643
- 401: ClientAuthenticationError,
644
- 404: ResourceNotFoundError,
645
- 409: ResourceExistsError,
646
- 304: ResourceNotModifiedError,
647
- }
648
- error_map.update(kwargs.pop("error_map", {}) or {})
649
-
650
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
651
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
652
-
653
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
654
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
655
- cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None)
656
-
657
- content_type = content_type or "application/json"
658
- _json = None
659
- _content = None
660
- if isinstance(parameters, (IOBase, bytes)):
661
- _content = parameters
662
- else:
663
- _json = self._serialize.body(parameters, "StorageAccountUpdateParameters")
664
-
665
- _request = build_update_request(
666
- resource_group_name=resource_group_name,
667
- account_name=account_name,
668
- subscription_id=self._config.subscription_id,
669
- api_version=api_version,
670
- content_type=content_type,
671
- json=_json,
672
- content=_content,
673
- headers=_headers,
674
- params=_params,
675
- )
676
- _request.url = self._client.format_url(_request.url)
677
-
678
- _stream = False
679
- pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
680
- _request, stream=_stream, **kwargs
681
- )
682
-
683
- response = pipeline_response.http_response
684
-
685
- if response.status_code not in [200]:
686
- map_error(status_code=response.status_code, response=response, error_map=error_map)
687
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
688
-
689
- deserialized = self._deserialize("StorageAccount", pipeline_response.http_response)
690
-
691
- if cls:
692
- return cls(pipeline_response, deserialized, {}) # type: ignore
693
-
694
- return deserialized # type: ignore
695
-
696
- @distributed_trace
697
- def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]:
698
- """Lists all the storage accounts available under the subscription. Note that storage keys are not
699
- returned; use the ListKeys operation for this.
700
-
701
- :return: An iterator like instance of either StorageAccount or the result of cls(response)
702
- :rtype:
703
- ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.StorageAccount]
704
- :raises ~azure.core.exceptions.HttpResponseError:
705
- """
706
- _headers = kwargs.pop("headers", {}) or {}
707
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
708
-
709
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
710
- cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None)
711
-
712
- error_map: MutableMapping = {
713
- 401: ClientAuthenticationError,
714
- 404: ResourceNotFoundError,
715
- 409: ResourceExistsError,
716
- 304: ResourceNotModifiedError,
717
- }
718
- error_map.update(kwargs.pop("error_map", {}) or {})
719
-
720
- def prepare_request(next_link=None):
721
- if not next_link:
722
-
723
- _request = build_list_request(
724
- subscription_id=self._config.subscription_id,
725
- api_version=api_version,
726
- headers=_headers,
727
- params=_params,
728
- )
729
- _request.url = self._client.format_url(_request.url)
730
-
731
- else:
732
- # make call to next link with the client's api-version
733
- _parsed_next_link = urllib.parse.urlparse(next_link)
734
- _next_request_params = case_insensitive_dict(
735
- {
736
- key: [urllib.parse.quote(v) for v in value]
737
- for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
738
- }
739
- )
740
- _next_request_params["api-version"] = self._api_version
741
- _request = HttpRequest(
742
- "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
743
- )
744
- _request.url = self._client.format_url(_request.url)
745
- _request.method = "GET"
746
- return _request
747
-
748
- async def extract_data(pipeline_response):
749
- deserialized = self._deserialize("StorageAccountListResult", pipeline_response)
750
- list_of_elem = deserialized.value
751
- if cls:
752
- list_of_elem = cls(list_of_elem) # type: ignore
753
- return deserialized.next_link or None, AsyncList(list_of_elem)
754
-
755
- async def get_next(next_link=None):
756
- _request = prepare_request(next_link)
757
-
758
- _stream = False
759
- pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
760
- _request, stream=_stream, **kwargs
761
- )
762
- response = pipeline_response.http_response
763
-
764
- if response.status_code not in [200]:
765
- map_error(status_code=response.status_code, response=response, error_map=error_map)
766
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
767
-
768
- return pipeline_response
769
-
770
- return AsyncItemPaged(get_next, extract_data)
771
-
772
- @distributed_trace
773
- def list_by_resource_group(
774
- self, resource_group_name: str, **kwargs: Any
775
- ) -> AsyncIterable["_models.StorageAccount"]:
776
- """Lists all the storage accounts available under the given resource group. Note that storage keys
777
- are not returned; use the ListKeys operation for this.
778
-
779
- :param resource_group_name: The name of the resource group within the user's subscription. The
780
- name is case insensitive. Required.
781
- :type resource_group_name: str
782
- :return: An iterator like instance of either StorageAccount or the result of cls(response)
783
- :rtype:
784
- ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.StorageAccount]
785
- :raises ~azure.core.exceptions.HttpResponseError:
786
- """
787
- _headers = kwargs.pop("headers", {}) or {}
788
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
789
-
790
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
791
- cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None)
792
-
793
- error_map: MutableMapping = {
794
- 401: ClientAuthenticationError,
795
- 404: ResourceNotFoundError,
796
- 409: ResourceExistsError,
797
- 304: ResourceNotModifiedError,
798
- }
799
- error_map.update(kwargs.pop("error_map", {}) or {})
800
-
801
- def prepare_request(next_link=None):
802
- if not next_link:
803
-
804
- _request = build_list_by_resource_group_request(
805
- resource_group_name=resource_group_name,
806
- subscription_id=self._config.subscription_id,
807
- api_version=api_version,
808
- headers=_headers,
809
- params=_params,
810
- )
811
- _request.url = self._client.format_url(_request.url)
812
-
813
- else:
814
- # make call to next link with the client's api-version
815
- _parsed_next_link = urllib.parse.urlparse(next_link)
816
- _next_request_params = case_insensitive_dict(
817
- {
818
- key: [urllib.parse.quote(v) for v in value]
819
- for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
820
- }
821
- )
822
- _next_request_params["api-version"] = self._api_version
823
- _request = HttpRequest(
824
- "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
825
- )
826
- _request.url = self._client.format_url(_request.url)
827
- _request.method = "GET"
828
- return _request
829
-
830
- async def extract_data(pipeline_response):
831
- deserialized = self._deserialize("StorageAccountListResult", pipeline_response)
832
- list_of_elem = deserialized.value
833
- if cls:
834
- list_of_elem = cls(list_of_elem) # type: ignore
835
- return None, AsyncList(list_of_elem)
836
-
837
- async def get_next(next_link=None):
838
- _request = prepare_request(next_link)
839
-
840
- _stream = False
841
- pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
842
- _request, stream=_stream, **kwargs
843
- )
844
- response = pipeline_response.http_response
845
-
846
- if response.status_code not in [200]:
847
- map_error(status_code=response.status_code, response=response, error_map=error_map)
848
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
849
-
850
- return pipeline_response
851
-
852
- return AsyncItemPaged(get_next, extract_data)
853
-
854
- @distributed_trace_async
855
- async def list_keys(
856
- self, resource_group_name: str, account_name: str, expand: Literal["kerb"] = "kerb", **kwargs: Any
857
- ) -> _models.StorageAccountListKeysResult:
858
- """Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage
859
- account.
860
-
861
- :param resource_group_name: The name of the resource group within the user's subscription. The
862
- name is case insensitive. Required.
863
- :type resource_group_name: str
864
- :param account_name: The name of the storage account within the specified resource group.
865
- Storage account names must be between 3 and 24 characters in length and use numbers and
866
- lower-case letters only. Required.
867
- :type account_name: str
868
- :param expand: Specifies type of the key to be listed. Possible value is kerb. Known values are
869
- "kerb" and None. Default value is "kerb".
870
- :type expand: str
871
- :return: StorageAccountListKeysResult or the result of cls(response)
872
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountListKeysResult
873
- :raises ~azure.core.exceptions.HttpResponseError:
874
- """
875
- error_map: MutableMapping = {
876
- 401: ClientAuthenticationError,
877
- 404: ResourceNotFoundError,
878
- 409: ResourceExistsError,
879
- 304: ResourceNotModifiedError,
880
- }
881
- error_map.update(kwargs.pop("error_map", {}) or {})
882
-
883
- _headers = kwargs.pop("headers", {}) or {}
884
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
885
-
886
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
887
- cls: ClsType[_models.StorageAccountListKeysResult] = kwargs.pop("cls", None)
888
-
889
- _request = build_list_keys_request(
890
- resource_group_name=resource_group_name,
891
- account_name=account_name,
892
- subscription_id=self._config.subscription_id,
893
- expand=expand,
894
- api_version=api_version,
895
- headers=_headers,
896
- params=_params,
897
- )
898
- _request.url = self._client.format_url(_request.url)
899
-
900
- _stream = False
901
- pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
902
- _request, stream=_stream, **kwargs
903
- )
904
-
905
- response = pipeline_response.http_response
906
-
907
- if response.status_code not in [200]:
908
- map_error(status_code=response.status_code, response=response, error_map=error_map)
909
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
910
-
911
- deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response)
912
-
913
- if cls:
914
- return cls(pipeline_response, deserialized, {}) # type: ignore
915
-
916
- return deserialized # type: ignore
917
-
918
- @overload
919
- async def regenerate_key(
920
- self,
921
- resource_group_name: str,
922
- account_name: str,
923
- regenerate_key: _models.StorageAccountRegenerateKeyParameters,
924
- *,
925
- content_type: str = "application/json",
926
- **kwargs: Any
927
- ) -> _models.StorageAccountListKeysResult:
928
- """Regenerates one of the access keys or Kerberos keys for the specified storage account.
929
-
930
- :param resource_group_name: The name of the resource group within the user's subscription. The
931
- name is case insensitive. Required.
932
- :type resource_group_name: str
933
- :param account_name: The name of the storage account within the specified resource group.
934
- Storage account names must be between 3 and 24 characters in length and use numbers and
935
- lower-case letters only. Required.
936
- :type account_name: str
937
- :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2,
938
- kerb1, kerb2. Required.
939
- :type regenerate_key:
940
- ~azure.mgmt.storage.v2019_06_01.models.StorageAccountRegenerateKeyParameters
941
- :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
942
- Default value is "application/json".
943
- :paramtype content_type: str
944
- :return: StorageAccountListKeysResult or the result of cls(response)
945
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountListKeysResult
946
- :raises ~azure.core.exceptions.HttpResponseError:
947
- """
948
-
949
- @overload
950
- async def regenerate_key(
951
- self,
952
- resource_group_name: str,
953
- account_name: str,
954
- regenerate_key: IO[bytes],
955
- *,
956
- content_type: str = "application/json",
957
- **kwargs: Any
958
- ) -> _models.StorageAccountListKeysResult:
959
- """Regenerates one of the access keys or Kerberos keys for the specified storage account.
960
-
961
- :param resource_group_name: The name of the resource group within the user's subscription. The
962
- name is case insensitive. Required.
963
- :type resource_group_name: str
964
- :param account_name: The name of the storage account within the specified resource group.
965
- Storage account names must be between 3 and 24 characters in length and use numbers and
966
- lower-case letters only. Required.
967
- :type account_name: str
968
- :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2,
969
- kerb1, kerb2. Required.
970
- :type regenerate_key: IO[bytes]
971
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
972
- Default value is "application/json".
973
- :paramtype content_type: str
974
- :return: StorageAccountListKeysResult or the result of cls(response)
975
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountListKeysResult
976
- :raises ~azure.core.exceptions.HttpResponseError:
977
- """
978
-
979
- @distributed_trace_async
980
- async def regenerate_key(
981
- self,
982
- resource_group_name: str,
983
- account_name: str,
984
- regenerate_key: Union[_models.StorageAccountRegenerateKeyParameters, IO[bytes]],
985
- **kwargs: Any
986
- ) -> _models.StorageAccountListKeysResult:
987
- """Regenerates one of the access keys or Kerberos keys for the specified storage account.
988
-
989
- :param resource_group_name: The name of the resource group within the user's subscription. The
990
- name is case insensitive. Required.
991
- :type resource_group_name: str
992
- :param account_name: The name of the storage account within the specified resource group.
993
- Storage account names must be between 3 and 24 characters in length and use numbers and
994
- lower-case letters only. Required.
995
- :type account_name: str
996
- :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2,
997
- kerb1, kerb2. Is either a StorageAccountRegenerateKeyParameters type or a IO[bytes] type.
998
- Required.
999
- :type regenerate_key:
1000
- ~azure.mgmt.storage.v2019_06_01.models.StorageAccountRegenerateKeyParameters or IO[bytes]
1001
- :return: StorageAccountListKeysResult or the result of cls(response)
1002
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountListKeysResult
1003
- :raises ~azure.core.exceptions.HttpResponseError:
1004
- """
1005
- error_map: MutableMapping = {
1006
- 401: ClientAuthenticationError,
1007
- 404: ResourceNotFoundError,
1008
- 409: ResourceExistsError,
1009
- 304: ResourceNotModifiedError,
1010
- }
1011
- error_map.update(kwargs.pop("error_map", {}) or {})
1012
-
1013
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1014
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1015
-
1016
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
1017
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
1018
- cls: ClsType[_models.StorageAccountListKeysResult] = kwargs.pop("cls", None)
1019
-
1020
- content_type = content_type or "application/json"
1021
- _json = None
1022
- _content = None
1023
- if isinstance(regenerate_key, (IOBase, bytes)):
1024
- _content = regenerate_key
1025
- else:
1026
- _json = self._serialize.body(regenerate_key, "StorageAccountRegenerateKeyParameters")
1027
-
1028
- _request = build_regenerate_key_request(
1029
- resource_group_name=resource_group_name,
1030
- account_name=account_name,
1031
- subscription_id=self._config.subscription_id,
1032
- api_version=api_version,
1033
- content_type=content_type,
1034
- json=_json,
1035
- content=_content,
1036
- headers=_headers,
1037
- params=_params,
1038
- )
1039
- _request.url = self._client.format_url(_request.url)
1040
-
1041
- _stream = False
1042
- pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
1043
- _request, stream=_stream, **kwargs
1044
- )
1045
-
1046
- response = pipeline_response.http_response
1047
-
1048
- if response.status_code not in [200]:
1049
- map_error(status_code=response.status_code, response=response, error_map=error_map)
1050
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1051
-
1052
- deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response)
1053
-
1054
- if cls:
1055
- return cls(pipeline_response, deserialized, {}) # type: ignore
1056
-
1057
- return deserialized # type: ignore
1058
-
1059
- @overload
1060
- async def list_account_sas(
1061
- self,
1062
- resource_group_name: str,
1063
- account_name: str,
1064
- parameters: _models.AccountSasParameters,
1065
- *,
1066
- content_type: str = "application/json",
1067
- **kwargs: Any
1068
- ) -> _models.ListAccountSasResponse:
1069
- """List SAS credentials of a storage account.
1070
-
1071
- :param resource_group_name: The name of the resource group within the user's subscription. The
1072
- name is case insensitive. Required.
1073
- :type resource_group_name: str
1074
- :param account_name: The name of the storage account within the specified resource group.
1075
- Storage account names must be between 3 and 24 characters in length and use numbers and
1076
- lower-case letters only. Required.
1077
- :type account_name: str
1078
- :param parameters: The parameters to provide to list SAS credentials for the storage account.
1079
- Required.
1080
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.AccountSasParameters
1081
- :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
1082
- Default value is "application/json".
1083
- :paramtype content_type: str
1084
- :return: ListAccountSasResponse or the result of cls(response)
1085
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListAccountSasResponse
1086
- :raises ~azure.core.exceptions.HttpResponseError:
1087
- """
1088
-
1089
- @overload
1090
- async def list_account_sas(
1091
- self,
1092
- resource_group_name: str,
1093
- account_name: str,
1094
- parameters: IO[bytes],
1095
- *,
1096
- content_type: str = "application/json",
1097
- **kwargs: Any
1098
- ) -> _models.ListAccountSasResponse:
1099
- """List SAS credentials of a storage account.
1100
-
1101
- :param resource_group_name: The name of the resource group within the user's subscription. The
1102
- name is case insensitive. Required.
1103
- :type resource_group_name: str
1104
- :param account_name: The name of the storage account within the specified resource group.
1105
- Storage account names must be between 3 and 24 characters in length and use numbers and
1106
- lower-case letters only. Required.
1107
- :type account_name: str
1108
- :param parameters: The parameters to provide to list SAS credentials for the storage account.
1109
- Required.
1110
- :type parameters: IO[bytes]
1111
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1112
- Default value is "application/json".
1113
- :paramtype content_type: str
1114
- :return: ListAccountSasResponse or the result of cls(response)
1115
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListAccountSasResponse
1116
- :raises ~azure.core.exceptions.HttpResponseError:
1117
- """
1118
-
1119
- @distributed_trace_async
1120
- async def list_account_sas(
1121
- self,
1122
- resource_group_name: str,
1123
- account_name: str,
1124
- parameters: Union[_models.AccountSasParameters, IO[bytes]],
1125
- **kwargs: Any
1126
- ) -> _models.ListAccountSasResponse:
1127
- """List SAS credentials of a storage account.
1128
-
1129
- :param resource_group_name: The name of the resource group within the user's subscription. The
1130
- name is case insensitive. Required.
1131
- :type resource_group_name: str
1132
- :param account_name: The name of the storage account within the specified resource group.
1133
- Storage account names must be between 3 and 24 characters in length and use numbers and
1134
- lower-case letters only. Required.
1135
- :type account_name: str
1136
- :param parameters: The parameters to provide to list SAS credentials for the storage account.
1137
- Is either a AccountSasParameters type or a IO[bytes] type. Required.
1138
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.AccountSasParameters or IO[bytes]
1139
- :return: ListAccountSasResponse or the result of cls(response)
1140
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListAccountSasResponse
1141
- :raises ~azure.core.exceptions.HttpResponseError:
1142
- """
1143
- error_map: MutableMapping = {
1144
- 401: ClientAuthenticationError,
1145
- 404: ResourceNotFoundError,
1146
- 409: ResourceExistsError,
1147
- 304: ResourceNotModifiedError,
1148
- }
1149
- error_map.update(kwargs.pop("error_map", {}) or {})
1150
-
1151
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1152
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1153
-
1154
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
1155
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
1156
- cls: ClsType[_models.ListAccountSasResponse] = kwargs.pop("cls", None)
1157
-
1158
- content_type = content_type or "application/json"
1159
- _json = None
1160
- _content = None
1161
- if isinstance(parameters, (IOBase, bytes)):
1162
- _content = parameters
1163
- else:
1164
- _json = self._serialize.body(parameters, "AccountSasParameters")
1165
-
1166
- _request = build_list_account_sas_request(
1167
- resource_group_name=resource_group_name,
1168
- account_name=account_name,
1169
- subscription_id=self._config.subscription_id,
1170
- api_version=api_version,
1171
- content_type=content_type,
1172
- json=_json,
1173
- content=_content,
1174
- headers=_headers,
1175
- params=_params,
1176
- )
1177
- _request.url = self._client.format_url(_request.url)
1178
-
1179
- _stream = False
1180
- pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
1181
- _request, stream=_stream, **kwargs
1182
- )
1183
-
1184
- response = pipeline_response.http_response
1185
-
1186
- if response.status_code not in [200]:
1187
- map_error(status_code=response.status_code, response=response, error_map=error_map)
1188
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1189
-
1190
- deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response)
1191
-
1192
- if cls:
1193
- return cls(pipeline_response, deserialized, {}) # type: ignore
1194
-
1195
- return deserialized # type: ignore
1196
-
1197
- @overload
1198
- async def list_service_sas(
1199
- self,
1200
- resource_group_name: str,
1201
- account_name: str,
1202
- parameters: _models.ServiceSasParameters,
1203
- *,
1204
- content_type: str = "application/json",
1205
- **kwargs: Any
1206
- ) -> _models.ListServiceSasResponse:
1207
- """List service SAS credentials of a specific resource.
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
- :param account_name: The name of the storage account within the specified resource group.
1213
- Storage account names must be between 3 and 24 characters in length and use numbers and
1214
- lower-case letters only. Required.
1215
- :type account_name: str
1216
- :param parameters: The parameters to provide to list service SAS credentials. Required.
1217
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.ServiceSasParameters
1218
- :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
1219
- Default value is "application/json".
1220
- :paramtype content_type: str
1221
- :return: ListServiceSasResponse or the result of cls(response)
1222
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListServiceSasResponse
1223
- :raises ~azure.core.exceptions.HttpResponseError:
1224
- """
1225
-
1226
- @overload
1227
- async def list_service_sas(
1228
- self,
1229
- resource_group_name: str,
1230
- account_name: str,
1231
- parameters: IO[bytes],
1232
- *,
1233
- content_type: str = "application/json",
1234
- **kwargs: Any
1235
- ) -> _models.ListServiceSasResponse:
1236
- """List service SAS credentials of a specific resource.
1237
-
1238
- :param resource_group_name: The name of the resource group within the user's subscription. The
1239
- name is case insensitive. Required.
1240
- :type resource_group_name: str
1241
- :param account_name: The name of the storage account within the specified resource group.
1242
- Storage account names must be between 3 and 24 characters in length and use numbers and
1243
- lower-case letters only. Required.
1244
- :type account_name: str
1245
- :param parameters: The parameters to provide to list service SAS credentials. Required.
1246
- :type parameters: IO[bytes]
1247
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1248
- Default value is "application/json".
1249
- :paramtype content_type: str
1250
- :return: ListServiceSasResponse or the result of cls(response)
1251
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListServiceSasResponse
1252
- :raises ~azure.core.exceptions.HttpResponseError:
1253
- """
1254
-
1255
- @distributed_trace_async
1256
- async def list_service_sas(
1257
- self,
1258
- resource_group_name: str,
1259
- account_name: str,
1260
- parameters: Union[_models.ServiceSasParameters, IO[bytes]],
1261
- **kwargs: Any
1262
- ) -> _models.ListServiceSasResponse:
1263
- """List service SAS credentials of a specific resource.
1264
-
1265
- :param resource_group_name: The name of the resource group within the user's subscription. The
1266
- name is case insensitive. Required.
1267
- :type resource_group_name: str
1268
- :param account_name: The name of the storage account within the specified resource group.
1269
- Storage account names must be between 3 and 24 characters in length and use numbers and
1270
- lower-case letters only. Required.
1271
- :type account_name: str
1272
- :param parameters: The parameters to provide to list service SAS credentials. Is either a
1273
- ServiceSasParameters type or a IO[bytes] type. Required.
1274
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.ServiceSasParameters or IO[bytes]
1275
- :return: ListServiceSasResponse or the result of cls(response)
1276
- :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListServiceSasResponse
1277
- :raises ~azure.core.exceptions.HttpResponseError:
1278
- """
1279
- error_map: MutableMapping = {
1280
- 401: ClientAuthenticationError,
1281
- 404: ResourceNotFoundError,
1282
- 409: ResourceExistsError,
1283
- 304: ResourceNotModifiedError,
1284
- }
1285
- error_map.update(kwargs.pop("error_map", {}) or {})
1286
-
1287
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1288
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1289
-
1290
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
1291
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
1292
- cls: ClsType[_models.ListServiceSasResponse] = kwargs.pop("cls", None)
1293
-
1294
- content_type = content_type or "application/json"
1295
- _json = None
1296
- _content = None
1297
- if isinstance(parameters, (IOBase, bytes)):
1298
- _content = parameters
1299
- else:
1300
- _json = self._serialize.body(parameters, "ServiceSasParameters")
1301
-
1302
- _request = build_list_service_sas_request(
1303
- resource_group_name=resource_group_name,
1304
- account_name=account_name,
1305
- subscription_id=self._config.subscription_id,
1306
- api_version=api_version,
1307
- content_type=content_type,
1308
- json=_json,
1309
- content=_content,
1310
- headers=_headers,
1311
- params=_params,
1312
- )
1313
- _request.url = self._client.format_url(_request.url)
1314
-
1315
- _stream = False
1316
- pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
1317
- _request, stream=_stream, **kwargs
1318
- )
1319
-
1320
- response = pipeline_response.http_response
1321
-
1322
- if response.status_code not in [200]:
1323
- map_error(status_code=response.status_code, response=response, error_map=error_map)
1324
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1325
-
1326
- deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response)
1327
-
1328
- if cls:
1329
- return cls(pipeline_response, deserialized, {}) # type: ignore
1330
-
1331
- return deserialized # type: ignore
1332
-
1333
- async def _failover_initial(
1334
- self, resource_group_name: str, account_name: str, **kwargs: Any
1335
- ) -> AsyncIterator[bytes]:
1336
- error_map: MutableMapping = {
1337
- 401: ClientAuthenticationError,
1338
- 404: ResourceNotFoundError,
1339
- 409: ResourceExistsError,
1340
- 304: ResourceNotModifiedError,
1341
- }
1342
- error_map.update(kwargs.pop("error_map", {}) or {})
1343
-
1344
- _headers = kwargs.pop("headers", {}) or {}
1345
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1346
-
1347
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
1348
- cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
1349
-
1350
- _request = build_failover_request(
1351
- resource_group_name=resource_group_name,
1352
- account_name=account_name,
1353
- subscription_id=self._config.subscription_id,
1354
- api_version=api_version,
1355
- headers=_headers,
1356
- params=_params,
1357
- )
1358
- _request.url = self._client.format_url(_request.url)
1359
-
1360
- _decompress = kwargs.pop("decompress", True)
1361
- _stream = True
1362
- pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
1363
- _request, stream=_stream, **kwargs
1364
- )
1365
-
1366
- response = pipeline_response.http_response
1367
-
1368
- if response.status_code not in [200, 202]:
1369
- try:
1370
- await response.read() # Load the body in memory and close the socket
1371
- except (StreamConsumedError, StreamClosedError):
1372
- pass
1373
- map_error(status_code=response.status_code, response=response, error_map=error_map)
1374
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1375
-
1376
- deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
1377
-
1378
- if cls:
1379
- return cls(pipeline_response, deserialized, {}) # type: ignore
1380
-
1381
- return deserialized # type: ignore
1382
-
1383
- @distributed_trace_async
1384
- async def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]:
1385
- """Failover request can be triggered for a storage account in case of availability issues. The
1386
- failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS
1387
- accounts. The secondary cluster will become primary after failover.
1388
-
1389
- :param resource_group_name: The name of the resource group within the user's subscription. The
1390
- name is case insensitive. Required.
1391
- :type resource_group_name: str
1392
- :param account_name: The name of the storage account within the specified resource group.
1393
- Storage account names must be between 3 and 24 characters in length and use numbers and
1394
- lower-case letters only. Required.
1395
- :type account_name: str
1396
- :return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
1397
- :rtype: ~azure.core.polling.AsyncLROPoller[None]
1398
- :raises ~azure.core.exceptions.HttpResponseError:
1399
- """
1400
- _headers = kwargs.pop("headers", {}) or {}
1401
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1402
-
1403
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
1404
- cls: ClsType[None] = kwargs.pop("cls", None)
1405
- polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
1406
- lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
1407
- cont_token: Optional[str] = kwargs.pop("continuation_token", None)
1408
- if cont_token is None:
1409
- raw_result = await self._failover_initial(
1410
- resource_group_name=resource_group_name,
1411
- account_name=account_name,
1412
- api_version=api_version,
1413
- cls=lambda x, y, z: x,
1414
- headers=_headers,
1415
- params=_params,
1416
- **kwargs
1417
- )
1418
- await raw_result.http_response.read() # type: ignore
1419
- kwargs.pop("error_map", None)
1420
-
1421
- def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
1422
- if cls:
1423
- return cls(pipeline_response, None, {}) # type: ignore
1424
-
1425
- if polling is True:
1426
- polling_method: AsyncPollingMethod = cast(
1427
- AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
1428
- )
1429
- elif polling is False:
1430
- polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
1431
- else:
1432
- polling_method = polling
1433
- if cont_token:
1434
- return AsyncLROPoller[None].from_continuation_token(
1435
- polling_method=polling_method,
1436
- continuation_token=cont_token,
1437
- client=self._client,
1438
- deserialization_callback=get_long_running_output,
1439
- )
1440
- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
1441
-
1442
- async def _restore_blob_ranges_initial(
1443
- self,
1444
- resource_group_name: str,
1445
- account_name: str,
1446
- parameters: Union[_models.BlobRestoreParameters, IO[bytes]],
1447
- **kwargs: Any
1448
- ) -> AsyncIterator[bytes]:
1449
- error_map: MutableMapping = {
1450
- 401: ClientAuthenticationError,
1451
- 404: ResourceNotFoundError,
1452
- 409: ResourceExistsError,
1453
- 304: ResourceNotModifiedError,
1454
- }
1455
- error_map.update(kwargs.pop("error_map", {}) or {})
1456
-
1457
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1458
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1459
-
1460
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
1461
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
1462
- cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
1463
-
1464
- content_type = content_type or "application/json"
1465
- _json = None
1466
- _content = None
1467
- if isinstance(parameters, (IOBase, bytes)):
1468
- _content = parameters
1469
- else:
1470
- _json = self._serialize.body(parameters, "BlobRestoreParameters")
1471
-
1472
- _request = build_restore_blob_ranges_request(
1473
- resource_group_name=resource_group_name,
1474
- account_name=account_name,
1475
- subscription_id=self._config.subscription_id,
1476
- api_version=api_version,
1477
- content_type=content_type,
1478
- json=_json,
1479
- content=_content,
1480
- headers=_headers,
1481
- params=_params,
1482
- )
1483
- _request.url = self._client.format_url(_request.url)
1484
-
1485
- _decompress = kwargs.pop("decompress", True)
1486
- _stream = True
1487
- pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
1488
- _request, stream=_stream, **kwargs
1489
- )
1490
-
1491
- response = pipeline_response.http_response
1492
-
1493
- if response.status_code not in [200, 202]:
1494
- try:
1495
- await response.read() # Load the body in memory and close the socket
1496
- except (StreamConsumedError, StreamClosedError):
1497
- pass
1498
- map_error(status_code=response.status_code, response=response, error_map=error_map)
1499
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1500
-
1501
- deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
1502
-
1503
- if cls:
1504
- return cls(pipeline_response, deserialized, {}) # type: ignore
1505
-
1506
- return deserialized # type: ignore
1507
-
1508
- @overload
1509
- async def begin_restore_blob_ranges(
1510
- self,
1511
- resource_group_name: str,
1512
- account_name: str,
1513
- parameters: _models.BlobRestoreParameters,
1514
- *,
1515
- content_type: str = "application/json",
1516
- **kwargs: Any
1517
- ) -> AsyncLROPoller[_models.BlobRestoreStatus]:
1518
- """Restore blobs in the specified blob ranges.
1519
-
1520
- :param resource_group_name: The name of the resource group within the user's subscription. The
1521
- name is case insensitive. Required.
1522
- :type resource_group_name: str
1523
- :param account_name: The name of the storage account within the specified resource group.
1524
- Storage account names must be between 3 and 24 characters in length and use numbers and
1525
- lower-case letters only. Required.
1526
- :type account_name: str
1527
- :param parameters: The parameters to provide for restore blob ranges. Required.
1528
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.BlobRestoreParameters
1529
- :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
1530
- Default value is "application/json".
1531
- :paramtype content_type: str
1532
- :return: An instance of AsyncLROPoller that returns either BlobRestoreStatus or the result of
1533
- cls(response)
1534
- :rtype:
1535
- ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2019_06_01.models.BlobRestoreStatus]
1536
- :raises ~azure.core.exceptions.HttpResponseError:
1537
- """
1538
-
1539
- @overload
1540
- async def begin_restore_blob_ranges(
1541
- self,
1542
- resource_group_name: str,
1543
- account_name: str,
1544
- parameters: IO[bytes],
1545
- *,
1546
- content_type: str = "application/json",
1547
- **kwargs: Any
1548
- ) -> AsyncLROPoller[_models.BlobRestoreStatus]:
1549
- """Restore blobs in the specified blob ranges.
1550
-
1551
- :param resource_group_name: The name of the resource group within the user's subscription. The
1552
- name is case insensitive. Required.
1553
- :type resource_group_name: str
1554
- :param account_name: The name of the storage account within the specified resource group.
1555
- Storage account names must be between 3 and 24 characters in length and use numbers and
1556
- lower-case letters only. Required.
1557
- :type account_name: str
1558
- :param parameters: The parameters to provide for restore blob ranges. Required.
1559
- :type parameters: IO[bytes]
1560
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1561
- Default value is "application/json".
1562
- :paramtype content_type: str
1563
- :return: An instance of AsyncLROPoller that returns either BlobRestoreStatus or the result of
1564
- cls(response)
1565
- :rtype:
1566
- ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2019_06_01.models.BlobRestoreStatus]
1567
- :raises ~azure.core.exceptions.HttpResponseError:
1568
- """
1569
-
1570
- @distributed_trace_async
1571
- async def begin_restore_blob_ranges(
1572
- self,
1573
- resource_group_name: str,
1574
- account_name: str,
1575
- parameters: Union[_models.BlobRestoreParameters, IO[bytes]],
1576
- **kwargs: Any
1577
- ) -> AsyncLROPoller[_models.BlobRestoreStatus]:
1578
- """Restore blobs in the specified blob ranges.
1579
-
1580
- :param resource_group_name: The name of the resource group within the user's subscription. The
1581
- name is case insensitive. Required.
1582
- :type resource_group_name: str
1583
- :param account_name: The name of the storage account within the specified resource group.
1584
- Storage account names must be between 3 and 24 characters in length and use numbers and
1585
- lower-case letters only. Required.
1586
- :type account_name: str
1587
- :param parameters: The parameters to provide for restore blob ranges. Is either a
1588
- BlobRestoreParameters type or a IO[bytes] type. Required.
1589
- :type parameters: ~azure.mgmt.storage.v2019_06_01.models.BlobRestoreParameters or IO[bytes]
1590
- :return: An instance of AsyncLROPoller that returns either BlobRestoreStatus or the result of
1591
- cls(response)
1592
- :rtype:
1593
- ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2019_06_01.models.BlobRestoreStatus]
1594
- :raises ~azure.core.exceptions.HttpResponseError:
1595
- """
1596
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1597
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1598
-
1599
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
1600
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
1601
- cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None)
1602
- polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
1603
- lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
1604
- cont_token: Optional[str] = kwargs.pop("continuation_token", None)
1605
- if cont_token is None:
1606
- raw_result = await self._restore_blob_ranges_initial(
1607
- resource_group_name=resource_group_name,
1608
- account_name=account_name,
1609
- parameters=parameters,
1610
- api_version=api_version,
1611
- content_type=content_type,
1612
- cls=lambda x, y, z: x,
1613
- headers=_headers,
1614
- params=_params,
1615
- **kwargs
1616
- )
1617
- await raw_result.http_response.read() # type: ignore
1618
- kwargs.pop("error_map", None)
1619
-
1620
- def get_long_running_output(pipeline_response):
1621
- deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response)
1622
- if cls:
1623
- return cls(pipeline_response, deserialized, {}) # type: ignore
1624
- return deserialized
1625
-
1626
- if polling is True:
1627
- polling_method: AsyncPollingMethod = cast(
1628
- AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
1629
- )
1630
- elif polling is False:
1631
- polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
1632
- else:
1633
- polling_method = polling
1634
- if cont_token:
1635
- return AsyncLROPoller[_models.BlobRestoreStatus].from_continuation_token(
1636
- polling_method=polling_method,
1637
- continuation_token=cont_token,
1638
- client=self._client,
1639
- deserialization_callback=get_long_running_output,
1640
- )
1641
- return AsyncLROPoller[_models.BlobRestoreStatus](
1642
- self._client, raw_result, get_long_running_output, polling_method # type: ignore
1643
- )
1644
-
1645
- @distributed_trace_async
1646
- async def revoke_user_delegation_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None:
1647
- """Revoke user delegation keys.
1648
-
1649
- :param resource_group_name: The name of the resource group within the user's subscription. The
1650
- name is case insensitive. Required.
1651
- :type resource_group_name: str
1652
- :param account_name: The name of the storage account within the specified resource group.
1653
- Storage account names must be between 3 and 24 characters in length and use numbers and
1654
- lower-case letters only. Required.
1655
- :type account_name: str
1656
- :return: None or the result of cls(response)
1657
- :rtype: None
1658
- :raises ~azure.core.exceptions.HttpResponseError:
1659
- """
1660
- error_map: MutableMapping = {
1661
- 401: ClientAuthenticationError,
1662
- 404: ResourceNotFoundError,
1663
- 409: ResourceExistsError,
1664
- 304: ResourceNotModifiedError,
1665
- }
1666
- error_map.update(kwargs.pop("error_map", {}) or {})
1667
-
1668
- _headers = kwargs.pop("headers", {}) or {}
1669
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1670
-
1671
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01"))
1672
- cls: ClsType[None] = kwargs.pop("cls", None)
1673
-
1674
- _request = build_revoke_user_delegation_keys_request(
1675
- resource_group_name=resource_group_name,
1676
- account_name=account_name,
1677
- subscription_id=self._config.subscription_id,
1678
- api_version=api_version,
1679
- headers=_headers,
1680
- params=_params,
1681
- )
1682
- _request.url = self._client.format_url(_request.url)
1683
-
1684
- _stream = False
1685
- pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
1686
- _request, stream=_stream, **kwargs
1687
- )
1688
-
1689
- response = pipeline_response.http_response
1690
-
1691
- if response.status_code not in [200]:
1692
- map_error(status_code=response.status_code, response=response, error_map=error_map)
1693
- raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1694
-
1695
- if cls:
1696
- return cls(pipeline_response, None, {}) # type: ignore