|
22 | 22 |
|
23 | 23 | from ... import models as _models
|
24 | 24 | from ..._vendor import _convert_request
|
25 |
| -from ...operations._mongo_db_resources_operations import build_create_update_mongo_db_collection_request_initial, build_create_update_mongo_db_database_request_initial, build_create_update_mongo_role_definition_request_initial, build_create_update_mongo_user_definition_request_initial, build_delete_mongo_db_collection_request_initial, build_delete_mongo_db_database_request_initial, build_delete_mongo_role_definition_request_initial, build_delete_mongo_user_definition_request_initial, build_get_mongo_db_collection_request, build_get_mongo_db_collection_throughput_request, build_get_mongo_db_database_request, build_get_mongo_db_database_throughput_request, build_get_mongo_role_definition_request, build_get_mongo_user_definition_request, build_list_mongo_db_collections_request, build_list_mongo_db_databases_request, build_list_mongo_role_definitions_request, build_list_mongo_user_definitions_request, build_migrate_mongo_db_collection_to_autoscale_request_initial, build_migrate_mongo_db_collection_to_manual_throughput_request_initial, build_migrate_mongo_db_database_to_autoscale_request_initial, build_migrate_mongo_db_database_to_manual_throughput_request_initial, build_retrieve_continuous_backup_information_request_initial, build_update_mongo_db_collection_throughput_request_initial, build_update_mongo_db_database_throughput_request_initial |
| 25 | +from ...operations._mongo_db_resources_operations import build_create_update_mongo_db_collection_request_initial, build_create_update_mongo_db_database_request_initial, build_create_update_mongo_role_definition_request_initial, build_create_update_mongo_user_definition_request_initial, build_delete_mongo_db_collection_request_initial, build_delete_mongo_db_database_request_initial, build_delete_mongo_role_definition_request_initial, build_delete_mongo_user_definition_request_initial, build_get_mongo_db_collection_request, build_get_mongo_db_collection_throughput_request, build_get_mongo_db_database_request, build_get_mongo_db_database_throughput_request, build_get_mongo_role_definition_request, build_get_mongo_user_definition_request, build_list_mongo_db_collection_partition_merge_request_initial, build_list_mongo_db_collections_request, build_list_mongo_db_databases_request, build_list_mongo_role_definitions_request, build_list_mongo_user_definitions_request, build_migrate_mongo_db_collection_to_autoscale_request_initial, build_migrate_mongo_db_collection_to_manual_throughput_request_initial, build_migrate_mongo_db_database_to_autoscale_request_initial, build_migrate_mongo_db_database_to_manual_throughput_request_initial, build_retrieve_continuous_backup_information_request_initial, build_update_mongo_db_collection_throughput_request_initial, build_update_mongo_db_database_throughput_request_initial |
26 | 26 | T = TypeVar('T')
|
27 | 27 | ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
|
28 | 28 |
|
@@ -1197,6 +1197,137 @@ def get_long_running_output(pipeline_response):
|
1197 | 1197 |
|
1198 | 1198 | begin_delete_mongo_db_collection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}'} # type: ignore
|
1199 | 1199 |
|
| 1200 | + async def _list_mongo_db_collection_partition_merge_initial( |
| 1201 | + self, |
| 1202 | + resource_group_name: str, |
| 1203 | + account_name: str, |
| 1204 | + database_name: str, |
| 1205 | + collection_name: str, |
| 1206 | + merge_parameters: "_models.MergeParameters", |
| 1207 | + **kwargs: Any |
| 1208 | + ) -> Optional["_models.PhysicalPartitionStorageInfoCollection"]: |
| 1209 | + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PhysicalPartitionStorageInfoCollection"]] |
| 1210 | + error_map = { |
| 1211 | + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError |
| 1212 | + } |
| 1213 | + error_map.update(kwargs.pop('error_map', {})) |
| 1214 | + |
| 1215 | + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] |
| 1216 | + |
| 1217 | + _json = self._serialize.body(merge_parameters, 'MergeParameters') |
| 1218 | + |
| 1219 | + request = build_list_mongo_db_collection_partition_merge_request_initial( |
| 1220 | + subscription_id=self._config.subscription_id, |
| 1221 | + resource_group_name=resource_group_name, |
| 1222 | + account_name=account_name, |
| 1223 | + database_name=database_name, |
| 1224 | + collection_name=collection_name, |
| 1225 | + content_type=content_type, |
| 1226 | + json=_json, |
| 1227 | + template_url=self._list_mongo_db_collection_partition_merge_initial.metadata['url'], |
| 1228 | + ) |
| 1229 | + request = _convert_request(request) |
| 1230 | + request.url = self._client.format_url(request.url) |
| 1231 | + |
| 1232 | + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) |
| 1233 | + response = pipeline_response.http_response |
| 1234 | + |
| 1235 | + if response.status_code not in [200, 202]: |
| 1236 | + map_error(status_code=response.status_code, response=response, error_map=error_map) |
| 1237 | + raise HttpResponseError(response=response, error_format=ARMErrorFormat) |
| 1238 | + |
| 1239 | + deserialized = None |
| 1240 | + if response.status_code == 200: |
| 1241 | + deserialized = self._deserialize('PhysicalPartitionStorageInfoCollection', pipeline_response) |
| 1242 | + |
| 1243 | + if cls: |
| 1244 | + return cls(pipeline_response, deserialized, {}) |
| 1245 | + |
| 1246 | + return deserialized |
| 1247 | + |
| 1248 | + _list_mongo_db_collection_partition_merge_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/partitionMerge'} # type: ignore |
| 1249 | + |
| 1250 | + |
| 1251 | + @distributed_trace_async |
| 1252 | + async def begin_list_mongo_db_collection_partition_merge( |
| 1253 | + self, |
| 1254 | + resource_group_name: str, |
| 1255 | + account_name: str, |
| 1256 | + database_name: str, |
| 1257 | + collection_name: str, |
| 1258 | + merge_parameters: "_models.MergeParameters", |
| 1259 | + **kwargs: Any |
| 1260 | + ) -> AsyncLROPoller["_models.PhysicalPartitionStorageInfoCollection"]: |
| 1261 | + """Merges the partitions of a MongoDB Collection. |
| 1262 | +
|
| 1263 | + :param resource_group_name: The name of the resource group. The name is case insensitive. |
| 1264 | + :type resource_group_name: str |
| 1265 | + :param account_name: Cosmos DB database account name. |
| 1266 | + :type account_name: str |
| 1267 | + :param database_name: Cosmos DB database name. |
| 1268 | + :type database_name: str |
| 1269 | + :param collection_name: Cosmos DB collection name. |
| 1270 | + :type collection_name: str |
| 1271 | + :param merge_parameters: The parameters for the merge operation. |
| 1272 | + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters |
| 1273 | + :keyword callable cls: A custom type or function that will be passed the direct response |
| 1274 | + :keyword str continuation_token: A continuation token to restart a poller from a saved state. |
| 1275 | + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for |
| 1276 | + this operation to not poll, or pass in your own initialized polling object for a personal |
| 1277 | + polling strategy. |
| 1278 | + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod |
| 1279 | + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no |
| 1280 | + Retry-After header is present. |
| 1281 | + :return: An instance of AsyncLROPoller that returns either |
| 1282 | + PhysicalPartitionStorageInfoCollection or the result of cls(response) |
| 1283 | + :rtype: |
| 1284 | + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] |
| 1285 | + :raises: ~azure.core.exceptions.HttpResponseError |
| 1286 | + """ |
| 1287 | + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] |
| 1288 | + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] |
| 1289 | + cls = kwargs.pop('cls', None) # type: ClsType["_models.PhysicalPartitionStorageInfoCollection"] |
| 1290 | + lro_delay = kwargs.pop( |
| 1291 | + 'polling_interval', |
| 1292 | + self._config.polling_interval |
| 1293 | + ) |
| 1294 | + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] |
| 1295 | + if cont_token is None: |
| 1296 | + raw_result = await self._list_mongo_db_collection_partition_merge_initial( |
| 1297 | + resource_group_name=resource_group_name, |
| 1298 | + account_name=account_name, |
| 1299 | + database_name=database_name, |
| 1300 | + collection_name=collection_name, |
| 1301 | + merge_parameters=merge_parameters, |
| 1302 | + content_type=content_type, |
| 1303 | + cls=lambda x,y,z: x, |
| 1304 | + **kwargs |
| 1305 | + ) |
| 1306 | + kwargs.pop('error_map', None) |
| 1307 | + |
| 1308 | + def get_long_running_output(pipeline_response): |
| 1309 | + response = pipeline_response.http_response |
| 1310 | + deserialized = self._deserialize('PhysicalPartitionStorageInfoCollection', pipeline_response) |
| 1311 | + if cls: |
| 1312 | + return cls(pipeline_response, deserialized, {}) |
| 1313 | + return deserialized |
| 1314 | + |
| 1315 | + |
| 1316 | + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) |
| 1317 | + elif polling is False: polling_method = AsyncNoPolling() |
| 1318 | + else: polling_method = polling |
| 1319 | + if cont_token: |
| 1320 | + return AsyncLROPoller.from_continuation_token( |
| 1321 | + polling_method=polling_method, |
| 1322 | + continuation_token=cont_token, |
| 1323 | + client=self._client, |
| 1324 | + deserialization_callback=get_long_running_output |
| 1325 | + ) |
| 1326 | + else: |
| 1327 | + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) |
| 1328 | + |
| 1329 | + begin_list_mongo_db_collection_partition_merge.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/partitionMerge'} # type: ignore |
| 1330 | + |
1200 | 1331 | @distributed_trace_async
|
1201 | 1332 | async def get_mongo_db_collection_throughput(
|
1202 | 1333 | self,
|
|
0 commit comments