List BigQuery export configurations
Stay organized with collections
Save and categorize content based on your preferences.
List all the BigQuery export configurations in a given Google Cloud resource.
Code sample
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],[],[],[],null,["# List BigQuery export configurations\n\nList all the BigQuery export configurations in a given Google Cloud resource.\n\nCode sample\n-----------\n\n### Java\n\n\nTo authenticate to Security Command Center, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n\n import com.google.cloud.securitycenter.v1.https://cloud.google.com/java/docs/reference/google-cloud-securitycenter/latest/com.google.cloud.securitycenter.v1.BigQueryExport.html;\n import com.google.cloud.securitycenter.v1.https://cloud.google.com/java/docs/reference/google-cloud-securitycenter/latest/com.google.cloud.securitycenter.v1.SecurityCenterClient.html;\n import com.google.cloud.securitycenter.v1.https://cloud.google.com/java/docs/reference/google-cloud-securitycenter/latest/com.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest.html;\n import com.google.protobuf.https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.FieldMask.html;\n import java.io.IOException;\n\n public class UpdateBigQueryExport {\n\n public static void main(String[] args) throws IOException {\n // TODO(Developer): Modify the following variable values.\n\n // parent: Use any one of the following resource paths:\n // - organizations/{organization_id}\n // - folders/{folder_id}\n // - projects/{project_id}\n String parent = String.format(\"projects/%s\", \"your-google-cloud-project-id\");\n\n // filter: Expression that defines the filter to apply across create/update events of findings.\n String filter =\n \"severity=\\\"LOW\\\" OR severity=\\\"MEDIUM\\\" AND \"\n + \"category=\\\"Persistence: IAM Anomalous Grant\\\" AND \"\n + \"-resource.type:\\\"compute\\\"\";\n\n // bigQueryExportId: Unique identifier provided by the client.\n // For more info, see:\n // https://cloud.google.com/security-command-center/docs/how-to-analyze-findings-in-big-query#export_findings_from_to\n String bigQueryExportId = \"big-query-export-id\";\n\n updateBigQueryExport(parent, filter, bigQueryExportId);\n }\n\n // Updates an existing BigQuery export.\n public static void updateBigQueryExport(String parent, String filter, String bigQueryExportId)\n throws IOException {\n // Initialize client that will be used to send requests. This client only needs to be created\n // once, and can be reused for multiple requests. After completing all of your requests, call\n // the \"close\" method on the client to safely clean up any remaining background resources.\n try (https://cloud.google.com/java/docs/reference/google-cloud-securitycenter/latest/com.google.cloud.securitycenter.v1.SecurityCenterClient.html client = https://cloud.google.com/java/docs/reference/google-cloud-securitycenter/latest/com.google.cloud.securitycenter.v1.SecurityCenterClient.html.create()) {\n\n // Set the new values for export configuration.\n https://cloud.google.com/java/docs/reference/google-cloud-securitycenter/latest/com.google.cloud.securitycenter.v1.BigQueryExport.html bigQueryExport =\n https://cloud.google.com/java/docs/reference/google-cloud-securitycenter/latest/com.google.cloud.securitycenter.v1.BigQueryExport.html.newBuilder()\n .setName(String.format(\"%s/bigQueryExports/%s\", parent, bigQueryExportId))\n .setFilter(filter)\n .build();\n\n https://cloud.google.com/java/docs/reference/google-cloud-securitycenter/latest/com.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest.html request =\n https://cloud.google.com/java/docs/reference/google-cloud-securitycenter/latest/com.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest.html.newBuilder()\n .setBigQueryExport(bigQueryExport)\n // Set the update mask to specify which properties should be updated.\n // If empty, all mutable fields will be updated.\n // For more info on constructing field mask path, see the proto or:\n // https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.FieldMask\n .setUpdateMask(https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.FieldMask.html.newBuilder().https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.FieldMask.Builder.html#com_google_protobuf_FieldMask_Builder_addPaths_java_lang_String_(\"filter\").build())\n .build();\n\n https://cloud.google.com/java/docs/reference/google-cloud-securitycenter/latest/com.google.cloud.securitycenter.v1.BigQueryExport.html response = client.updateBigQueryExport(request);\n if (!response.https://cloud.google.com/java/docs/reference/google-cloud-securitycenter/latest/com.google.cloud.securitycenter.v1.BigQueryExport.html#com_google_cloud_securitycenter_v1_BigQueryExport_getFilter__().equalsIgnoreCase(filter)) {\n System.out.println(\"Failed to update BigQueryExport!\");\n return;\n }\n System.out.println(\"BigQueryExport updated successfully!\");\n }\n }\n }\n\n### Python\n\n\nTo authenticate to Security Command Center, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n def update_bigquery_export(parent: str, export_filter: str, bigquery_export_id: str):\n \"\"\"\n Updates an existing BigQuery export.\n Args:\n parent: Use any one of the following resource paths:\n - organizations/{organization_id}\n - folders/{folder_id}\n - projects/{project_id}\n export_filter: Expression that defines the filter to apply across create/update events of findings.\n bigquery_export_id: Unique identifier provided by the client.\n For more info, see:\n https://cloud.google.com/security-command-center/docs/how-to-analyze-findings-in-big-query#export_findings_from_to\n \"\"\"\n from google.cloud import securitycenter\n from google.protobuf import field_mask_pb2\n\n client = securitycenter.SecurityCenterClient()\n\n # Set the new values for export configuration.\n bigquery_export = securitycenter.https://cloud.google.com/python/docs/reference/securitycenter/latest/google.cloud.securitycenter_v1.types.BigQueryExport.html()\n bigquery_export.name = f\"{parent}/bigQueryExports/{bigquery_export_id}\"\n bigquery_export.filter = export_filter\n\n # Field mask to only update the export filter.\n # Set the update mask to specify which properties should be updated.\n # If empty, all mutable fields will be updated.\n # For more info on constructing field mask path, see the proto or:\n # https://googleapis.dev/python/protobuf/latest/google/protobuf/field_mask_pb2.html\n field_mask = field_mask_pb2.FieldMask(paths=[\"filter\"])\n\n request = securitycenter.https://cloud.google.com/python/docs/reference/securitycenter/latest/google.cloud.securitycenter_v1.types.UpdateBigQueryExportRequest.html()\n request.big_query_export = bigquery_export\n request.update_mask = field_mask\n\n response = client.https://cloud.google.com/python/docs/reference/securitycenter/latest/google.cloud.securitycenter_v1.services.security_center.SecurityCenterClient.html#google_cloud_securitycenter_v1_services_security_center_SecurityCenterClient_update_big_query_export(request)\n\n if response.filter != export_filter:\n print(\"Failed to update BigQueryExport!\")\n return\n print(\"BigQueryExport updated successfully!\")\n\nWhat's next\n-----------\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=securitycenter)."]]