Search in sources :

Example 1 with UpdateBigQueryExportRequest

use of com.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest in project java-securitycenter by googleapis.

the class UpdateBigQueryExport method updateBigQueryExport.

// Updates an existing BigQuery export.
public static void updateBigQueryExport(String parent, String filter, String bigQueryExportId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (SecurityCenterClient client = SecurityCenterClient.create()) {
        // Set the new values for export configuration.
        BigQueryExport bigQueryExport = BigQueryExport.newBuilder().setName(String.format("%s/bigQueryExports/%s", parent, bigQueryExportId)).setFilter(filter).build();
        UpdateBigQueryExportRequest request = UpdateBigQueryExportRequest.newBuilder().setBigQueryExport(bigQueryExport).setUpdateMask(FieldMask.newBuilder().addPaths("filter").build()).build();
        BigQueryExport response = client.updateBigQueryExport(request);
        if (!response.getFilter().equalsIgnoreCase(filter)) {
            System.out.println("Failed to update BigQueryExport!");
            return;
        }
        System.out.println("BigQueryExport updated successfully!");
    }
}
Also used : BigQueryExport(com.google.cloud.securitycenter.v1.BigQueryExport) SecurityCenterClient(com.google.cloud.securitycenter.v1.SecurityCenterClient) UpdateBigQueryExportRequest(com.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest)

Aggregations

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