通过 API 列出 DocumentDB 集群时,RDS 集群被识别为 DocumentDB 集群

RDS Cluster is identified as DocumentDB cluster when listing DocumentDB cluster via API

我有一个包含 1 个实例且没有 DocumentDB 集群的 RDS 数据库集群。但是当我试图通过 API 列出 DocumentDB 集群时,例如

AmazonDocDB docdb= AmazonDocDBClientBuilder.standard().withRegion(Regions.EU_WEST_1).withCredentials(new AWSStaticCredentialsProvider(credentials)).build();
for(DBCluster db : docdb.describeDBClusters(new DescribeDBClustersRequest()).getDBClusters()) {
    System.out.println(db);
}

会returnRDS数据库集群的信息,我认为是错误的。问题是如何在不显示 RDS 数据库集群的情况下列出 DocumentDB 集群(在本例中为 none)?

请考虑查看 javadocs of the describeDBClusters method:

Returns information about provisioned Amazon DocumentDB clusters. This API operation supports pagination. For certain management features such as cluster and instance lifecycle management, Amazon DocumentDB leverages operational technology that is shared with Amazon RDS and Amazon Neptune. Use the filterName=engine,Values=docdb filter parameter to return only Amazon DocumentDB clusters.

我假设,虽然在 javadocs and the API description 中不清楚,但您可以在 DescribeDBClustersRequest 中提供所需的过滤器,例如:

AmazonDocDB docdb= AmazonDocDBClientBuilder.standard().withRegion(Regions.EU_WEST_1).withCredentials(new AWSStaticCredentialsProvider(credentials)).build();
Filter filter = new Filter()
  .withName("engine")
  .withValues("docdb");
DescribeDBClustersRequest request = new DescribeDBClustersRequest()
  .withFilters(filter);
for(DBCluster db : docdb.describeDBClusters(request).getDBClusters()) {
    System.out.println(db);
}