use of io.datarouter.aws.s3.config.DatarouterAwsS3Executors.BucketRegionExecutor in project datarouter by hotpads.
the class S3WebInspector method buildBucketTable.
private ContainerTag<?> buildBucketTable(String contextPath, ClientId clientId) {
DatarouterS3Client client = s3ClientManager.getClient(clientId);
List<S3BucketDto> buckets = client.scanBuckets().parallel(new ParallelScannerContext(bucketRegionExecutor, bucketRegionExecutor.getMaximumPoolSize(), true)).map(bucket -> {
// RPC
Region region = client.getBucketRegion(bucket.name());
return new S3BucketDto(clientId.getName(), bucket.name(), region, bucket.creationDate());
}).sort(Comparator.comparing(bucket -> bucket.bucketName.toLowerCase())).list();
var table = new J2HtmlTable<S3BucketDto>().withClasses("sortable table table-sm table-striped my-4 border").withHtmlColumn("Name", bucket -> {
String href = new URIBuilder().setPath(contextPath + paths.datarouter.clients.awsS3.listObjects.toSlashedString()).addParameter(S3BucketHandler.P_client, bucket.clientName).addParameter(S3BucketHandler.P_bucket, bucket.bucketName).addParameter(S3BucketHandler.P_delimiter, "/").toString();
return td(a(bucket.bucketName).withHref(href));
}).withColumn("Region", bucket -> bucket.region).withColumn("Created", bucket -> bucket.creationDate).build(buckets);
return div(h4("Buckets - " + buckets.size()), table).withClass("container-fluid my-4").withStyle("padding-left: 0px");
}
Aggregations