9
9
from copy import deepcopy
10
10
from typing import Any , TYPE_CHECKING
11
11
12
+ from azure .core .pipeline import policies
12
13
from azure .core .rest import HttpRequest , HttpResponse
13
14
from azure .mgmt .core import ARMPipelineClient
15
+ from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
14
16
15
17
from . import models as _models
16
18
from ._configuration import CosmosDBManagementClientConfiguration
23
25
CollectionPartitionOperations ,
24
26
CollectionPartitionRegionOperations ,
25
27
CollectionRegionOperations ,
26
- DataTransferJobsOperations ,
27
28
DatabaseAccountRegionOperations ,
28
29
DatabaseAccountsOperations ,
29
30
DatabaseOperations ,
30
- GraphResourcesOperations ,
31
31
GremlinResourcesOperations ,
32
32
LocationsOperations ,
33
- MongoClustersOperations ,
34
33
MongoDBResourcesOperations ,
35
34
NotebookWorkspacesOperations ,
36
35
Operations ,
56
55
ServiceOperations ,
57
56
SqlResourcesOperations ,
58
57
TableResourcesOperations ,
59
- ThroughputPoolAccountOperations ,
60
- ThroughputPoolAccountsOperations ,
61
- ThroughputPoolOperations ,
62
- ThroughputPoolsOperations ,
63
58
)
64
59
65
60
if TYPE_CHECKING :
@@ -100,8 +95,6 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke
100
95
:ivar partition_key_range_id_region: PartitionKeyRangeIdRegionOperations operations
101
96
:vartype partition_key_range_id_region:
102
97
azure.mgmt.cosmosdb.operations.PartitionKeyRangeIdRegionOperations
103
- :ivar graph_resources: GraphResourcesOperations operations
104
- :vartype graph_resources: azure.mgmt.cosmosdb.operations.GraphResourcesOperations
105
98
:ivar sql_resources: SqlResourcesOperations operations
106
99
:vartype sql_resources: azure.mgmt.cosmosdb.operations.SqlResourcesOperations
107
100
:ivar mongo_db_resources: MongoDBResourcesOperations operations
@@ -114,14 +107,10 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke
114
107
:vartype gremlin_resources: azure.mgmt.cosmosdb.operations.GremlinResourcesOperations
115
108
:ivar locations: LocationsOperations operations
116
109
:vartype locations: azure.mgmt.cosmosdb.operations.LocationsOperations
117
- :ivar data_transfer_jobs: DataTransferJobsOperations operations
118
- :vartype data_transfer_jobs: azure.mgmt.cosmosdb.operations.DataTransferJobsOperations
119
110
:ivar cassandra_clusters: CassandraClustersOperations operations
120
111
:vartype cassandra_clusters: azure.mgmt.cosmosdb.operations.CassandraClustersOperations
121
112
:ivar cassandra_data_centers: CassandraDataCentersOperations operations
122
113
:vartype cassandra_data_centers: azure.mgmt.cosmosdb.operations.CassandraDataCentersOperations
123
- :ivar mongo_clusters: MongoClustersOperations operations
124
- :vartype mongo_clusters: azure.mgmt.cosmosdb.operations.MongoClustersOperations
125
114
:ivar notebook_workspaces: NotebookWorkspacesOperations operations
126
115
:vartype notebook_workspaces: azure.mgmt.cosmosdb.operations.NotebookWorkspacesOperations
127
116
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
@@ -166,24 +155,14 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke
166
155
azure.mgmt.cosmosdb.operations.RestorableTableResourcesOperations
167
156
:ivar service: ServiceOperations operations
168
157
:vartype service: azure.mgmt.cosmosdb.operations.ServiceOperations
169
- :ivar throughput_pools: ThroughputPoolsOperations operations
170
- :vartype throughput_pools: azure.mgmt.cosmosdb.operations.ThroughputPoolsOperations
171
- :ivar throughput_pool: ThroughputPoolOperations operations
172
- :vartype throughput_pool: azure.mgmt.cosmosdb.operations.ThroughputPoolOperations
173
- :ivar throughput_pool_accounts: ThroughputPoolAccountsOperations operations
174
- :vartype throughput_pool_accounts:
175
- azure.mgmt.cosmosdb.operations.ThroughputPoolAccountsOperations
176
- :ivar throughput_pool_account: ThroughputPoolAccountOperations operations
177
- :vartype throughput_pool_account:
178
- azure.mgmt.cosmosdb.operations.ThroughputPoolAccountOperations
179
158
:param credential: Credential needed for the client to connect to Azure. Required.
180
159
:type credential: ~azure.core.credentials.TokenCredential
181
160
:param subscription_id: The ID of the target subscription. Required.
182
161
:type subscription_id: str
183
162
:param base_url: Service URL. Default value is "https://management.azure.com".
184
163
:type base_url: str
185
- :keyword api_version: Api Version. Default value is "2024-02 -15-preview ". Note that overriding
186
- this default value may result in unsupported behavior.
164
+ :keyword api_version: Api Version. Default value is "2024-05 -15". Note that overriding this
165
+ default value may result in unsupported behavior.
187
166
:paramtype api_version: str
188
167
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
189
168
Retry-After header is present.
@@ -199,7 +178,25 @@ def __init__(
199
178
self ._config = CosmosDBManagementClientConfiguration (
200
179
credential = credential , subscription_id = subscription_id , ** kwargs
201
180
)
202
- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
181
+ _policies = kwargs .pop ("policies" , None )
182
+ if _policies is None :
183
+ _policies = [
184
+ policies .RequestIdPolicy (** kwargs ),
185
+ self ._config .headers_policy ,
186
+ self ._config .user_agent_policy ,
187
+ self ._config .proxy_policy ,
188
+ policies .ContentDecodePolicy (** kwargs ),
189
+ ARMAutoResourceProviderRegistrationPolicy (),
190
+ self ._config .redirect_policy ,
191
+ self ._config .retry_policy ,
192
+ self ._config .authentication_policy ,
193
+ self ._config .custom_hook_policy ,
194
+ self ._config .logging_policy ,
195
+ policies .DistributedTracingPolicy (** kwargs ),
196
+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
197
+ self ._config .http_logging_policy ,
198
+ ]
199
+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
203
200
204
201
client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
205
202
self ._serialize = Serializer (client_models )
@@ -236,7 +233,6 @@ def __init__(
236
233
self .partition_key_range_id_region = PartitionKeyRangeIdRegionOperations (
237
234
self ._client , self ._config , self ._serialize , self ._deserialize
238
235
)
239
- self .graph_resources = GraphResourcesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
240
236
self .sql_resources = SqlResourcesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
241
237
self .mongo_db_resources = MongoDBResourcesOperations (
242
238
self ._client , self ._config , self ._serialize , self ._deserialize
@@ -249,16 +245,12 @@ def __init__(
249
245
self ._client , self ._config , self ._serialize , self ._deserialize
250
246
)
251
247
self .locations = LocationsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
252
- self .data_transfer_jobs = DataTransferJobsOperations (
253
- self ._client , self ._config , self ._serialize , self ._deserialize
254
- )
255
248
self .cassandra_clusters = CassandraClustersOperations (
256
249
self ._client , self ._config , self ._serialize , self ._deserialize
257
250
)
258
251
self .cassandra_data_centers = CassandraDataCentersOperations (
259
252
self ._client , self ._config , self ._serialize , self ._deserialize
260
253
)
261
- self .mongo_clusters = MongoClustersOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
262
254
self .notebook_workspaces = NotebookWorkspacesOperations (
263
255
self ._client , self ._config , self ._serialize , self ._deserialize
264
256
)
@@ -305,18 +297,8 @@ def __init__(
305
297
self ._client , self ._config , self ._serialize , self ._deserialize
306
298
)
307
299
self .service = ServiceOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
308
- self .throughput_pools = ThroughputPoolsOperations (
309
- self ._client , self ._config , self ._serialize , self ._deserialize
310
- )
311
- self .throughput_pool = ThroughputPoolOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
312
- self .throughput_pool_accounts = ThroughputPoolAccountsOperations (
313
- self ._client , self ._config , self ._serialize , self ._deserialize
314
- )
315
- self .throughput_pool_account = ThroughputPoolAccountOperations (
316
- self ._client , self ._config , self ._serialize , self ._deserialize
317
- )
318
300
319
- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
301
+ def _send_request (self , request : HttpRequest , * , stream : bool = False , * *kwargs : Any ) -> HttpResponse :
320
302
"""Runs the network request through the client's chained policies.
321
303
322
304
>>> from azure.core.rest import HttpRequest
@@ -336,7 +318,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
336
318
337
319
request_copy = deepcopy (request )
338
320
request_copy .url = self ._client .format_url (request_copy .url )
339
- return self ._client .send_request (request_copy , ** kwargs )
321
+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
340
322
341
323
def close (self ) -> None :
342
324
self ._client .close ()
0 commit comments