public Set<CosmosContainerDeletionEntry> getDeprecatedContainers(int maxEntries) throws CosmosException {
    SqlQuerySpec sqlQuerySpec =
        new SqlQuerySpec(DEPRECATED_CONTAINERS_QUERY, new SqlParameter(LIMIT_PARAM, maxEntries));
    Set<CosmosContainerDeletionEntry> containerDeletionEntries = new HashSet<>();

    try {
      // Execute cosmos query
      CosmosPagedFlux<CosmosContainerDeletionEntry> pagedFluxResponse =
          executeCosmosQueryAsync(cosmosDeletedContainerCollection, sqlQuerySpec, new CosmosQueryRequestOptions(),
              CosmosContainerDeletionEntry.class);
      pagedFluxResponse.byPage().flatMapSequential(fluxResponse -> {
        containerDeletionEntries.addAll(fluxResponse.getResults());
        return Flux.empty();
      }).blockLast();
    } catch (Exception ex) {
      if (ex instanceof CosmosException) {
        //Client-specific errors
        CosmosException cex = (CosmosException) ex;
        logger.warn("Get deprecated containers query {} got {}", sqlQuerySpec.getQueryText(), cex.getStatusCode());
        throw cex;
      }
      throw ex;
    }

    return containerDeletionEntries;
  }
Fetch a {@link Set} of {@link CosmosContainerDeletionEntry} objects from cosmos db that are not marked as deleted.
@param maxEntries Max number of entries to fetch on one query.
@return {@link Set} of {@link CosmosContainerDeletionEntry} objects.
@throws CosmosException in case of any error.
ambry-cloud/src/main/java/com/github/ambry/cloud/azure/CosmosDataAccessor.java