Search in sources :

Example 1 with CreateBigQueryExportRequest

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());
    }
}
Also used : CreateBigQueryExportRequest(com.google.cloud.securitycenter.v1.CreateBigQueryExportRequest) BigQueryExport(com.google.cloud.securitycenter.v1.BigQueryExport) SecurityCenterClient(com.google.cloud.securitycenter.v1.SecurityCenterClient)

Aggregations

BigQueryExport (com.google.cloud.securitycenter.v1.BigQueryExport)1 CreateBigQueryExportRequest (com.google.cloud.securitycenter.v1.CreateBigQueryExportRequest)1 SecurityCenterClient (com.google.cloud.securitycenter.v1.SecurityCenterClient)1