use of com.google.cloud.securitycenter.v1.CreateBigQueryExportRequest in project java-securitycenter by googleapis.
the class CreateBigQueryExport method createBigQueryExport.
// Create export configuration to export findings from a project to a BigQuery dataset.
// Optionally specify filter to export certain findings only.
public static void createBigQueryExport(String parent, String filter, String bigQueryDatasetId, String bigQueryExportId) throws IOException {
// the "close" method on the client to safely clean up any remaining background resources.
try (SecurityCenterClient client = SecurityCenterClient.create()) {
// Create the BigQuery export configuration.
BigQueryExport bigQueryExport = BigQueryExport.newBuilder().setDescription("Export low and medium findings if the compute resource " + "has an IAM anomalous grant").setFilter(filter).setDataset(String.format("%s/datasets/%s", parent, bigQueryDatasetId)).build();
CreateBigQueryExportRequest bigQueryExportRequest = CreateBigQueryExportRequest.newBuilder().setParent(parent).setBigQueryExport(bigQueryExport).setBigQueryExportId(bigQueryExportId).build();
// Create the export request.
BigQueryExport response = client.createBigQueryExport(bigQueryExportRequest);
System.out.printf("BigQuery export request created successfully: %s\n", response.getName());
}
}
Aggregations