From d7ddeafaa23d8f7178011589203cd059405ee3b6 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 1 Mar 2022 12:52:13 +0000 Subject: [PATCH 1/9] chore(deps): update actions/setup-python action to v3 (#287) Source-Link: https://github.com/googleapis/synthtool/commit/571ee2c3b26182429eddcf115122ee545d7d3787 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:660abdf857d3ab9aabcd967c163c70e657fcc5653595c709263af5f3fa23ef67 --- .github/.OwlBot.lock.yaml | 3 +-- .github/workflows/docs.yml | 4 ++-- .github/workflows/lint.yml | 2 +- .github/workflows/unittest.yml | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index b668c04d..d9a55fa4 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6 - + digest: sha256:660abdf857d3ab9aabcd967c163c70e657fcc5653595c709263af5f3fa23ef67 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f7b8344c..cca4e98b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,7 +10,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: "3.10" - name: Install nox @@ -26,7 +26,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: "3.10" - name: Install nox diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1e8b05c3..f687324e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,7 +10,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: "3.10" - name: Install nox diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 074ee250..d3003e09 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -13,7 +13,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python }} - name: Install nox @@ -39,7 +39,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: "3.10" - name: Install coverage From 870a8b1cd71355dfd3909ff8da364b0f9a6d4e7c Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 1 Mar 2022 16:16:44 +0100 Subject: [PATCH 2/9] chore(deps): update all dependencies (#286) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- samples/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index fa4eab7d..e9e977ae 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,2 +1,2 @@ google-cloud-pubsub==2.9.0 -google-cloud-securitycenter==1.8.0 \ No newline at end of file +google-cloud-securitycenter==1.9.0 \ No newline at end of file From 71a4f6aabf756c6dd4a39ac43d0af93c3c889d12 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 2 Mar 2022 19:23:02 -0500 Subject: [PATCH 3/9] chore(deps): update actions/checkout action to v3 (#290) Source-Link: https://github.com/googleapis/synthtool/commit/ca879097772aeec2cbb971c3cea8ecc81522b68a Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:6162c384d685c5fe22521d3f37f6fc732bf99a085f6d47b677dbcae97fc21392 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .github/workflows/docs.yml | 4 ++-- .github/workflows/lint.yml | 2 +- .github/workflows/unittest.yml | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index d9a55fa4..480226ac 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:660abdf857d3ab9aabcd967c163c70e657fcc5653595c709263af5f3fa23ef67 + digest: sha256:6162c384d685c5fe22521d3f37f6fc732bf99a085f6d47b677dbcae97fc21392 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index cca4e98b..b46d7305 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python uses: actions/setup-python@v3 with: @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python uses: actions/setup-python@v3 with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f687324e..f512a496 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python uses: actions/setup-python@v3 with: diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index d3003e09..e87fe5b7 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -11,7 +11,7 @@ jobs: python: ['3.6', '3.7', '3.8', '3.9', '3.10'] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python uses: actions/setup-python@v3 with: @@ -37,7 +37,7 @@ jobs: - unit steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python uses: actions/setup-python@v3 with: From 0a29512a1b1e22a2205311a39f40759bfeafe468 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 4 Mar 2022 10:20:18 -0500 Subject: [PATCH 4/9] feat: Add BigQuery export APIs (#289) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Add BigQuery export APIs that help you enable writing new/updated findings from Security Command Center to a BigQuery table in near-real time. You can then integrate the data into existing workflows and create custom analyses. You can enable this feature at the organization, folder, and project levels to export findings based on your requirements PiperOrigin-RevId: 431905699 Source-Link: https://github.com/googleapis/googleapis/commit/4c1b56fddfb0d2490fc40dccb15baf4d3eae4bed Source-Link: https://github.com/googleapis/googleapis-gen/commit/fbaf35c6cd7f817f572289ed0f8a33812a6eb3b9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZmJhZjM1YzZjZDdmODE3ZjU3MjI4OWVkMGY4YTMzODEyYTZlYjNiOSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- google/cloud/securitycenter/__init__.py | 28 + google/cloud/securitycenter_v1/__init__.py | 16 + .../securitycenter_v1/gapic_metadata.json | 50 + .../services/security_center/async_client.py | 509 ++++++ .../services/security_center/client.py | 521 ++++++ .../services/security_center/pagers.py | 133 ++ .../security_center/transports/base.py | 80 + .../security_center/transports/grpc.py | 150 ++ .../transports/grpc_asyncio.py | 150 ++ .../cloud/securitycenter_v1/types/__init__.py | 16 + .../types/bigquery_export.py | 102 ++ .../cloud/securitycenter_v1/types/finding.py | 8 + .../securitycenter_v1/types/mitre_attack.py | 114 ++ .../types/securitycenter_service.py | 131 ++ .../securitycenter_v1/types/vulnerability.py | 4 + ...ty_center_create_big_query_export_async.py | 46 + ...ity_center_create_big_query_export_sync.py | 46 + ...ty_center_delete_big_query_export_async.py | 43 + ...ity_center_delete_big_query_export_sync.py | 43 + ...urity_center_get_big_query_export_async.py | 45 + ...curity_center_get_big_query_export_sync.py | 45 + ...ity_center_list_big_query_exports_async.py | 46 + ...rity_center_list_big_query_exports_sync.py | 46 + ...ty_center_update_big_query_export_async.py | 44 + ...ity_center_update_big_query_export_sync.py | 44 + .../snippet_metadata_securitycenter_v1.json | 441 +++++ scripts/fixup_securitycenter_v1_keywords.py | 5 + .../securitycenter_v1/test_security_center.py | 1581 ++++++++++++++++- 28 files changed, 4401 insertions(+), 86 deletions(-) create mode 100644 google/cloud/securitycenter_v1/types/bigquery_export.py create mode 100644 google/cloud/securitycenter_v1/types/mitre_attack.py create mode 100644 samples/generated_samples/securitycenter_v1_generated_security_center_create_big_query_export_async.py create mode 100644 samples/generated_samples/securitycenter_v1_generated_security_center_create_big_query_export_sync.py create mode 100644 samples/generated_samples/securitycenter_v1_generated_security_center_delete_big_query_export_async.py create mode 100644 samples/generated_samples/securitycenter_v1_generated_security_center_delete_big_query_export_sync.py create mode 100644 samples/generated_samples/securitycenter_v1_generated_security_center_get_big_query_export_async.py create mode 100644 samples/generated_samples/securitycenter_v1_generated_security_center_get_big_query_export_sync.py create mode 100644 samples/generated_samples/securitycenter_v1_generated_security_center_list_big_query_exports_async.py create mode 100644 samples/generated_samples/securitycenter_v1_generated_security_center_list_big_query_exports_sync.py create mode 100644 samples/generated_samples/securitycenter_v1_generated_security_center_update_big_query_export_async.py create mode 100644 samples/generated_samples/securitycenter_v1_generated_security_center_update_big_query_export_sync.py diff --git a/google/cloud/securitycenter/__init__.py b/google/cloud/securitycenter/__init__.py index 1b6f6462..b6b1d438 100644 --- a/google/cloud/securitycenter/__init__.py +++ b/google/cloud/securitycenter/__init__.py @@ -24,10 +24,12 @@ from google.cloud.securitycenter_v1.types.access import Access from google.cloud.securitycenter_v1.types.access import Geolocation from google.cloud.securitycenter_v1.types.asset import Asset +from google.cloud.securitycenter_v1.types.bigquery_export import BigQueryExport from google.cloud.securitycenter_v1.types.external_system import ExternalSystem from google.cloud.securitycenter_v1.types.finding import Finding from google.cloud.securitycenter_v1.types.folder import Folder from google.cloud.securitycenter_v1.types.indicator import Indicator +from google.cloud.securitycenter_v1.types.mitre_attack import MitreAttack from google.cloud.securitycenter_v1.types.mute_config import MuteConfig from google.cloud.securitycenter_v1.types.notification_config import NotificationConfig from google.cloud.securitycenter_v1.types.notification_message import ( @@ -47,6 +49,9 @@ from google.cloud.securitycenter_v1.types.securitycenter_service import ( BulkMuteFindingsResponse, ) +from google.cloud.securitycenter_v1.types.securitycenter_service import ( + CreateBigQueryExportRequest, +) from google.cloud.securitycenter_v1.types.securitycenter_service import ( CreateFindingRequest, ) @@ -59,12 +64,18 @@ from google.cloud.securitycenter_v1.types.securitycenter_service import ( CreateSourceRequest, ) +from google.cloud.securitycenter_v1.types.securitycenter_service import ( + DeleteBigQueryExportRequest, +) from google.cloud.securitycenter_v1.types.securitycenter_service import ( DeleteMuteConfigRequest, ) from google.cloud.securitycenter_v1.types.securitycenter_service import ( DeleteNotificationConfigRequest, ) +from google.cloud.securitycenter_v1.types.securitycenter_service import ( + GetBigQueryExportRequest, +) from google.cloud.securitycenter_v1.types.securitycenter_service import ( GetMuteConfigRequest, ) @@ -94,6 +105,12 @@ from google.cloud.securitycenter_v1.types.securitycenter_service import ( ListAssetsResponse, ) +from google.cloud.securitycenter_v1.types.securitycenter_service import ( + ListBigQueryExportsRequest, +) +from google.cloud.securitycenter_v1.types.securitycenter_service import ( + ListBigQueryExportsResponse, +) from google.cloud.securitycenter_v1.types.securitycenter_service import ( ListFindingsRequest, ) @@ -125,6 +142,9 @@ SetFindingStateRequest, ) from google.cloud.securitycenter_v1.types.securitycenter_service import SetMuteRequest +from google.cloud.securitycenter_v1.types.securitycenter_service import ( + UpdateBigQueryExportRequest, +) from google.cloud.securitycenter_v1.types.securitycenter_service import ( UpdateExternalSystemRequest, ) @@ -158,10 +178,12 @@ "Access", "Geolocation", "Asset", + "BigQueryExport", "ExternalSystem", "Finding", "Folder", "Indicator", + "MitreAttack", "MuteConfig", "NotificationConfig", "NotificationMessage", @@ -171,12 +193,15 @@ "SecurityMarks", "BulkMuteFindingsRequest", "BulkMuteFindingsResponse", + "CreateBigQueryExportRequest", "CreateFindingRequest", "CreateMuteConfigRequest", "CreateNotificationConfigRequest", "CreateSourceRequest", + "DeleteBigQueryExportRequest", "DeleteMuteConfigRequest", "DeleteNotificationConfigRequest", + "GetBigQueryExportRequest", "GetMuteConfigRequest", "GetNotificationConfigRequest", "GetOrganizationSettingsRequest", @@ -188,6 +213,8 @@ "GroupResult", "ListAssetsRequest", "ListAssetsResponse", + "ListBigQueryExportsRequest", + "ListBigQueryExportsResponse", "ListFindingsRequest", "ListFindingsResponse", "ListMuteConfigsRequest", @@ -199,6 +226,7 @@ "RunAssetDiscoveryRequest", "SetFindingStateRequest", "SetMuteRequest", + "UpdateBigQueryExportRequest", "UpdateExternalSystemRequest", "UpdateFindingRequest", "UpdateMuteConfigRequest", diff --git a/google/cloud/securitycenter_v1/__init__.py b/google/cloud/securitycenter_v1/__init__.py index 514e954d..5e0b19ee 100644 --- a/google/cloud/securitycenter_v1/__init__.py +++ b/google/cloud/securitycenter_v1/__init__.py @@ -20,10 +20,12 @@ from .types.access import Access from .types.access import Geolocation from .types.asset import Asset +from .types.bigquery_export import BigQueryExport from .types.external_system import ExternalSystem from .types.finding import Finding from .types.folder import Folder from .types.indicator import Indicator +from .types.mitre_attack import MitreAttack from .types.mute_config import MuteConfig from .types.notification_config import NotificationConfig from .types.notification_message import NotificationMessage @@ -33,12 +35,15 @@ from .types.security_marks import SecurityMarks from .types.securitycenter_service import BulkMuteFindingsRequest from .types.securitycenter_service import BulkMuteFindingsResponse +from .types.securitycenter_service import CreateBigQueryExportRequest from .types.securitycenter_service import CreateFindingRequest from .types.securitycenter_service import CreateMuteConfigRequest from .types.securitycenter_service import CreateNotificationConfigRequest from .types.securitycenter_service import CreateSourceRequest +from .types.securitycenter_service import DeleteBigQueryExportRequest from .types.securitycenter_service import DeleteMuteConfigRequest from .types.securitycenter_service import DeleteNotificationConfigRequest +from .types.securitycenter_service import GetBigQueryExportRequest from .types.securitycenter_service import GetMuteConfigRequest from .types.securitycenter_service import GetNotificationConfigRequest from .types.securitycenter_service import GetOrganizationSettingsRequest @@ -50,6 +55,8 @@ from .types.securitycenter_service import GroupResult from .types.securitycenter_service import ListAssetsRequest from .types.securitycenter_service import ListAssetsResponse +from .types.securitycenter_service import ListBigQueryExportsRequest +from .types.securitycenter_service import ListBigQueryExportsResponse from .types.securitycenter_service import ListFindingsRequest from .types.securitycenter_service import ListFindingsResponse from .types.securitycenter_service import ListMuteConfigsRequest @@ -61,6 +68,7 @@ from .types.securitycenter_service import RunAssetDiscoveryRequest from .types.securitycenter_service import SetFindingStateRequest from .types.securitycenter_service import SetMuteRequest +from .types.securitycenter_service import UpdateBigQueryExportRequest from .types.securitycenter_service import UpdateExternalSystemRequest from .types.securitycenter_service import UpdateFindingRequest from .types.securitycenter_service import UpdateMuteConfigRequest @@ -78,20 +86,24 @@ "SecurityCenterAsyncClient", "Access", "Asset", + "BigQueryExport", "BulkMuteFindingsRequest", "BulkMuteFindingsResponse", + "CreateBigQueryExportRequest", "CreateFindingRequest", "CreateMuteConfigRequest", "CreateNotificationConfigRequest", "CreateSourceRequest", "Cve", "Cvssv3", + "DeleteBigQueryExportRequest", "DeleteMuteConfigRequest", "DeleteNotificationConfigRequest", "ExternalSystem", "Finding", "Folder", "Geolocation", + "GetBigQueryExportRequest", "GetMuteConfigRequest", "GetNotificationConfigRequest", "GetOrganizationSettingsRequest", @@ -104,6 +116,8 @@ "Indicator", "ListAssetsRequest", "ListAssetsResponse", + "ListBigQueryExportsRequest", + "ListBigQueryExportsResponse", "ListFindingsRequest", "ListFindingsResponse", "ListMuteConfigsRequest", @@ -112,6 +126,7 @@ "ListNotificationConfigsResponse", "ListSourcesRequest", "ListSourcesResponse", + "MitreAttack", "MuteConfig", "NotificationConfig", "NotificationMessage", @@ -125,6 +140,7 @@ "SetFindingStateRequest", "SetMuteRequest", "Source", + "UpdateBigQueryExportRequest", "UpdateExternalSystemRequest", "UpdateFindingRequest", "UpdateMuteConfigRequest", diff --git a/google/cloud/securitycenter_v1/gapic_metadata.json b/google/cloud/securitycenter_v1/gapic_metadata.json index 0d42f887..2bae9fa8 100644 --- a/google/cloud/securitycenter_v1/gapic_metadata.json +++ b/google/cloud/securitycenter_v1/gapic_metadata.json @@ -15,6 +15,11 @@ "bulk_mute_findings" ] }, + "CreateBigQueryExport": { + "methods": [ + "create_big_query_export" + ] + }, "CreateFinding": { "methods": [ "create_finding" @@ -35,6 +40,11 @@ "create_source" ] }, + "DeleteBigQueryExport": { + "methods": [ + "delete_big_query_export" + ] + }, "DeleteMuteConfig": { "methods": [ "delete_mute_config" @@ -45,6 +55,11 @@ "delete_notification_config" ] }, + "GetBigQueryExport": { + "methods": [ + "get_big_query_export" + ] + }, "GetIamPolicy": { "methods": [ "get_iam_policy" @@ -85,6 +100,11 @@ "list_assets" ] }, + "ListBigQueryExports": { + "methods": [ + "list_big_query_exports" + ] + }, "ListFindings": { "methods": [ "list_findings" @@ -130,6 +150,11 @@ "test_iam_permissions" ] }, + "UpdateBigQueryExport": { + "methods": [ + "update_big_query_export" + ] + }, "UpdateExternalSystem": { "methods": [ "update_external_system" @@ -175,6 +200,11 @@ "bulk_mute_findings" ] }, + "CreateBigQueryExport": { + "methods": [ + "create_big_query_export" + ] + }, "CreateFinding": { "methods": [ "create_finding" @@ -195,6 +225,11 @@ "create_source" ] }, + "DeleteBigQueryExport": { + "methods": [ + "delete_big_query_export" + ] + }, "DeleteMuteConfig": { "methods": [ "delete_mute_config" @@ -205,6 +240,11 @@ "delete_notification_config" ] }, + "GetBigQueryExport": { + "methods": [ + "get_big_query_export" + ] + }, "GetIamPolicy": { "methods": [ "get_iam_policy" @@ -245,6 +285,11 @@ "list_assets" ] }, + "ListBigQueryExports": { + "methods": [ + "list_big_query_exports" + ] + }, "ListFindings": { "methods": [ "list_findings" @@ -290,6 +335,11 @@ "test_iam_permissions" ] }, + "UpdateBigQueryExport": { + "methods": [ + "update_big_query_export" + ] + }, "UpdateExternalSystem": { "methods": [ "update_external_system" diff --git a/google/cloud/securitycenter_v1/services/security_center/async_client.py b/google/cloud/securitycenter_v1/services/security_center/async_client.py index 496dede5..7846a9d9 100644 --- a/google/cloud/securitycenter_v1/services/security_center/async_client.py +++ b/google/cloud/securitycenter_v1/services/security_center/async_client.py @@ -35,10 +35,12 @@ from google.api_core import operation_async # type: ignore from google.cloud.securitycenter_v1.services.security_center import pagers from google.cloud.securitycenter_v1.types import access +from google.cloud.securitycenter_v1.types import bigquery_export from google.cloud.securitycenter_v1.types import external_system as gcs_external_system from google.cloud.securitycenter_v1.types import finding from google.cloud.securitycenter_v1.types import finding as gcs_finding from google.cloud.securitycenter_v1.types import indicator +from google.cloud.securitycenter_v1.types import mitre_attack from google.cloud.securitycenter_v1.types import mute_config from google.cloud.securitycenter_v1.types import mute_config as gcs_mute_config from google.cloud.securitycenter_v1.types import notification_config @@ -76,6 +78,10 @@ class SecurityCenterAsyncClient: asset_path = staticmethod(SecurityCenterClient.asset_path) parse_asset_path = staticmethod(SecurityCenterClient.parse_asset_path) + big_query_export_path = staticmethod(SecurityCenterClient.big_query_export_path) + parse_big_query_export_path = staticmethod( + SecurityCenterClient.parse_big_query_export_path + ) external_system_path = staticmethod(SecurityCenterClient.external_system_path) parse_external_system_path = staticmethod( SecurityCenterClient.parse_external_system_path @@ -1015,6 +1021,99 @@ def sample_delete_notification_config(): request, retry=retry, timeout=timeout, metadata=metadata, ) + async def get_big_query_export( + self, + request: Union[securitycenter_service.GetBigQueryExportRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> bigquery_export.BigQueryExport: + r"""Gets a big query export. + + .. code-block:: python + + from google.cloud import securitycenter_v1 + + def sample_get_big_query_export(): + # Create a client + client = securitycenter_v1.SecurityCenterClient() + + # Initialize request argument(s) + request = securitycenter_v1.GetBigQueryExportRequest( + name="name_value", + ) + + # Make the request + response = client.get_big_query_export(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.securitycenter_v1.types.GetBigQueryExportRequest, dict]): + The request object. Request message for retrieving a big + query export. + name (:class:`str`): + Required. Name of the big query export to retrieve. Its + format is + organizations/{organization}/bigQueryExports/{export_id}, + folders/{folder}/bigQueryExports/{export_id}, or + projects/{project}/bigQueryExports/{export_id} + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.securitycenter_v1.types.BigQueryExport: + Configures how to deliver Findings to + BigQuery Instance. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = securitycenter_service.GetBigQueryExportRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_big_query_export, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + async def get_iam_policy( self, request: Union[iam_policy_pb2.GetIamPolicyRequest, dict] = None, @@ -3646,6 +3745,416 @@ def sample_update_security_marks(): # Done; return the response. return response + async def create_big_query_export( + self, + request: Union[securitycenter_service.CreateBigQueryExportRequest, dict] = None, + *, + parent: str = None, + big_query_export: bigquery_export.BigQueryExport = None, + big_query_export_id: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> bigquery_export.BigQueryExport: + r"""Creates a big query export. + + .. code-block:: python + + from google.cloud import securitycenter_v1 + + def sample_create_big_query_export(): + # Create a client + client = securitycenter_v1.SecurityCenterClient() + + # Initialize request argument(s) + request = securitycenter_v1.CreateBigQueryExportRequest( + parent="parent_value", + big_query_export_id="big_query_export_id_value", + ) + + # Make the request + response = client.create_big_query_export(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.securitycenter_v1.types.CreateBigQueryExportRequest, dict]): + The request object. Request message for creating a big + query export. + parent (:class:`str`): + Required. Resource name of the new big query export's + parent. Its format is "organizations/[organization_id]", + "folders/[folder_id]", or "projects/[project_id]". + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + big_query_export (:class:`google.cloud.securitycenter_v1.types.BigQueryExport`): + Required. The big query export being + created. + + This corresponds to the ``big_query_export`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + big_query_export_id (:class:`str`): + Required. Unique identifier provided + by the client within the parent scope. + It must consist of lower case letters, + numbers, and hyphen, with the first + character a letter, the last a letter or + a number, and a 63 character maximum. + + This corresponds to the ``big_query_export_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.securitycenter_v1.types.BigQueryExport: + Configures how to deliver Findings to + BigQuery Instance. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, big_query_export, big_query_export_id]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = securitycenter_service.CreateBigQueryExportRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if big_query_export is not None: + request.big_query_export = big_query_export + if big_query_export_id is not None: + request.big_query_export_id = big_query_export_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_big_query_export, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_big_query_export( + self, + request: Union[securitycenter_service.DeleteBigQueryExportRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes an existing big query export. + + .. code-block:: python + + from google.cloud import securitycenter_v1 + + def sample_delete_big_query_export(): + # Create a client + client = securitycenter_v1.SecurityCenterClient() + + # Initialize request argument(s) + request = securitycenter_v1.DeleteBigQueryExportRequest( + name="name_value", + ) + + # Make the request + client.delete_big_query_export(request=request) + + Args: + request (Union[google.cloud.securitycenter_v1.types.DeleteBigQueryExportRequest, dict]): + The request object. Request message for deleting a big + query export. + name (:class:`str`): + Required. Name of the big query export to delete. Its + format is + organizations/{organization}/bigQueryExports/{export_id}, + folders/{folder}/bigQueryExports/{export_id}, or + projects/{project}/bigQueryExports/{export_id} + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = securitycenter_service.DeleteBigQueryExportRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_big_query_export, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def update_big_query_export( + self, + request: Union[securitycenter_service.UpdateBigQueryExportRequest, dict] = None, + *, + big_query_export: bigquery_export.BigQueryExport = None, + update_mask: field_mask_pb2.FieldMask = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> bigquery_export.BigQueryExport: + r"""Updates a BigQuery export. + + .. code-block:: python + + from google.cloud import securitycenter_v1 + + def sample_update_big_query_export(): + # Create a client + client = securitycenter_v1.SecurityCenterClient() + + # Initialize request argument(s) + request = securitycenter_v1.UpdateBigQueryExportRequest( + ) + + # Make the request + response = client.update_big_query_export(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.securitycenter_v1.types.UpdateBigQueryExportRequest, dict]): + The request object. Request message for updating a + BigQuery export. + big_query_export (:class:`google.cloud.securitycenter_v1.types.BigQueryExport`): + Required. The BigQuery export being + updated. + + This corresponds to the ``big_query_export`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + The list of fields to be updated. + If empty all mutable fields will be + updated. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.securitycenter_v1.types.BigQueryExport: + Configures how to deliver Findings to + BigQuery Instance. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([big_query_export, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = securitycenter_service.UpdateBigQueryExportRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if big_query_export is not None: + request.big_query_export = big_query_export + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_big_query_export, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("big_query_export.name", request.big_query_export.name),) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def list_big_query_exports( + self, + request: Union[securitycenter_service.ListBigQueryExportsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListBigQueryExportsAsyncPager: + r"""Lists BigQuery exports. Note that when requesting + BigQuery exports at a given level all exports under that + level are also returned e.g. if requesting BigQuery + exports under a folder, then all BigQuery exports + immediately under the folder plus the ones created under + the projects within the folder are returned. + + + .. code-block:: python + + from google.cloud import securitycenter_v1 + + def sample_list_big_query_exports(): + # Create a client + client = securitycenter_v1.SecurityCenterClient() + + # Initialize request argument(s) + request = securitycenter_v1.ListBigQueryExportsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_big_query_exports(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.securitycenter_v1.types.ListBigQueryExportsRequest, dict]): + The request object. Request message for listing + BigQuery exports at a given scope e.g. organization, + folder or project. + parent (:class:`str`): + Required. The parent, which owns the collection of + BigQuery exports. Its format is + "organizations/[organization_id]", + "folders/[folder_id]", "projects/[project_id]". + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.securitycenter_v1.services.security_center.pagers.ListBigQueryExportsAsyncPager: + Response message for listing BigQuery + exports. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = securitycenter_service.ListBigQueryExportsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_big_query_exports, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListBigQueryExportsAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + async def __aenter__(self): return self diff --git a/google/cloud/securitycenter_v1/services/security_center/client.py b/google/cloud/securitycenter_v1/services/security_center/client.py index 66d4a8dc..d6bbedaa 100644 --- a/google/cloud/securitycenter_v1/services/security_center/client.py +++ b/google/cloud/securitycenter_v1/services/security_center/client.py @@ -38,10 +38,12 @@ from google.api_core import operation_async # type: ignore from google.cloud.securitycenter_v1.services.security_center import pagers from google.cloud.securitycenter_v1.types import access +from google.cloud.securitycenter_v1.types import bigquery_export from google.cloud.securitycenter_v1.types import external_system as gcs_external_system from google.cloud.securitycenter_v1.types import finding from google.cloud.securitycenter_v1.types import finding as gcs_finding from google.cloud.securitycenter_v1.types import indicator +from google.cloud.securitycenter_v1.types import mitre_attack from google.cloud.securitycenter_v1.types import mute_config from google.cloud.securitycenter_v1.types import mute_config as gcs_mute_config from google.cloud.securitycenter_v1.types import notification_config @@ -202,6 +204,22 @@ def parse_asset_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def big_query_export_path(organization: str, export: str,) -> str: + """Returns a fully-qualified big_query_export string.""" + return "organizations/{organization}/bigQueryExports/{export}".format( + organization=organization, export=export, + ) + + @staticmethod + def parse_big_query_export_path(path: str) -> Dict[str, str]: + """Parses a big_query_export path into its component segments.""" + m = re.match( + r"^organizations/(?P.+?)/bigQueryExports/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def external_system_path( organization: str, source: str, finding: str, externalsystem: str, @@ -1317,6 +1335,99 @@ def sample_delete_notification_config(): request, retry=retry, timeout=timeout, metadata=metadata, ) + def get_big_query_export( + self, + request: Union[securitycenter_service.GetBigQueryExportRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> bigquery_export.BigQueryExport: + r"""Gets a big query export. + + .. code-block:: python + + from google.cloud import securitycenter_v1 + + def sample_get_big_query_export(): + # Create a client + client = securitycenter_v1.SecurityCenterClient() + + # Initialize request argument(s) + request = securitycenter_v1.GetBigQueryExportRequest( + name="name_value", + ) + + # Make the request + response = client.get_big_query_export(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.securitycenter_v1.types.GetBigQueryExportRequest, dict]): + The request object. Request message for retrieving a big + query export. + name (str): + Required. Name of the big query export to retrieve. Its + format is + organizations/{organization}/bigQueryExports/{export_id}, + folders/{folder}/bigQueryExports/{export_id}, or + projects/{project}/bigQueryExports/{export_id} + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.securitycenter_v1.types.BigQueryExport: + Configures how to deliver Findings to + BigQuery Instance. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a securitycenter_service.GetBigQueryExportRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, securitycenter_service.GetBigQueryExportRequest): + request = securitycenter_service.GetBigQueryExportRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_big_query_export] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + def get_iam_policy( self, request: Union[iam_policy_pb2.GetIamPolicyRequest, dict] = None, @@ -3854,6 +3965,416 @@ def sample_update_security_marks(): # Done; return the response. return response + def create_big_query_export( + self, + request: Union[securitycenter_service.CreateBigQueryExportRequest, dict] = None, + *, + parent: str = None, + big_query_export: bigquery_export.BigQueryExport = None, + big_query_export_id: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> bigquery_export.BigQueryExport: + r"""Creates a big query export. + + .. code-block:: python + + from google.cloud import securitycenter_v1 + + def sample_create_big_query_export(): + # Create a client + client = securitycenter_v1.SecurityCenterClient() + + # Initialize request argument(s) + request = securitycenter_v1.CreateBigQueryExportRequest( + parent="parent_value", + big_query_export_id="big_query_export_id_value", + ) + + # Make the request + response = client.create_big_query_export(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.securitycenter_v1.types.CreateBigQueryExportRequest, dict]): + The request object. Request message for creating a big + query export. + parent (str): + Required. Resource name of the new big query export's + parent. Its format is "organizations/[organization_id]", + "folders/[folder_id]", or "projects/[project_id]". + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + big_query_export (google.cloud.securitycenter_v1.types.BigQueryExport): + Required. The big query export being + created. + + This corresponds to the ``big_query_export`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + big_query_export_id (str): + Required. Unique identifier provided + by the client within the parent scope. + It must consist of lower case letters, + numbers, and hyphen, with the first + character a letter, the last a letter or + a number, and a 63 character maximum. + + This corresponds to the ``big_query_export_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.securitycenter_v1.types.BigQueryExport: + Configures how to deliver Findings to + BigQuery Instance. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, big_query_export, big_query_export_id]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a securitycenter_service.CreateBigQueryExportRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, securitycenter_service.CreateBigQueryExportRequest): + request = securitycenter_service.CreateBigQueryExportRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if big_query_export is not None: + request.big_query_export = big_query_export + if big_query_export_id is not None: + request.big_query_export_id = big_query_export_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_big_query_export] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_big_query_export( + self, + request: Union[securitycenter_service.DeleteBigQueryExportRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes an existing big query export. + + .. code-block:: python + + from google.cloud import securitycenter_v1 + + def sample_delete_big_query_export(): + # Create a client + client = securitycenter_v1.SecurityCenterClient() + + # Initialize request argument(s) + request = securitycenter_v1.DeleteBigQueryExportRequest( + name="name_value", + ) + + # Make the request + client.delete_big_query_export(request=request) + + Args: + request (Union[google.cloud.securitycenter_v1.types.DeleteBigQueryExportRequest, dict]): + The request object. Request message for deleting a big + query export. + name (str): + Required. Name of the big query export to delete. Its + format is + organizations/{organization}/bigQueryExports/{export_id}, + folders/{folder}/bigQueryExports/{export_id}, or + projects/{project}/bigQueryExports/{export_id} + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a securitycenter_service.DeleteBigQueryExportRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, securitycenter_service.DeleteBigQueryExportRequest): + request = securitycenter_service.DeleteBigQueryExportRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_big_query_export] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def update_big_query_export( + self, + request: Union[securitycenter_service.UpdateBigQueryExportRequest, dict] = None, + *, + big_query_export: bigquery_export.BigQueryExport = None, + update_mask: field_mask_pb2.FieldMask = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> bigquery_export.BigQueryExport: + r"""Updates a BigQuery export. + + .. code-block:: python + + from google.cloud import securitycenter_v1 + + def sample_update_big_query_export(): + # Create a client + client = securitycenter_v1.SecurityCenterClient() + + # Initialize request argument(s) + request = securitycenter_v1.UpdateBigQueryExportRequest( + ) + + # Make the request + response = client.update_big_query_export(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.securitycenter_v1.types.UpdateBigQueryExportRequest, dict]): + The request object. Request message for updating a + BigQuery export. + big_query_export (google.cloud.securitycenter_v1.types.BigQueryExport): + Required. The BigQuery export being + updated. + + This corresponds to the ``big_query_export`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + The list of fields to be updated. + If empty all mutable fields will be + updated. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.securitycenter_v1.types.BigQueryExport: + Configures how to deliver Findings to + BigQuery Instance. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([big_query_export, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a securitycenter_service.UpdateBigQueryExportRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, securitycenter_service.UpdateBigQueryExportRequest): + request = securitycenter_service.UpdateBigQueryExportRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if big_query_export is not None: + request.big_query_export = big_query_export + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_big_query_export] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("big_query_export.name", request.big_query_export.name),) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def list_big_query_exports( + self, + request: Union[securitycenter_service.ListBigQueryExportsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListBigQueryExportsPager: + r"""Lists BigQuery exports. Note that when requesting + BigQuery exports at a given level all exports under that + level are also returned e.g. if requesting BigQuery + exports under a folder, then all BigQuery exports + immediately under the folder plus the ones created under + the projects within the folder are returned. + + + .. code-block:: python + + from google.cloud import securitycenter_v1 + + def sample_list_big_query_exports(): + # Create a client + client = securitycenter_v1.SecurityCenterClient() + + # Initialize request argument(s) + request = securitycenter_v1.ListBigQueryExportsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_big_query_exports(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.securitycenter_v1.types.ListBigQueryExportsRequest, dict]): + The request object. Request message for listing + BigQuery exports at a given scope e.g. organization, + folder or project. + parent (str): + Required. The parent, which owns the collection of + BigQuery exports. Its format is + "organizations/[organization_id]", + "folders/[folder_id]", "projects/[project_id]". + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.securitycenter_v1.services.security_center.pagers.ListBigQueryExportsPager: + Response message for listing BigQuery + exports. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a securitycenter_service.ListBigQueryExportsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, securitycenter_service.ListBigQueryExportsRequest): + request = securitycenter_service.ListBigQueryExportsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_big_query_exports] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListBigQueryExportsPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + def __enter__(self): return self diff --git a/google/cloud/securitycenter_v1/services/security_center/pagers.py b/google/cloud/securitycenter_v1/services/security_center/pagers.py index 4d7487ac..483625e1 100644 --- a/google/cloud/securitycenter_v1/services/security_center/pagers.py +++ b/google/cloud/securitycenter_v1/services/security_center/pagers.py @@ -24,6 +24,7 @@ Iterator, ) +from google.cloud.securitycenter_v1.types import bigquery_export from google.cloud.securitycenter_v1.types import mute_config from google.cloud.securitycenter_v1.types import notification_config from google.cloud.securitycenter_v1.types import securitycenter_service @@ -942,3 +943,135 @@ async def async_generator(): def __repr__(self) -> str: return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListBigQueryExportsPager: + """A pager for iterating through ``list_big_query_exports`` requests. + + This class thinly wraps an initial + :class:`google.cloud.securitycenter_v1.types.ListBigQueryExportsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``big_query_exports`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListBigQueryExports`` requests and continue to iterate + through the ``big_query_exports`` field on the + corresponding responses. + + All the usual :class:`google.cloud.securitycenter_v1.types.ListBigQueryExportsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., securitycenter_service.ListBigQueryExportsResponse], + request: securitycenter_service.ListBigQueryExportsRequest, + response: securitycenter_service.ListBigQueryExportsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.securitycenter_v1.types.ListBigQueryExportsRequest): + The initial request object. + response (google.cloud.securitycenter_v1.types.ListBigQueryExportsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = securitycenter_service.ListBigQueryExportsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[securitycenter_service.ListBigQueryExportsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[bigquery_export.BigQueryExport]: + for page in self.pages: + yield from page.big_query_exports + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListBigQueryExportsAsyncPager: + """A pager for iterating through ``list_big_query_exports`` requests. + + This class thinly wraps an initial + :class:`google.cloud.securitycenter_v1.types.ListBigQueryExportsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``big_query_exports`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListBigQueryExports`` requests and continue to iterate + through the ``big_query_exports`` field on the + corresponding responses. + + All the usual :class:`google.cloud.securitycenter_v1.types.ListBigQueryExportsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[ + ..., Awaitable[securitycenter_service.ListBigQueryExportsResponse] + ], + request: securitycenter_service.ListBigQueryExportsRequest, + response: securitycenter_service.ListBigQueryExportsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.securitycenter_v1.types.ListBigQueryExportsRequest): + The initial request object. + response (google.cloud.securitycenter_v1.types.ListBigQueryExportsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = securitycenter_service.ListBigQueryExportsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages( + self, + ) -> AsyncIterator[securitycenter_service.ListBigQueryExportsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterator[bigquery_export.BigQueryExport]: + async def async_generator(): + async for page in self.pages: + for response in page.big_query_exports: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/securitycenter_v1/services/security_center/transports/base.py b/google/cloud/securitycenter_v1/services/security_center/transports/base.py index 5822280d..66941e5c 100644 --- a/google/cloud/securitycenter_v1/services/security_center/transports/base.py +++ b/google/cloud/securitycenter_v1/services/security_center/transports/base.py @@ -26,6 +26,7 @@ from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +from google.cloud.securitycenter_v1.types import bigquery_export from google.cloud.securitycenter_v1.types import external_system as gcs_external_system from google.cloud.securitycenter_v1.types import finding from google.cloud.securitycenter_v1.types import finding as gcs_finding @@ -166,6 +167,11 @@ def _prep_wrapped_messages(self, client_info): default_timeout=60.0, client_info=client_info, ), + self.get_big_query_export: gapic_v1.method.wrap_method( + self.get_big_query_export, + default_timeout=None, + client_info=client_info, + ), self.get_iam_policy: gapic_v1.method.wrap_method( self.get_iam_policy, default_retry=retries.Retry( @@ -378,6 +384,26 @@ def _prep_wrapped_messages(self, client_info): default_timeout=480.0, client_info=client_info, ), + self.create_big_query_export: gapic_v1.method.wrap_method( + self.create_big_query_export, + default_timeout=None, + client_info=client_info, + ), + self.delete_big_query_export: gapic_v1.method.wrap_method( + self.delete_big_query_export, + default_timeout=None, + client_info=client_info, + ), + self.update_big_query_export: gapic_v1.method.wrap_method( + self.update_big_query_export, + default_timeout=None, + client_info=client_info, + ), + self.list_big_query_exports: gapic_v1.method.wrap_method( + self.list_big_query_exports, + default_timeout=None, + client_info=client_info, + ), } def close(self): @@ -460,6 +486,17 @@ def delete_notification_config( ]: raise NotImplementedError() + @property + def get_big_query_export( + self, + ) -> Callable[ + [securitycenter_service.GetBigQueryExportRequest], + Union[ + bigquery_export.BigQueryExport, Awaitable[bigquery_export.BigQueryExport] + ], + ]: + raise NotImplementedError() + @property def get_iam_policy( self, @@ -718,5 +755,48 @@ def update_security_marks( ]: raise NotImplementedError() + @property + def create_big_query_export( + self, + ) -> Callable[ + [securitycenter_service.CreateBigQueryExportRequest], + Union[ + bigquery_export.BigQueryExport, Awaitable[bigquery_export.BigQueryExport] + ], + ]: + raise NotImplementedError() + + @property + def delete_big_query_export( + self, + ) -> Callable[ + [securitycenter_service.DeleteBigQueryExportRequest], + Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]], + ]: + raise NotImplementedError() + + @property + def update_big_query_export( + self, + ) -> Callable[ + [securitycenter_service.UpdateBigQueryExportRequest], + Union[ + bigquery_export.BigQueryExport, Awaitable[bigquery_export.BigQueryExport] + ], + ]: + raise NotImplementedError() + + @property + def list_big_query_exports( + self, + ) -> Callable[ + [securitycenter_service.ListBigQueryExportsRequest], + Union[ + securitycenter_service.ListBigQueryExportsResponse, + Awaitable[securitycenter_service.ListBigQueryExportsResponse], + ], + ]: + raise NotImplementedError() + __all__ = ("SecurityCenterTransport",) diff --git a/google/cloud/securitycenter_v1/services/security_center/transports/grpc.py b/google/cloud/securitycenter_v1/services/security_center/transports/grpc.py index daeb4e96..646be32e 100644 --- a/google/cloud/securitycenter_v1/services/security_center/transports/grpc.py +++ b/google/cloud/securitycenter_v1/services/security_center/transports/grpc.py @@ -25,6 +25,7 @@ import grpc # type: ignore +from google.cloud.securitycenter_v1.types import bigquery_export from google.cloud.securitycenter_v1.types import external_system as gcs_external_system from google.cloud.securitycenter_v1.types import finding from google.cloud.securitycenter_v1.types import finding as gcs_finding @@ -459,6 +460,35 @@ def delete_notification_config( ) return self._stubs["delete_notification_config"] + @property + def get_big_query_export( + self, + ) -> Callable[ + [securitycenter_service.GetBigQueryExportRequest], + bigquery_export.BigQueryExport, + ]: + r"""Return a callable for the get big query export method over gRPC. + + Gets a big query export. + + Returns: + Callable[[~.GetBigQueryExportRequest], + ~.BigQueryExport]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_big_query_export" not in self._stubs: + self._stubs["get_big_query_export"] = self.grpc_channel.unary_unary( + "/google.cloud.securitycenter.v1.SecurityCenter/GetBigQueryExport", + request_serializer=securitycenter_service.GetBigQueryExportRequest.serialize, + response_deserializer=bigquery_export.BigQueryExport.deserialize, + ) + return self._stubs["get_big_query_export"] + @property def get_iam_policy( self, @@ -1151,6 +1181,126 @@ def update_security_marks( ) return self._stubs["update_security_marks"] + @property + def create_big_query_export( + self, + ) -> Callable[ + [securitycenter_service.CreateBigQueryExportRequest], + bigquery_export.BigQueryExport, + ]: + r"""Return a callable for the create big query export method over gRPC. + + Creates a big query export. + + Returns: + Callable[[~.CreateBigQueryExportRequest], + ~.BigQueryExport]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_big_query_export" not in self._stubs: + self._stubs["create_big_query_export"] = self.grpc_channel.unary_unary( + "/google.cloud.securitycenter.v1.SecurityCenter/CreateBigQueryExport", + request_serializer=securitycenter_service.CreateBigQueryExportRequest.serialize, + response_deserializer=bigquery_export.BigQueryExport.deserialize, + ) + return self._stubs["create_big_query_export"] + + @property + def delete_big_query_export( + self, + ) -> Callable[ + [securitycenter_service.DeleteBigQueryExportRequest], empty_pb2.Empty + ]: + r"""Return a callable for the delete big query export method over gRPC. + + Deletes an existing big query export. + + Returns: + Callable[[~.DeleteBigQueryExportRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_big_query_export" not in self._stubs: + self._stubs["delete_big_query_export"] = self.grpc_channel.unary_unary( + "/google.cloud.securitycenter.v1.SecurityCenter/DeleteBigQueryExport", + request_serializer=securitycenter_service.DeleteBigQueryExportRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs["delete_big_query_export"] + + @property + def update_big_query_export( + self, + ) -> Callable[ + [securitycenter_service.UpdateBigQueryExportRequest], + bigquery_export.BigQueryExport, + ]: + r"""Return a callable for the update big query export method over gRPC. + + Updates a BigQuery export. + + Returns: + Callable[[~.UpdateBigQueryExportRequest], + ~.BigQueryExport]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_big_query_export" not in self._stubs: + self._stubs["update_big_query_export"] = self.grpc_channel.unary_unary( + "/google.cloud.securitycenter.v1.SecurityCenter/UpdateBigQueryExport", + request_serializer=securitycenter_service.UpdateBigQueryExportRequest.serialize, + response_deserializer=bigquery_export.BigQueryExport.deserialize, + ) + return self._stubs["update_big_query_export"] + + @property + def list_big_query_exports( + self, + ) -> Callable[ + [securitycenter_service.ListBigQueryExportsRequest], + securitycenter_service.ListBigQueryExportsResponse, + ]: + r"""Return a callable for the list big query exports method over gRPC. + + Lists BigQuery exports. Note that when requesting + BigQuery exports at a given level all exports under that + level are also returned e.g. if requesting BigQuery + exports under a folder, then all BigQuery exports + immediately under the folder plus the ones created under + the projects within the folder are returned. + + Returns: + Callable[[~.ListBigQueryExportsRequest], + ~.ListBigQueryExportsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_big_query_exports" not in self._stubs: + self._stubs["list_big_query_exports"] = self.grpc_channel.unary_unary( + "/google.cloud.securitycenter.v1.SecurityCenter/ListBigQueryExports", + request_serializer=securitycenter_service.ListBigQueryExportsRequest.serialize, + response_deserializer=securitycenter_service.ListBigQueryExportsResponse.deserialize, + ) + return self._stubs["list_big_query_exports"] + def close(self): self.grpc_channel.close() diff --git a/google/cloud/securitycenter_v1/services/security_center/transports/grpc_asyncio.py b/google/cloud/securitycenter_v1/services/security_center/transports/grpc_asyncio.py index 54362ecf..be50aa5c 100644 --- a/google/cloud/securitycenter_v1/services/security_center/transports/grpc_asyncio.py +++ b/google/cloud/securitycenter_v1/services/security_center/transports/grpc_asyncio.py @@ -25,6 +25,7 @@ import grpc # type: ignore from grpc.experimental import aio # type: ignore +from google.cloud.securitycenter_v1.types import bigquery_export from google.cloud.securitycenter_v1.types import external_system as gcs_external_system from google.cloud.securitycenter_v1.types import finding from google.cloud.securitycenter_v1.types import finding as gcs_finding @@ -472,6 +473,35 @@ def delete_notification_config( ) return self._stubs["delete_notification_config"] + @property + def get_big_query_export( + self, + ) -> Callable[ + [securitycenter_service.GetBigQueryExportRequest], + Awaitable[bigquery_export.BigQueryExport], + ]: + r"""Return a callable for the get big query export method over gRPC. + + Gets a big query export. + + Returns: + Callable[[~.GetBigQueryExportRequest], + Awaitable[~.BigQueryExport]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_big_query_export" not in self._stubs: + self._stubs["get_big_query_export"] = self.grpc_channel.unary_unary( + "/google.cloud.securitycenter.v1.SecurityCenter/GetBigQueryExport", + request_serializer=securitycenter_service.GetBigQueryExportRequest.serialize, + response_deserializer=bigquery_export.BigQueryExport.deserialize, + ) + return self._stubs["get_big_query_export"] + @property def get_iam_policy( self, @@ -1172,6 +1202,126 @@ def update_security_marks( ) return self._stubs["update_security_marks"] + @property + def create_big_query_export( + self, + ) -> Callable[ + [securitycenter_service.CreateBigQueryExportRequest], + Awaitable[bigquery_export.BigQueryExport], + ]: + r"""Return a callable for the create big query export method over gRPC. + + Creates a big query export. + + Returns: + Callable[[~.CreateBigQueryExportRequest], + Awaitable[~.BigQueryExport]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_big_query_export" not in self._stubs: + self._stubs["create_big_query_export"] = self.grpc_channel.unary_unary( + "/google.cloud.securitycenter.v1.SecurityCenter/CreateBigQueryExport", + request_serializer=securitycenter_service.CreateBigQueryExportRequest.serialize, + response_deserializer=bigquery_export.BigQueryExport.deserialize, + ) + return self._stubs["create_big_query_export"] + + @property + def delete_big_query_export( + self, + ) -> Callable[ + [securitycenter_service.DeleteBigQueryExportRequest], Awaitable[empty_pb2.Empty] + ]: + r"""Return a callable for the delete big query export method over gRPC. + + Deletes an existing big query export. + + Returns: + Callable[[~.DeleteBigQueryExportRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_big_query_export" not in self._stubs: + self._stubs["delete_big_query_export"] = self.grpc_channel.unary_unary( + "/google.cloud.securitycenter.v1.SecurityCenter/DeleteBigQueryExport", + request_serializer=securitycenter_service.DeleteBigQueryExportRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs["delete_big_query_export"] + + @property + def update_big_query_export( + self, + ) -> Callable[ + [securitycenter_service.UpdateBigQueryExportRequest], + Awaitable[bigquery_export.BigQueryExport], + ]: + r"""Return a callable for the update big query export method over gRPC. + + Updates a BigQuery export. + + Returns: + Callable[[~.UpdateBigQueryExportRequest], + Awaitable[~.BigQueryExport]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_big_query_export" not in self._stubs: + self._stubs["update_big_query_export"] = self.grpc_channel.unary_unary( + "/google.cloud.securitycenter.v1.SecurityCenter/UpdateBigQueryExport", + request_serializer=securitycenter_service.UpdateBigQueryExportRequest.serialize, + response_deserializer=bigquery_export.BigQueryExport.deserialize, + ) + return self._stubs["update_big_query_export"] + + @property + def list_big_query_exports( + self, + ) -> Callable[ + [securitycenter_service.ListBigQueryExportsRequest], + Awaitable[securitycenter_service.ListBigQueryExportsResponse], + ]: + r"""Return a callable for the list big query exports method over gRPC. + + Lists BigQuery exports. Note that when requesting + BigQuery exports at a given level all exports under that + level are also returned e.g. if requesting BigQuery + exports under a folder, then all BigQuery exports + immediately under the folder plus the ones created under + the projects within the folder are returned. + + Returns: + Callable[[~.ListBigQueryExportsRequest], + Awaitable[~.ListBigQueryExportsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_big_query_exports" not in self._stubs: + self._stubs["list_big_query_exports"] = self.grpc_channel.unary_unary( + "/google.cloud.securitycenter.v1.SecurityCenter/ListBigQueryExports", + request_serializer=securitycenter_service.ListBigQueryExportsRequest.serialize, + response_deserializer=securitycenter_service.ListBigQueryExportsResponse.deserialize, + ) + return self._stubs["list_big_query_exports"] + def close(self): return self.grpc_channel.close() diff --git a/google/cloud/securitycenter_v1/types/__init__.py b/google/cloud/securitycenter_v1/types/__init__.py index c1b9fc3c..aef41173 100644 --- a/google/cloud/securitycenter_v1/types/__init__.py +++ b/google/cloud/securitycenter_v1/types/__init__.py @@ -18,10 +18,12 @@ Geolocation, ) from .asset import Asset +from .bigquery_export import BigQueryExport from .external_system import ExternalSystem from .finding import Finding from .folder import Folder from .indicator import Indicator +from .mitre_attack import MitreAttack from .mute_config import MuteConfig from .notification_config import NotificationConfig from .notification_message import NotificationMessage @@ -32,12 +34,15 @@ from .securitycenter_service import ( BulkMuteFindingsRequest, BulkMuteFindingsResponse, + CreateBigQueryExportRequest, CreateFindingRequest, CreateMuteConfigRequest, CreateNotificationConfigRequest, CreateSourceRequest, + DeleteBigQueryExportRequest, DeleteMuteConfigRequest, DeleteNotificationConfigRequest, + GetBigQueryExportRequest, GetMuteConfigRequest, GetNotificationConfigRequest, GetOrganizationSettingsRequest, @@ -49,6 +54,8 @@ GroupResult, ListAssetsRequest, ListAssetsResponse, + ListBigQueryExportsRequest, + ListBigQueryExportsResponse, ListFindingsRequest, ListFindingsResponse, ListMuteConfigsRequest, @@ -60,6 +67,7 @@ RunAssetDiscoveryRequest, SetFindingStateRequest, SetMuteRequest, + UpdateBigQueryExportRequest, UpdateExternalSystemRequest, UpdateFindingRequest, UpdateMuteConfigRequest, @@ -80,10 +88,12 @@ "Access", "Geolocation", "Asset", + "BigQueryExport", "ExternalSystem", "Finding", "Folder", "Indicator", + "MitreAttack", "MuteConfig", "NotificationConfig", "NotificationMessage", @@ -93,12 +103,15 @@ "SecurityMarks", "BulkMuteFindingsRequest", "BulkMuteFindingsResponse", + "CreateBigQueryExportRequest", "CreateFindingRequest", "CreateMuteConfigRequest", "CreateNotificationConfigRequest", "CreateSourceRequest", + "DeleteBigQueryExportRequest", "DeleteMuteConfigRequest", "DeleteNotificationConfigRequest", + "GetBigQueryExportRequest", "GetMuteConfigRequest", "GetNotificationConfigRequest", "GetOrganizationSettingsRequest", @@ -110,6 +123,8 @@ "GroupResult", "ListAssetsRequest", "ListAssetsResponse", + "ListBigQueryExportsRequest", + "ListBigQueryExportsResponse", "ListFindingsRequest", "ListFindingsResponse", "ListMuteConfigsRequest", @@ -121,6 +136,7 @@ "RunAssetDiscoveryRequest", "SetFindingStateRequest", "SetMuteRequest", + "UpdateBigQueryExportRequest", "UpdateExternalSystemRequest", "UpdateFindingRequest", "UpdateMuteConfigRequest", diff --git a/google/cloud/securitycenter_v1/types/bigquery_export.py b/google/cloud/securitycenter_v1/types/bigquery_export.py new file mode 100644 index 00000000..877a6336 --- /dev/null +++ b/google/cloud/securitycenter_v1/types/bigquery_export.py @@ -0,0 +1,102 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + +from google.protobuf import timestamp_pb2 # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.securitycenter.v1", manifest={"BigQueryExport",}, +) + + +class BigQueryExport(proto.Message): + r"""Configures how to deliver Findings to BigQuery Instance. + + Attributes: + name (str): + The relative resource name of this export. See: + https://cloud.google.com/apis/design/resource_names#relative_resource_name. + Example format: + "organizations/{organization_id}/bigQueryExports/{export_id}" + Example format: + "folders/{folder_id}/bigQueryExports/{export_id}" Example + format: "projects/{project_id}/bigQueryExports/{export_id}" + This field is provided in responses, and is ignored when + provided in create requests. + description (str): + The description of the export (max of 1024 + characters). + filter (str): + Expression that defines the filter to apply across + create/update events of findings. The expression is a list + of zero or more restrictions combined via logical operators + ``AND`` and ``OR``. Parentheses are supported, and ``OR`` + has higher precedence than ``AND``. + + Restrictions have the form `` `` + and may have a ``-`` character in front of them to indicate + negation. The fields map to those defined in the + corresponding resource. + + The supported operators are: + + - ``=`` for all value types. + - ``>``, ``<``, ``>=``, ``<=`` for integer values. + - ``:``, meaning substring matching, for strings. + + The supported value types are: + + - string literals in quotes. + - integer literals without quotes. + - boolean literals ``true`` and ``false`` without quotes. + dataset (str): + The dataset to write findings' updates to. Its format is + "projects/[project_id]/datasets/[bigquery_dataset_id]". + BigQuery Dataset unique ID must contain only letters (a-z, + A-Z), numbers (0-9), or underscores (_). + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which the big query + export was created. This field is set by the + server and will be ignored if provided on export + on creation. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The most recent time at which + the big export was updated. This field is set by + the server and will be ignored if provided on + export creation or update. + most_recent_editor (str): + Output only. Email address of the user who + last edited the big query export. This field is + set by the server and will be ignored if + provided on export creation or update. + principal (str): + Output only. The service account that needs + permission to create table, upload data to the + big query dataset. + """ + + name = proto.Field(proto.STRING, number=1,) + description = proto.Field(proto.STRING, number=2,) + filter = proto.Field(proto.STRING, number=3,) + dataset = proto.Field(proto.STRING, number=4,) + create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) + update_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) + most_recent_editor = proto.Field(proto.STRING, number=7,) + principal = proto.Field(proto.STRING, number=8,) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/securitycenter_v1/types/finding.py b/google/cloud/securitycenter_v1/types/finding.py index 3e6dc1c4..7b391db5 100644 --- a/google/cloud/securitycenter_v1/types/finding.py +++ b/google/cloud/securitycenter_v1/types/finding.py @@ -18,6 +18,7 @@ from google.cloud.securitycenter_v1.types import access as gcs_access from google.cloud.securitycenter_v1.types import external_system from google.cloud.securitycenter_v1.types import indicator as gcs_indicator +from google.cloud.securitycenter_v1.types import mitre_attack as gcs_mitre_attack from google.cloud.securitycenter_v1.types import security_marks as gcs_security_marks from google.cloud.securitycenter_v1.types import vulnerability as gcs_vulnerability from google.protobuf import struct_pb2 # type: ignore @@ -129,6 +130,9 @@ class Finding(proto.Message): Output only. Third party SIEM/SOAR fields within SCC, contains external system information and external system finding fields. + mitre_attack (google.cloud.securitycenter_v1.types.MitreAttack): + MITRE ATT&CK tactics and techniques related + to this finding. See: https://attack.mitre.org access (google.cloud.securitycenter_v1.types.Access): Access details associated to the Finding, such as more information on the caller, which @@ -169,6 +173,7 @@ class FindingClass(proto.Enum): VULNERABILITY = 2 MISCONFIGURATION = 3 OBSERVATION = 4 + SCC_ERROR = 5 name = proto.Field(proto.STRING, number=1,) parent = proto.Field(proto.STRING, number=2,) @@ -200,6 +205,9 @@ class FindingClass(proto.Enum): external_systems = proto.MapField( proto.STRING, proto.MESSAGE, number=22, message=external_system.ExternalSystem, ) + mitre_attack = proto.Field( + proto.MESSAGE, number=25, message=gcs_mitre_attack.MitreAttack, + ) access = proto.Field(proto.MESSAGE, number=26, message=gcs_access.Access,) mute_initiator = proto.Field(proto.STRING, number=28,) diff --git a/google/cloud/securitycenter_v1/types/mitre_attack.py b/google/cloud/securitycenter_v1/types/mitre_attack.py new file mode 100644 index 00000000..8c122b79 --- /dev/null +++ b/google/cloud/securitycenter_v1/types/mitre_attack.py @@ -0,0 +1,114 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.securitycenter.v1", manifest={"MitreAttack",}, +) + + +class MitreAttack(proto.Message): + r"""MITRE ATT&CK tactics and techniques related to this finding. + See: https://attack.mitre.org + + Attributes: + primary_tactic (google.cloud.securitycenter_v1.types.MitreAttack.Tactic): + The MITRE ATT&CK tactic most closely + represented by this finding, if any. + primary_techniques (Sequence[google.cloud.securitycenter_v1.types.MitreAttack.Technique]): + The MITRE ATT&CK technique most closely represented by this + finding, if any. primary_techniques is a repeated field + because there are multiple levels of MITRE ATT&CK + techniques. If the technique most closely represented by + this finding is a sub-technique (e.g. + ``SCANNING_IP_BLOCKS``), both the sub-technique and its + parent technique(s) will be listed (e.g. + ``SCANNING_IP_BLOCKS``, ``ACTIVE_SCANNING``). + additional_tactics (Sequence[google.cloud.securitycenter_v1.types.MitreAttack.Tactic]): + Additional MITRE ATT&CK tactics related to + this finding, if any. + additional_techniques (Sequence[google.cloud.securitycenter_v1.types.MitreAttack.Technique]): + Additional MITRE ATT&CK techniques related to + this finding, if any, along with any of their + respective parent techniques. + version (str): + The MITRE ATT&CK version referenced by the + above fields. E.g. "8". + """ + + class Tactic(proto.Enum): + r"""MITRE ATT&CK tactics that can be referenced by SCC findings. + See: https://attack.mitre.org/tactics/enterprise/ + """ + TACTIC_UNSPECIFIED = 0 + RECONNAISSANCE = 1 + RESOURCE_DEVELOPMENT = 2 + INITIAL_ACCESS = 5 + EXECUTION = 3 + PERSISTENCE = 6 + PRIVILEGE_ESCALATION = 8 + DEFENSE_EVASION = 7 + CREDENTIAL_ACCESS = 9 + DISCOVERY = 10 + LATERAL_MOVEMENT = 11 + COLLECTION = 12 + COMMAND_AND_CONTROL = 4 + EXFILTRATION = 13 + IMPACT = 14 + + class Technique(proto.Enum): + r"""MITRE ATT&CK techniques that can be referenced by SCC + findings. See: https://attack.mitre.org/techniques/enterprise/ + """ + TECHNIQUE_UNSPECIFIED = 0 + ACTIVE_SCANNING = 1 + SCANNING_IP_BLOCKS = 2 + INGRESS_TOOL_TRANSFER = 3 + NATIVE_API = 4 + SHARED_MODULES = 5 + COMMAND_AND_SCRIPTING_INTERPRETER = 6 + UNIX_SHELL = 7 + RESOURCE_HIJACKING = 8 + PROXY = 9 + EXTERNAL_PROXY = 10 + MULTI_HOP_PROXY = 11 + DYNAMIC_RESOLUTION = 12 + UNSECURED_CREDENTIALS = 13 + VALID_ACCOUNTS = 14 + LOCAL_ACCOUNTS = 15 + CLOUD_ACCOUNTS = 16 + NETWORK_DENIAL_OF_SERVICE = 17 + PERMISSION_GROUPS_DISCOVERY = 18 + CLOUD_GROUPS = 19 + EXFILTRATION_OVER_WEB_SERVICE = 20 + EXFILTRATION_TO_CLOUD_STORAGE = 21 + ACCOUNT_MANIPULATION = 22 + SSH_AUTHORIZED_KEYS = 23 + CREATE_OR_MODIFY_SYSTEM_PROCESS = 24 + STEAL_WEB_SESSION_COOKIE = 25 + MODIFY_CLOUD_COMPUTE_INFRASTRUCTURE = 26 + EXPLOIT_PUBLIC_FACING_APPLICATION = 27 + MODIFY_AUTHENTICATION_PROCESS = 28 + + primary_tactic = proto.Field(proto.ENUM, number=1, enum=Tactic,) + primary_techniques = proto.RepeatedField(proto.ENUM, number=2, enum=Technique,) + additional_tactics = proto.RepeatedField(proto.ENUM, number=3, enum=Tactic,) + additional_techniques = proto.RepeatedField(proto.ENUM, number=4, enum=Technique,) + version = proto.Field(proto.STRING, number=5,) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/securitycenter_v1/types/securitycenter_service.py b/google/cloud/securitycenter_v1/types/securitycenter_service.py index 975366a2..88ebf3be 100644 --- a/google/cloud/securitycenter_v1/types/securitycenter_service.py +++ b/google/cloud/securitycenter_v1/types/securitycenter_service.py @@ -16,6 +16,7 @@ import proto # type: ignore from google.cloud.securitycenter_v1.types import asset as gcs_asset +from google.cloud.securitycenter_v1.types import bigquery_export from google.cloud.securitycenter_v1.types import external_system as gcs_external_system from google.cloud.securitycenter_v1.types import finding as gcs_finding from google.cloud.securitycenter_v1.types import folder @@ -45,6 +46,7 @@ "CreateSourceRequest", "DeleteMuteConfigRequest", "DeleteNotificationConfigRequest", + "GetBigQueryExportRequest", "GetMuteConfigRequest", "GetNotificationConfigRequest", "GetOrganizationSettingsRequest", @@ -74,6 +76,11 @@ "UpdateOrganizationSettingsRequest", "UpdateSourceRequest", "UpdateSecurityMarksRequest", + "CreateBigQueryExportRequest", + "UpdateBigQueryExportRequest", + "ListBigQueryExportsRequest", + "ListBigQueryExportsResponse", + "DeleteBigQueryExportRequest", }, ) @@ -252,6 +259,21 @@ class DeleteNotificationConfigRequest(proto.Message): name = proto.Field(proto.STRING, number=1,) +class GetBigQueryExportRequest(proto.Message): + r"""Request message for retrieving a big query export. + + Attributes: + name (str): + Required. Name of the big query export to retrieve. Its + format is + organizations/{organization}/bigQueryExports/{export_id}, + folders/{folder}/bigQueryExports/{export_id}, or + projects/{project}/bigQueryExports/{export_id} + """ + + name = proto.Field(proto.STRING, number=1,) + + class GetMuteConfigRequest(proto.Message): r"""Request message for retrieving a mute config. @@ -1596,4 +1618,113 @@ class UpdateSecurityMarksRequest(proto.Message): start_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) +class CreateBigQueryExportRequest(proto.Message): + r"""Request message for creating a big query export. + + Attributes: + parent (str): + Required. Resource name of the new big query export's + parent. Its format is "organizations/[organization_id]", + "folders/[folder_id]", or "projects/[project_id]". + big_query_export (google.cloud.securitycenter_v1.types.BigQueryExport): + Required. The big query export being created. + big_query_export_id (str): + Required. Unique identifier provided by the + client within the parent scope. It must consist + of lower case letters, numbers, and hyphen, with + the first character a letter, the last a letter + or a number, and a 63 character maximum. + """ + + parent = proto.Field(proto.STRING, number=1,) + big_query_export = proto.Field( + proto.MESSAGE, number=2, message=bigquery_export.BigQueryExport, + ) + big_query_export_id = proto.Field(proto.STRING, number=3,) + + +class UpdateBigQueryExportRequest(proto.Message): + r"""Request message for updating a BigQuery export. + + Attributes: + big_query_export (google.cloud.securitycenter_v1.types.BigQueryExport): + Required. The BigQuery export being updated. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + The list of fields to be updated. + If empty all mutable fields will be updated. + """ + + big_query_export = proto.Field( + proto.MESSAGE, number=1, message=bigquery_export.BigQueryExport, + ) + update_mask = proto.Field( + proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + ) + + +class ListBigQueryExportsRequest(proto.Message): + r"""Request message for listing BigQuery exports at a given + scope e.g. organization, folder or project. + + Attributes: + parent (str): + Required. The parent, which owns the collection of BigQuery + exports. Its format is "organizations/[organization_id]", + "folders/[folder_id]", "projects/[project_id]". + page_size (int): + The maximum number of configs to return. The + service may return fewer than this value. + If unspecified, at most 10 configs will be + returned. The maximum value is 1000; values + above 1000 will be coerced to 1000. + page_token (str): + A page token, received from a previous + ``ListBigQueryExports`` call. Provide this to retrieve the + subsequent page. When paginating, all other parameters + provided to ``ListBigQueryExports`` must match the call that + provided the page token. + """ + + parent = proto.Field(proto.STRING, number=1,) + page_size = proto.Field(proto.INT32, number=2,) + page_token = proto.Field(proto.STRING, number=3,) + + +class ListBigQueryExportsResponse(proto.Message): + r"""Response message for listing BigQuery exports. + + Attributes: + big_query_exports (Sequence[google.cloud.securitycenter_v1.types.BigQueryExport]): + The BigQuery exports from the specified + parent. + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + """ + + @property + def raw_page(self): + return self + + big_query_exports = proto.RepeatedField( + proto.MESSAGE, number=1, message=bigquery_export.BigQueryExport, + ) + next_page_token = proto.Field(proto.STRING, number=2,) + + +class DeleteBigQueryExportRequest(proto.Message): + r"""Request message for deleting a big query export. + + Attributes: + name (str): + Required. Name of the big query export to delete. Its format + is organizations/{organization}/bigQueryExports/{export_id}, + folders/{folder}/bigQueryExports/{export_id}, or + projects/{project}/bigQueryExports/{export_id} + """ + + name = proto.Field(proto.STRING, number=1,) + + __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/securitycenter_v1/types/vulnerability.py b/google/cloud/securitycenter_v1/types/vulnerability.py index 9c8ddae7..b0bd13f2 100644 --- a/google/cloud/securitycenter_v1/types/vulnerability.py +++ b/google/cloud/securitycenter_v1/types/vulnerability.py @@ -51,11 +51,15 @@ class Cve(proto.Message): Describe Common Vulnerability Scoring System specified at https://www.first.org/cvss/v3.1/specification-document + upstream_fix_available (bool): + Whether upstream fix is available for the + CVE. """ id = proto.Field(proto.STRING, number=1,) references = proto.RepeatedField(proto.MESSAGE, number=2, message="Reference",) cvssv3 = proto.Field(proto.MESSAGE, number=3, message="Cvssv3",) + upstream_fix_available = proto.Field(proto.BOOL, number=4,) class Reference(proto.Message): diff --git a/samples/generated_samples/securitycenter_v1_generated_security_center_create_big_query_export_async.py b/samples/generated_samples/securitycenter_v1_generated_security_center_create_big_query_export_async.py new file mode 100644 index 00000000..7d2e4920 --- /dev/null +++ b/samples/generated_samples/securitycenter_v1_generated_security_center_create_big_query_export_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateBigQueryExport +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-securitycenter + + +# [START securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_async] +from google.cloud import securitycenter_v1 + + +async def sample_create_big_query_export(): + # Create a client + client = securitycenter_v1.SecurityCenterAsyncClient() + + # Initialize request argument(s) + request = securitycenter_v1.CreateBigQueryExportRequest( + parent="parent_value", + big_query_export_id="big_query_export_id_value", + ) + + # Make the request + response = await client.create_big_query_export(request=request) + + # Handle the response + print(response) + +# [END securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_async] diff --git a/samples/generated_samples/securitycenter_v1_generated_security_center_create_big_query_export_sync.py b/samples/generated_samples/securitycenter_v1_generated_security_center_create_big_query_export_sync.py new file mode 100644 index 00000000..997c41b6 --- /dev/null +++ b/samples/generated_samples/securitycenter_v1_generated_security_center_create_big_query_export_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateBigQueryExport +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-securitycenter + + +# [START securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_sync] +from google.cloud import securitycenter_v1 + + +def sample_create_big_query_export(): + # Create a client + client = securitycenter_v1.SecurityCenterClient() + + # Initialize request argument(s) + request = securitycenter_v1.CreateBigQueryExportRequest( + parent="parent_value", + big_query_export_id="big_query_export_id_value", + ) + + # Make the request + response = client.create_big_query_export(request=request) + + # Handle the response + print(response) + +# [END securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_sync] diff --git a/samples/generated_samples/securitycenter_v1_generated_security_center_delete_big_query_export_async.py b/samples/generated_samples/securitycenter_v1_generated_security_center_delete_big_query_export_async.py new file mode 100644 index 00000000..abf60e2d --- /dev/null +++ b/samples/generated_samples/securitycenter_v1_generated_security_center_delete_big_query_export_async.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteBigQueryExport +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-securitycenter + + +# [START securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_async] +from google.cloud import securitycenter_v1 + + +async def sample_delete_big_query_export(): + # Create a client + client = securitycenter_v1.SecurityCenterAsyncClient() + + # Initialize request argument(s) + request = securitycenter_v1.DeleteBigQueryExportRequest( + name="name_value", + ) + + # Make the request + await client.delete_big_query_export(request=request) + + +# [END securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_async] diff --git a/samples/generated_samples/securitycenter_v1_generated_security_center_delete_big_query_export_sync.py b/samples/generated_samples/securitycenter_v1_generated_security_center_delete_big_query_export_sync.py new file mode 100644 index 00000000..692e2f80 --- /dev/null +++ b/samples/generated_samples/securitycenter_v1_generated_security_center_delete_big_query_export_sync.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteBigQueryExport +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-securitycenter + + +# [START securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_sync] +from google.cloud import securitycenter_v1 + + +def sample_delete_big_query_export(): + # Create a client + client = securitycenter_v1.SecurityCenterClient() + + # Initialize request argument(s) + request = securitycenter_v1.DeleteBigQueryExportRequest( + name="name_value", + ) + + # Make the request + client.delete_big_query_export(request=request) + + +# [END securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_sync] diff --git a/samples/generated_samples/securitycenter_v1_generated_security_center_get_big_query_export_async.py b/samples/generated_samples/securitycenter_v1_generated_security_center_get_big_query_export_async.py new file mode 100644 index 00000000..76e4e4b2 --- /dev/null +++ b/samples/generated_samples/securitycenter_v1_generated_security_center_get_big_query_export_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetBigQueryExport +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-securitycenter + + +# [START securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_async] +from google.cloud import securitycenter_v1 + + +async def sample_get_big_query_export(): + # Create a client + client = securitycenter_v1.SecurityCenterAsyncClient() + + # Initialize request argument(s) + request = securitycenter_v1.GetBigQueryExportRequest( + name="name_value", + ) + + # Make the request + response = await client.get_big_query_export(request=request) + + # Handle the response + print(response) + +# [END securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_async] diff --git a/samples/generated_samples/securitycenter_v1_generated_security_center_get_big_query_export_sync.py b/samples/generated_samples/securitycenter_v1_generated_security_center_get_big_query_export_sync.py new file mode 100644 index 00000000..7f017b17 --- /dev/null +++ b/samples/generated_samples/securitycenter_v1_generated_security_center_get_big_query_export_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetBigQueryExport +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-securitycenter + + +# [START securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_sync] +from google.cloud import securitycenter_v1 + + +def sample_get_big_query_export(): + # Create a client + client = securitycenter_v1.SecurityCenterClient() + + # Initialize request argument(s) + request = securitycenter_v1.GetBigQueryExportRequest( + name="name_value", + ) + + # Make the request + response = client.get_big_query_export(request=request) + + # Handle the response + print(response) + +# [END securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_sync] diff --git a/samples/generated_samples/securitycenter_v1_generated_security_center_list_big_query_exports_async.py b/samples/generated_samples/securitycenter_v1_generated_security_center_list_big_query_exports_async.py new file mode 100644 index 00000000..1bcaa567 --- /dev/null +++ b/samples/generated_samples/securitycenter_v1_generated_security_center_list_big_query_exports_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListBigQueryExports +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-securitycenter + + +# [START securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_async] +from google.cloud import securitycenter_v1 + + +async def sample_list_big_query_exports(): + # Create a client + client = securitycenter_v1.SecurityCenterAsyncClient() + + # Initialize request argument(s) + request = securitycenter_v1.ListBigQueryExportsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_big_query_exports(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_async] diff --git a/samples/generated_samples/securitycenter_v1_generated_security_center_list_big_query_exports_sync.py b/samples/generated_samples/securitycenter_v1_generated_security_center_list_big_query_exports_sync.py new file mode 100644 index 00000000..4217a3c4 --- /dev/null +++ b/samples/generated_samples/securitycenter_v1_generated_security_center_list_big_query_exports_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListBigQueryExports +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-securitycenter + + +# [START securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_sync] +from google.cloud import securitycenter_v1 + + +def sample_list_big_query_exports(): + # Create a client + client = securitycenter_v1.SecurityCenterClient() + + # Initialize request argument(s) + request = securitycenter_v1.ListBigQueryExportsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_big_query_exports(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_sync] diff --git a/samples/generated_samples/securitycenter_v1_generated_security_center_update_big_query_export_async.py b/samples/generated_samples/securitycenter_v1_generated_security_center_update_big_query_export_async.py new file mode 100644 index 00000000..232cef63 --- /dev/null +++ b/samples/generated_samples/securitycenter_v1_generated_security_center_update_big_query_export_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateBigQueryExport +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-securitycenter + + +# [START securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_async] +from google.cloud import securitycenter_v1 + + +async def sample_update_big_query_export(): + # Create a client + client = securitycenter_v1.SecurityCenterAsyncClient() + + # Initialize request argument(s) + request = securitycenter_v1.UpdateBigQueryExportRequest( + ) + + # Make the request + response = await client.update_big_query_export(request=request) + + # Handle the response + print(response) + +# [END securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_async] diff --git a/samples/generated_samples/securitycenter_v1_generated_security_center_update_big_query_export_sync.py b/samples/generated_samples/securitycenter_v1_generated_security_center_update_big_query_export_sync.py new file mode 100644 index 00000000..2f66d776 --- /dev/null +++ b/samples/generated_samples/securitycenter_v1_generated_security_center_update_big_query_export_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateBigQueryExport +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-securitycenter + + +# [START securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_sync] +from google.cloud import securitycenter_v1 + + +def sample_update_big_query_export(): + # Create a client + client = securitycenter_v1.SecurityCenterClient() + + # Initialize request argument(s) + request = securitycenter_v1.UpdateBigQueryExportRequest( + ) + + # Make the request + response = client.update_big_query_export(request=request) + + # Handle the response + print(response) + +# [END securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_sync] diff --git a/samples/generated_samples/snippet_metadata_securitycenter_v1.json b/samples/generated_samples/snippet_metadata_securitycenter_v1.json index 18e39cc1..e5b4f65b 100644 --- a/samples/generated_samples/snippet_metadata_securitycenter_v1.json +++ b/samples/generated_samples/snippet_metadata_securitycenter_v1.json @@ -89,6 +89,95 @@ } ] }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "SecurityCenter" + }, + "shortName": "CreateBigQueryExport" + } + }, + "file": "securitycenter_v1_generated_security_center_create_big_query_export_async.py", + "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "SecurityCenter" + }, + "shortName": "CreateBigQueryExport" + } + }, + "file": "securitycenter_v1_generated_security_center_create_big_query_export_sync.py", + "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, { "clientMethod": { "async": true, @@ -445,6 +534,91 @@ } ] }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "SecurityCenter" + }, + "shortName": "DeleteBigQueryExport" + } + }, + "file": "securitycenter_v1_generated_security_center_delete_big_query_export_async.py", + "regionTag": "securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_async", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "SecurityCenter" + }, + "shortName": "DeleteBigQueryExport" + } + }, + "file": "securitycenter_v1_generated_security_center_delete_big_query_export_sync.py", + "regionTag": "securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_sync", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, { "clientMethod": { "async": true, @@ -615,6 +789,95 @@ } ] }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "SecurityCenter" + }, + "shortName": "GetBigQueryExport" + } + }, + "file": "securitycenter_v1_generated_security_center_get_big_query_export_async.py", + "regionTag": "securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "SecurityCenter" + }, + "shortName": "GetBigQueryExport" + } + }, + "file": "securitycenter_v1_generated_security_center_get_big_query_export_sync.py", + "regionTag": "securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, { "clientMethod": { "async": true, @@ -1327,6 +1590,95 @@ } ] }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "SecurityCenter" + }, + "shortName": "ListBigQueryExports" + } + }, + "file": "securitycenter_v1_generated_security_center_list_big_query_exports_async.py", + "regionTag": "securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "SecurityCenter" + }, + "shortName": "ListBigQueryExports" + } + }, + "file": "securitycenter_v1_generated_security_center_list_big_query_exports_sync.py", + "regionTag": "securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, { "clientMethod": { "async": true, @@ -2128,6 +2480,95 @@ } ] }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "SecurityCenter" + }, + "shortName": "UpdateBigQueryExport" + } + }, + "file": "securitycenter_v1_generated_security_center_update_big_query_export_async.py", + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "SecurityCenter" + }, + "shortName": "UpdateBigQueryExport" + } + }, + "file": "securitycenter_v1_generated_security_center_update_big_query_export_sync.py", + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, { "clientMethod": { "async": true, diff --git a/scripts/fixup_securitycenter_v1_keywords.py b/scripts/fixup_securitycenter_v1_keywords.py index 009caf04..7af84884 100644 --- a/scripts/fixup_securitycenter_v1_keywords.py +++ b/scripts/fixup_securitycenter_v1_keywords.py @@ -40,12 +40,15 @@ class securitycenterCallTransformer(cst.CSTTransformer): CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { 'bulk_mute_findings': ('parent', 'filter', 'mute_annotation', ), + 'create_big_query_export': ('parent', 'big_query_export', 'big_query_export_id', ), 'create_finding': ('parent', 'finding_id', 'finding', ), 'create_mute_config': ('parent', 'mute_config', 'mute_config_id', ), 'create_notification_config': ('parent', 'config_id', 'notification_config', ), 'create_source': ('parent', 'source', ), + 'delete_big_query_export': ('name', ), 'delete_mute_config': ('name', ), 'delete_notification_config': ('name', ), + 'get_big_query_export': ('name', ), 'get_iam_policy': ('resource', 'options', ), 'get_mute_config': ('name', ), 'get_notification_config': ('name', ), @@ -54,6 +57,7 @@ class securitycenterCallTransformer(cst.CSTTransformer): 'group_assets': ('parent', 'group_by', 'filter', 'compare_duration', 'read_time', 'page_token', 'page_size', ), 'group_findings': ('parent', 'group_by', 'filter', 'read_time', 'compare_duration', 'page_token', 'page_size', ), 'list_assets': ('parent', 'filter', 'order_by', 'read_time', 'compare_duration', 'field_mask', 'page_token', 'page_size', ), + 'list_big_query_exports': ('parent', 'page_size', 'page_token', ), 'list_findings': ('parent', 'filter', 'order_by', 'read_time', 'compare_duration', 'field_mask', 'page_token', 'page_size', ), 'list_mute_configs': ('parent', 'page_size', 'page_token', ), 'list_notification_configs': ('parent', 'page_token', 'page_size', ), @@ -63,6 +67,7 @@ class securitycenterCallTransformer(cst.CSTTransformer): 'set_iam_policy': ('resource', 'policy', ), 'set_mute': ('name', 'mute', ), 'test_iam_permissions': ('resource', 'permissions', ), + 'update_big_query_export': ('big_query_export', 'update_mask', ), 'update_external_system': ('external_system', 'update_mask', ), 'update_finding': ('finding', 'update_mask', ), 'update_mute_config': ('mute_config', 'update_mask', ), diff --git a/tests/unit/gapic/securitycenter_v1/test_security_center.py b/tests/unit/gapic/securitycenter_v1/test_security_center.py index 0d9ddccb..855c92c1 100644 --- a/tests/unit/gapic/securitycenter_v1/test_security_center.py +++ b/tests/unit/gapic/securitycenter_v1/test_security_center.py @@ -42,11 +42,13 @@ from google.cloud.securitycenter_v1.services.security_center import pagers from google.cloud.securitycenter_v1.services.security_center import transports from google.cloud.securitycenter_v1.types import access +from google.cloud.securitycenter_v1.types import bigquery_export from google.cloud.securitycenter_v1.types import external_system from google.cloud.securitycenter_v1.types import external_system as gcs_external_system from google.cloud.securitycenter_v1.types import finding from google.cloud.securitycenter_v1.types import finding as gcs_finding from google.cloud.securitycenter_v1.types import indicator +from google.cloud.securitycenter_v1.types import mitre_attack from google.cloud.securitycenter_v1.types import mute_config from google.cloud.securitycenter_v1.types import mute_config as gcs_mute_config from google.cloud.securitycenter_v1.types import notification_config @@ -2339,6 +2341,248 @@ async def test_delete_notification_config_flattened_error_async(): ) +@pytest.mark.parametrize( + "request_type", [securitycenter_service.GetBigQueryExportRequest, dict,] +) +def test_get_big_query_export(request_type, transport: str = "grpc"): + client = SecurityCenterClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_big_query_export), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = bigquery_export.BigQueryExport( + name="name_value", + description="description_value", + filter="filter_value", + dataset="dataset_value", + most_recent_editor="most_recent_editor_value", + principal="principal_value", + ) + response = client.get_big_query_export(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == securitycenter_service.GetBigQueryExportRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, bigquery_export.BigQueryExport) + assert response.name == "name_value" + assert response.description == "description_value" + assert response.filter == "filter_value" + assert response.dataset == "dataset_value" + assert response.most_recent_editor == "most_recent_editor_value" + assert response.principal == "principal_value" + + +def test_get_big_query_export_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = SecurityCenterClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_big_query_export), "__call__" + ) as call: + client.get_big_query_export() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == securitycenter_service.GetBigQueryExportRequest() + + +@pytest.mark.asyncio +async def test_get_big_query_export_async( + transport: str = "grpc_asyncio", + request_type=securitycenter_service.GetBigQueryExportRequest, +): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_big_query_export), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + bigquery_export.BigQueryExport( + name="name_value", + description="description_value", + filter="filter_value", + dataset="dataset_value", + most_recent_editor="most_recent_editor_value", + principal="principal_value", + ) + ) + response = await client.get_big_query_export(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == securitycenter_service.GetBigQueryExportRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, bigquery_export.BigQueryExport) + assert response.name == "name_value" + assert response.description == "description_value" + assert response.filter == "filter_value" + assert response.dataset == "dataset_value" + assert response.most_recent_editor == "most_recent_editor_value" + assert response.principal == "principal_value" + + +@pytest.mark.asyncio +async def test_get_big_query_export_async_from_dict(): + await test_get_big_query_export_async(request_type=dict) + + +def test_get_big_query_export_field_headers(): + client = SecurityCenterClient(credentials=ga_credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = securitycenter_service.GetBigQueryExportRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_big_query_export), "__call__" + ) as call: + call.return_value = bigquery_export.BigQueryExport() + client.get_big_query_export(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_get_big_query_export_field_headers_async(): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = securitycenter_service.GetBigQueryExportRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_big_query_export), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + bigquery_export.BigQueryExport() + ) + await client.get_big_query_export(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_get_big_query_export_flattened(): + client = SecurityCenterClient(credentials=ga_credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_big_query_export), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = bigquery_export.BigQueryExport() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_big_query_export(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +def test_get_big_query_export_flattened_error(): + client = SecurityCenterClient(credentials=ga_credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_big_query_export( + securitycenter_service.GetBigQueryExportRequest(), name="name_value", + ) + + +@pytest.mark.asyncio +async def test_get_big_query_export_flattened_async(): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_big_query_export), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = bigquery_export.BigQueryExport() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + bigquery_export.BigQueryExport() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_big_query_export(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_get_big_query_export_flattened_error_async(): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_big_query_export( + securitycenter_service.GetBigQueryExportRequest(), name="name_value", + ) + + @pytest.mark.parametrize("request_type", [iam_policy_pb2.GetIamPolicyRequest, dict,]) def test_get_iam_policy(request_type, transport: str = "grpc"): client = SecurityCenterClient( @@ -8867,51 +9111,1189 @@ async def test_update_security_marks_flattened_error_async(): ) -def test_credentials_transport_error(): - # It is an error to provide credentials and a transport instance. - transport = transports.SecurityCenterGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), +@pytest.mark.parametrize( + "request_type", [securitycenter_service.CreateBigQueryExportRequest, dict,] +) +def test_create_big_query_export(request_type, transport: str = "grpc"): + client = SecurityCenterClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) - with pytest.raises(ValueError): - client = SecurityCenterClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - # It is an error to provide a credentials file and a transport instance. - transport = transports.SecurityCenterGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = SecurityCenterClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_big_query_export), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = bigquery_export.BigQueryExport( + name="name_value", + description="description_value", + filter="filter_value", + dataset="dataset_value", + most_recent_editor="most_recent_editor_value", + principal="principal_value", ) + response = client.create_big_query_export(request) - # It is an error to provide an api_key and a transport instance. - transport = transports.SecurityCenterGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = SecurityCenterClient(client_options=options, transport=transport,) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == securitycenter_service.CreateBigQueryExportRequest() - # It is an error to provide an api_key and a credential. - options = mock.Mock() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = SecurityCenterClient( - client_options=options, credentials=ga_credentials.AnonymousCredentials() - ) + # Establish that the response is the type that we expect. + assert isinstance(response, bigquery_export.BigQueryExport) + assert response.name == "name_value" + assert response.description == "description_value" + assert response.filter == "filter_value" + assert response.dataset == "dataset_value" + assert response.most_recent_editor == "most_recent_editor_value" + assert response.principal == "principal_value" - # It is an error to provide scopes and a transport instance. - transport = transports.SecurityCenterGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), + +def test_create_big_query_export_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = SecurityCenterClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) - with pytest.raises(ValueError): - client = SecurityCenterClient( - client_options={"scopes": ["1", "2"]}, transport=transport, - ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_big_query_export), "__call__" + ) as call: + client.create_big_query_export() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == securitycenter_service.CreateBigQueryExportRequest() + + +@pytest.mark.asyncio +async def test_create_big_query_export_async( + transport: str = "grpc_asyncio", + request_type=securitycenter_service.CreateBigQueryExportRequest, +): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_big_query_export), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + bigquery_export.BigQueryExport( + name="name_value", + description="description_value", + filter="filter_value", + dataset="dataset_value", + most_recent_editor="most_recent_editor_value", + principal="principal_value", + ) + ) + response = await client.create_big_query_export(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == securitycenter_service.CreateBigQueryExportRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, bigquery_export.BigQueryExport) + assert response.name == "name_value" + assert response.description == "description_value" + assert response.filter == "filter_value" + assert response.dataset == "dataset_value" + assert response.most_recent_editor == "most_recent_editor_value" + assert response.principal == "principal_value" + + +@pytest.mark.asyncio +async def test_create_big_query_export_async_from_dict(): + await test_create_big_query_export_async(request_type=dict) + + +def test_create_big_query_export_field_headers(): + client = SecurityCenterClient(credentials=ga_credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = securitycenter_service.CreateBigQueryExportRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_big_query_export), "__call__" + ) as call: + call.return_value = bigquery_export.BigQueryExport() + client.create_big_query_export(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_create_big_query_export_field_headers_async(): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = securitycenter_service.CreateBigQueryExportRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_big_query_export), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + bigquery_export.BigQueryExport() + ) + await client.create_big_query_export(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_create_big_query_export_flattened(): + client = SecurityCenterClient(credentials=ga_credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_big_query_export), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = bigquery_export.BigQueryExport() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_big_query_export( + parent="parent_value", + big_query_export=bigquery_export.BigQueryExport(name="name_value"), + big_query_export_id="big_query_export_id_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].big_query_export + mock_val = bigquery_export.BigQueryExport(name="name_value") + assert arg == mock_val + arg = args[0].big_query_export_id + mock_val = "big_query_export_id_value" + assert arg == mock_val + + +def test_create_big_query_export_flattened_error(): + client = SecurityCenterClient(credentials=ga_credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_big_query_export( + securitycenter_service.CreateBigQueryExportRequest(), + parent="parent_value", + big_query_export=bigquery_export.BigQueryExport(name="name_value"), + big_query_export_id="big_query_export_id_value", + ) + + +@pytest.mark.asyncio +async def test_create_big_query_export_flattened_async(): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_big_query_export), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = bigquery_export.BigQueryExport() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + bigquery_export.BigQueryExport() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_big_query_export( + parent="parent_value", + big_query_export=bigquery_export.BigQueryExport(name="name_value"), + big_query_export_id="big_query_export_id_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].big_query_export + mock_val = bigquery_export.BigQueryExport(name="name_value") + assert arg == mock_val + arg = args[0].big_query_export_id + mock_val = "big_query_export_id_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_create_big_query_export_flattened_error_async(): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_big_query_export( + securitycenter_service.CreateBigQueryExportRequest(), + parent="parent_value", + big_query_export=bigquery_export.BigQueryExport(name="name_value"), + big_query_export_id="big_query_export_id_value", + ) + + +@pytest.mark.parametrize( + "request_type", [securitycenter_service.DeleteBigQueryExportRequest, dict,] +) +def test_delete_big_query_export(request_type, transport: str = "grpc"): + client = SecurityCenterClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_big_query_export), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.delete_big_query_export(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == securitycenter_service.DeleteBigQueryExportRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +def test_delete_big_query_export_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = SecurityCenterClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_big_query_export), "__call__" + ) as call: + client.delete_big_query_export() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == securitycenter_service.DeleteBigQueryExportRequest() + + +@pytest.mark.asyncio +async def test_delete_big_query_export_async( + transport: str = "grpc_asyncio", + request_type=securitycenter_service.DeleteBigQueryExportRequest, +): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_big_query_export), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_big_query_export(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == securitycenter_service.DeleteBigQueryExportRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.asyncio +async def test_delete_big_query_export_async_from_dict(): + await test_delete_big_query_export_async(request_type=dict) + + +def test_delete_big_query_export_field_headers(): + client = SecurityCenterClient(credentials=ga_credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = securitycenter_service.DeleteBigQueryExportRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_big_query_export), "__call__" + ) as call: + call.return_value = None + client.delete_big_query_export(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_delete_big_query_export_field_headers_async(): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = securitycenter_service.DeleteBigQueryExportRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_big_query_export), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_big_query_export(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_delete_big_query_export_flattened(): + client = SecurityCenterClient(credentials=ga_credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_big_query_export), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_big_query_export(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +def test_delete_big_query_export_flattened_error(): + client = SecurityCenterClient(credentials=ga_credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_big_query_export( + securitycenter_service.DeleteBigQueryExportRequest(), name="name_value", + ) + + +@pytest.mark.asyncio +async def test_delete_big_query_export_flattened_async(): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_big_query_export), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_big_query_export(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_delete_big_query_export_flattened_error_async(): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_big_query_export( + securitycenter_service.DeleteBigQueryExportRequest(), name="name_value", + ) + + +@pytest.mark.parametrize( + "request_type", [securitycenter_service.UpdateBigQueryExportRequest, dict,] +) +def test_update_big_query_export(request_type, transport: str = "grpc"): + client = SecurityCenterClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_big_query_export), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = bigquery_export.BigQueryExport( + name="name_value", + description="description_value", + filter="filter_value", + dataset="dataset_value", + most_recent_editor="most_recent_editor_value", + principal="principal_value", + ) + response = client.update_big_query_export(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == securitycenter_service.UpdateBigQueryExportRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, bigquery_export.BigQueryExport) + assert response.name == "name_value" + assert response.description == "description_value" + assert response.filter == "filter_value" + assert response.dataset == "dataset_value" + assert response.most_recent_editor == "most_recent_editor_value" + assert response.principal == "principal_value" + + +def test_update_big_query_export_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = SecurityCenterClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_big_query_export), "__call__" + ) as call: + client.update_big_query_export() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == securitycenter_service.UpdateBigQueryExportRequest() + + +@pytest.mark.asyncio +async def test_update_big_query_export_async( + transport: str = "grpc_asyncio", + request_type=securitycenter_service.UpdateBigQueryExportRequest, +): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_big_query_export), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + bigquery_export.BigQueryExport( + name="name_value", + description="description_value", + filter="filter_value", + dataset="dataset_value", + most_recent_editor="most_recent_editor_value", + principal="principal_value", + ) + ) + response = await client.update_big_query_export(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == securitycenter_service.UpdateBigQueryExportRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, bigquery_export.BigQueryExport) + assert response.name == "name_value" + assert response.description == "description_value" + assert response.filter == "filter_value" + assert response.dataset == "dataset_value" + assert response.most_recent_editor == "most_recent_editor_value" + assert response.principal == "principal_value" + + +@pytest.mark.asyncio +async def test_update_big_query_export_async_from_dict(): + await test_update_big_query_export_async(request_type=dict) + + +def test_update_big_query_export_field_headers(): + client = SecurityCenterClient(credentials=ga_credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = securitycenter_service.UpdateBigQueryExportRequest() + + request.big_query_export.name = "big_query_export.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_big_query_export), "__call__" + ) as call: + call.return_value = bigquery_export.BigQueryExport() + client.update_big_query_export(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "big_query_export.name=big_query_export.name/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_update_big_query_export_field_headers_async(): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = securitycenter_service.UpdateBigQueryExportRequest() + + request.big_query_export.name = "big_query_export.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_big_query_export), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + bigquery_export.BigQueryExport() + ) + await client.update_big_query_export(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "big_query_export.name=big_query_export.name/value", + ) in kw["metadata"] + + +def test_update_big_query_export_flattened(): + client = SecurityCenterClient(credentials=ga_credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_big_query_export), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = bigquery_export.BigQueryExport() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_big_query_export( + big_query_export=bigquery_export.BigQueryExport(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].big_query_export + mock_val = bigquery_export.BigQueryExport(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val + + +def test_update_big_query_export_flattened_error(): + client = SecurityCenterClient(credentials=ga_credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_big_query_export( + securitycenter_service.UpdateBigQueryExportRequest(), + big_query_export=bigquery_export.BigQueryExport(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +@pytest.mark.asyncio +async def test_update_big_query_export_flattened_async(): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_big_query_export), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = bigquery_export.BigQueryExport() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + bigquery_export.BigQueryExport() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_big_query_export( + big_query_export=bigquery_export.BigQueryExport(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].big_query_export + mock_val = bigquery_export.BigQueryExport(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_update_big_query_export_flattened_error_async(): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_big_query_export( + securitycenter_service.UpdateBigQueryExportRequest(), + big_query_export=bigquery_export.BigQueryExport(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +@pytest.mark.parametrize( + "request_type", [securitycenter_service.ListBigQueryExportsRequest, dict,] +) +def test_list_big_query_exports(request_type, transport: str = "grpc"): + client = SecurityCenterClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_big_query_exports), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = securitycenter_service.ListBigQueryExportsResponse( + next_page_token="next_page_token_value", + ) + response = client.list_big_query_exports(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == securitycenter_service.ListBigQueryExportsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListBigQueryExportsPager) + assert response.next_page_token == "next_page_token_value" + + +def test_list_big_query_exports_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = SecurityCenterClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_big_query_exports), "__call__" + ) as call: + client.list_big_query_exports() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == securitycenter_service.ListBigQueryExportsRequest() + + +@pytest.mark.asyncio +async def test_list_big_query_exports_async( + transport: str = "grpc_asyncio", + request_type=securitycenter_service.ListBigQueryExportsRequest, +): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_big_query_exports), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + securitycenter_service.ListBigQueryExportsResponse( + next_page_token="next_page_token_value", + ) + ) + response = await client.list_big_query_exports(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == securitycenter_service.ListBigQueryExportsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListBigQueryExportsAsyncPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.asyncio +async def test_list_big_query_exports_async_from_dict(): + await test_list_big_query_exports_async(request_type=dict) + + +def test_list_big_query_exports_field_headers(): + client = SecurityCenterClient(credentials=ga_credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = securitycenter_service.ListBigQueryExportsRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_big_query_exports), "__call__" + ) as call: + call.return_value = securitycenter_service.ListBigQueryExportsResponse() + client.list_big_query_exports(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_list_big_query_exports_field_headers_async(): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = securitycenter_service.ListBigQueryExportsRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_big_query_exports), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + securitycenter_service.ListBigQueryExportsResponse() + ) + await client.list_big_query_exports(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_list_big_query_exports_flattened(): + client = SecurityCenterClient(credentials=ga_credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_big_query_exports), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = securitycenter_service.ListBigQueryExportsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_big_query_exports(parent="parent_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + + +def test_list_big_query_exports_flattened_error(): + client = SecurityCenterClient(credentials=ga_credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_big_query_exports( + securitycenter_service.ListBigQueryExportsRequest(), parent="parent_value", + ) + + +@pytest.mark.asyncio +async def test_list_big_query_exports_flattened_async(): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_big_query_exports), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = securitycenter_service.ListBigQueryExportsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + securitycenter_service.ListBigQueryExportsResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_big_query_exports(parent="parent_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_list_big_query_exports_flattened_error_async(): + client = SecurityCenterAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_big_query_exports( + securitycenter_service.ListBigQueryExportsRequest(), parent="parent_value", + ) + + +def test_list_big_query_exports_pager(transport_name: str = "grpc"): + client = SecurityCenterClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_big_query_exports), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + securitycenter_service.ListBigQueryExportsResponse( + big_query_exports=[ + bigquery_export.BigQueryExport(), + bigquery_export.BigQueryExport(), + bigquery_export.BigQueryExport(), + ], + next_page_token="abc", + ), + securitycenter_service.ListBigQueryExportsResponse( + big_query_exports=[], next_page_token="def", + ), + securitycenter_service.ListBigQueryExportsResponse( + big_query_exports=[bigquery_export.BigQueryExport(),], + next_page_token="ghi", + ), + securitycenter_service.ListBigQueryExportsResponse( + big_query_exports=[ + bigquery_export.BigQueryExport(), + bigquery_export.BigQueryExport(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_big_query_exports(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all(isinstance(i, bigquery_export.BigQueryExport) for i in results) + + +def test_list_big_query_exports_pages(transport_name: str = "grpc"): + client = SecurityCenterClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_big_query_exports), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + securitycenter_service.ListBigQueryExportsResponse( + big_query_exports=[ + bigquery_export.BigQueryExport(), + bigquery_export.BigQueryExport(), + bigquery_export.BigQueryExport(), + ], + next_page_token="abc", + ), + securitycenter_service.ListBigQueryExportsResponse( + big_query_exports=[], next_page_token="def", + ), + securitycenter_service.ListBigQueryExportsResponse( + big_query_exports=[bigquery_export.BigQueryExport(),], + next_page_token="ghi", + ), + securitycenter_service.ListBigQueryExportsResponse( + big_query_exports=[ + bigquery_export.BigQueryExport(), + bigquery_export.BigQueryExport(), + ], + ), + RuntimeError, + ) + pages = list(client.list_big_query_exports(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_big_query_exports_async_pager(): + client = SecurityCenterAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_big_query_exports), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + securitycenter_service.ListBigQueryExportsResponse( + big_query_exports=[ + bigquery_export.BigQueryExport(), + bigquery_export.BigQueryExport(), + bigquery_export.BigQueryExport(), + ], + next_page_token="abc", + ), + securitycenter_service.ListBigQueryExportsResponse( + big_query_exports=[], next_page_token="def", + ), + securitycenter_service.ListBigQueryExportsResponse( + big_query_exports=[bigquery_export.BigQueryExport(),], + next_page_token="ghi", + ), + securitycenter_service.ListBigQueryExportsResponse( + big_query_exports=[ + bigquery_export.BigQueryExport(), + bigquery_export.BigQueryExport(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_big_query_exports(request={},) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, bigquery_export.BigQueryExport) for i in responses) + + +@pytest.mark.asyncio +async def test_list_big_query_exports_async_pages(): + client = SecurityCenterAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_big_query_exports), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + securitycenter_service.ListBigQueryExportsResponse( + big_query_exports=[ + bigquery_export.BigQueryExport(), + bigquery_export.BigQueryExport(), + bigquery_export.BigQueryExport(), + ], + next_page_token="abc", + ), + securitycenter_service.ListBigQueryExportsResponse( + big_query_exports=[], next_page_token="def", + ), + securitycenter_service.ListBigQueryExportsResponse( + big_query_exports=[bigquery_export.BigQueryExport(),], + next_page_token="ghi", + ), + securitycenter_service.ListBigQueryExportsResponse( + big_query_exports=[ + bigquery_export.BigQueryExport(), + bigquery_export.BigQueryExport(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_big_query_exports(request={})).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.SecurityCenterGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = SecurityCenterClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.SecurityCenterGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = SecurityCenterClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide an api_key and a transport instance. + transport = transports.SecurityCenterGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = SecurityCenterClient(client_options=options, transport=transport,) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = SecurityCenterClient( + client_options=options, credentials=ga_credentials.AnonymousCredentials() + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.SecurityCenterGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = SecurityCenterClient( + client_options={"scopes": ["1", "2"]}, transport=transport, + ) def test_transport_instance(): @@ -8988,6 +10370,7 @@ def test_security_center_base_transport(): "create_notification_config", "delete_mute_config", "delete_notification_config", + "get_big_query_export", "get_iam_policy", "get_mute_config", "get_notification_config", @@ -9012,6 +10395,10 @@ def test_security_center_base_transport(): "update_organization_settings", "update_source", "update_security_marks", + "create_big_query_export", + "delete_big_query_export", + "update_big_query_export", + "list_big_query_exports", ) for method in methods: with pytest.raises(NotImplementedError): @@ -9361,11 +10748,33 @@ def test_parse_asset_path(): assert expected == actual -def test_external_system_path(): +def test_big_query_export_path(): organization = "oyster" - source = "nudibranch" - finding = "cuttlefish" - externalsystem = "mussel" + export = "nudibranch" + expected = "organizations/{organization}/bigQueryExports/{export}".format( + organization=organization, export=export, + ) + actual = SecurityCenterClient.big_query_export_path(organization, export) + assert expected == actual + + +def test_parse_big_query_export_path(): + expected = { + "organization": "cuttlefish", + "export": "mussel", + } + path = SecurityCenterClient.big_query_export_path(**expected) + + # Check that the path construction is reversible. + actual = SecurityCenterClient.parse_big_query_export_path(path) + assert expected == actual + + +def test_external_system_path(): + organization = "winkle" + source = "nautilus" + finding = "scallop" + externalsystem = "abalone" expected = "organizations/{organization}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}".format( organization=organization, source=source, @@ -9380,10 +10789,10 @@ def test_external_system_path(): def test_parse_external_system_path(): expected = { - "organization": "winkle", - "source": "nautilus", - "finding": "scallop", - "externalsystem": "abalone", + "organization": "squid", + "source": "clam", + "finding": "whelk", + "externalsystem": "octopus", } path = SecurityCenterClient.external_system_path(**expected) @@ -9393,9 +10802,9 @@ def test_parse_external_system_path(): def test_finding_path(): - organization = "squid" - source = "clam" - finding = "whelk" + organization = "oyster" + source = "nudibranch" + finding = "cuttlefish" expected = "organizations/{organization}/sources/{source}/findings/{finding}".format( organization=organization, source=source, finding=finding, ) @@ -9405,9 +10814,9 @@ def test_finding_path(): def test_parse_finding_path(): expected = { - "organization": "octopus", - "source": "oyster", - "finding": "nudibranch", + "organization": "mussel", + "source": "winkle", + "finding": "nautilus", } path = SecurityCenterClient.finding_path(**expected) @@ -9417,8 +10826,8 @@ def test_parse_finding_path(): def test_mute_config_path(): - organization = "cuttlefish" - mute_config = "mussel" + organization = "scallop" + mute_config = "abalone" expected = "organizations/{organization}/muteConfigs/{mute_config}".format( organization=organization, mute_config=mute_config, ) @@ -9428,8 +10837,8 @@ def test_mute_config_path(): def test_parse_mute_config_path(): expected = { - "organization": "winkle", - "mute_config": "nautilus", + "organization": "squid", + "mute_config": "clam", } path = SecurityCenterClient.mute_config_path(**expected) @@ -9439,8 +10848,8 @@ def test_parse_mute_config_path(): def test_notification_config_path(): - organization = "scallop" - notification_config = "abalone" + organization = "whelk" + notification_config = "octopus" expected = "organizations/{organization}/notificationConfigs/{notification_config}".format( organization=organization, notification_config=notification_config, ) @@ -9452,8 +10861,8 @@ def test_notification_config_path(): def test_parse_notification_config_path(): expected = { - "organization": "squid", - "notification_config": "clam", + "organization": "oyster", + "notification_config": "nudibranch", } path = SecurityCenterClient.notification_config_path(**expected) @@ -9463,7 +10872,7 @@ def test_parse_notification_config_path(): def test_organization_settings_path(): - organization = "whelk" + organization = "cuttlefish" expected = "organizations/{organization}/organizationSettings".format( organization=organization, ) @@ -9473,7 +10882,7 @@ def test_organization_settings_path(): def test_parse_organization_settings_path(): expected = { - "organization": "octopus", + "organization": "mussel", } path = SecurityCenterClient.organization_settings_path(**expected) @@ -9483,8 +10892,8 @@ def test_parse_organization_settings_path(): def test_security_marks_path(): - organization = "oyster" - asset = "nudibranch" + organization = "winkle" + asset = "nautilus" expected = "organizations/{organization}/assets/{asset}/securityMarks".format( organization=organization, asset=asset, ) @@ -9494,8 +10903,8 @@ def test_security_marks_path(): def test_parse_security_marks_path(): expected = { - "organization": "cuttlefish", - "asset": "mussel", + "organization": "scallop", + "asset": "abalone", } path = SecurityCenterClient.security_marks_path(**expected) @@ -9505,8 +10914,8 @@ def test_parse_security_marks_path(): def test_source_path(): - organization = "winkle" - source = "nautilus" + organization = "squid" + source = "clam" expected = "organizations/{organization}/sources/{source}".format( organization=organization, source=source, ) @@ -9516,8 +10925,8 @@ def test_source_path(): def test_parse_source_path(): expected = { - "organization": "scallop", - "source": "abalone", + "organization": "whelk", + "source": "octopus", } path = SecurityCenterClient.source_path(**expected) @@ -9527,8 +10936,8 @@ def test_parse_source_path(): def test_topic_path(): - project = "squid" - topic = "clam" + project = "oyster" + topic = "nudibranch" expected = "projects/{project}/topics/{topic}".format(project=project, topic=topic,) actual = SecurityCenterClient.topic_path(project, topic) assert expected == actual @@ -9536,8 +10945,8 @@ def test_topic_path(): def test_parse_topic_path(): expected = { - "project": "whelk", - "topic": "octopus", + "project": "cuttlefish", + "topic": "mussel", } path = SecurityCenterClient.topic_path(**expected) @@ -9547,7 +10956,7 @@ def test_parse_topic_path(): def test_common_billing_account_path(): - billing_account = "oyster" + billing_account = "winkle" expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -9557,7 +10966,7 @@ def test_common_billing_account_path(): def test_parse_common_billing_account_path(): expected = { - "billing_account": "nudibranch", + "billing_account": "nautilus", } path = SecurityCenterClient.common_billing_account_path(**expected) @@ -9567,7 +10976,7 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): - folder = "cuttlefish" + folder = "scallop" expected = "folders/{folder}".format(folder=folder,) actual = SecurityCenterClient.common_folder_path(folder) assert expected == actual @@ -9575,7 +10984,7 @@ def test_common_folder_path(): def test_parse_common_folder_path(): expected = { - "folder": "mussel", + "folder": "abalone", } path = SecurityCenterClient.common_folder_path(**expected) @@ -9585,7 +10994,7 @@ def test_parse_common_folder_path(): def test_common_organization_path(): - organization = "winkle" + organization = "squid" expected = "organizations/{organization}".format(organization=organization,) actual = SecurityCenterClient.common_organization_path(organization) assert expected == actual @@ -9593,7 +11002,7 @@ def test_common_organization_path(): def test_parse_common_organization_path(): expected = { - "organization": "nautilus", + "organization": "clam", } path = SecurityCenterClient.common_organization_path(**expected) @@ -9603,7 +11012,7 @@ def test_parse_common_organization_path(): def test_common_project_path(): - project = "scallop" + project = "whelk" expected = "projects/{project}".format(project=project,) actual = SecurityCenterClient.common_project_path(project) assert expected == actual @@ -9611,7 +11020,7 @@ def test_common_project_path(): def test_parse_common_project_path(): expected = { - "project": "abalone", + "project": "octopus", } path = SecurityCenterClient.common_project_path(**expected) @@ -9621,8 +11030,8 @@ def test_parse_common_project_path(): def test_common_location_path(): - project = "squid" - location = "clam" + project = "oyster" + location = "nudibranch" expected = "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -9632,8 +11041,8 @@ def test_common_location_path(): def test_parse_common_location_path(): expected = { - "project": "whelk", - "location": "octopus", + "project": "cuttlefish", + "location": "mussel", } path = SecurityCenterClient.common_location_path(**expected) From 08d4d94bc22734d46b70499ce219ac84318b72fc Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 4 Mar 2022 11:41:11 -0500 Subject: [PATCH 5/9] chore: Adding support for pytest-xdist and pytest-parallel (#295) Source-Link: https://github.com/googleapis/synthtool/commit/82f5cb283efffe96e1b6cd634738e0e7de2cd90a Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5d8da01438ece4021d135433f2cf3227aa39ef0eaccc941d62aa35e6902832ae Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- samples/snippets/noxfile.py | 78 +++++++++++++++++++++---------------- 2 files changed, 45 insertions(+), 35 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 480226ac..7e08e05a 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:6162c384d685c5fe22521d3f37f6fc732bf99a085f6d47b677dbcae97fc21392 + digest: sha256:5d8da01438ece4021d135433f2cf3227aa39ef0eaccc941d62aa35e6902832ae diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index 20cdfc62..85f5836d 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -188,42 +188,52 @@ def _session_tests( # check for presence of tests test_list = glob.glob("*_test.py") + glob.glob("test_*.py") test_list.extend(glob.glob("tests")) + if len(test_list) == 0: print("No tests found, skipping directory.") - else: - if TEST_CONFIG["pip_version_override"]: - pip_version = TEST_CONFIG["pip_version_override"] - session.install(f"pip=={pip_version}") - """Runs py.test for a particular project.""" - if os.path.exists("requirements.txt"): - if os.path.exists("constraints.txt"): - session.install("-r", "requirements.txt", "-c", "constraints.txt") - else: - session.install("-r", "requirements.txt") - - if os.path.exists("requirements-test.txt"): - if os.path.exists("constraints-test.txt"): - session.install( - "-r", "requirements-test.txt", "-c", "constraints-test.txt" - ) - else: - session.install("-r", "requirements-test.txt") - - if INSTALL_LIBRARY_FROM_SOURCE: - session.install("-e", _get_repo_root()) - - if post_install: - post_install(session) - - session.run( - "pytest", - *(PYTEST_COMMON_ARGS + session.posargs), - # Pytest will return 5 when no tests are collected. This can happen - # on travis where slow and flaky tests are excluded. - # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html - success_codes=[0, 5], - env=get_pytest_env_vars(), - ) + return + + if TEST_CONFIG["pip_version_override"]: + pip_version = TEST_CONFIG["pip_version_override"] + session.install(f"pip=={pip_version}") + """Runs py.test for a particular project.""" + concurrent_args = [] + if os.path.exists("requirements.txt"): + if os.path.exists("constraints.txt"): + session.install("-r", "requirements.txt", "-c", "constraints.txt") + else: + session.install("-r", "requirements.txt") + with open("requirements.txt") as rfile: + packages = rfile.read() + + if os.path.exists("requirements-test.txt"): + if os.path.exists("constraints-test.txt"): + session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt") + else: + session.install("-r", "requirements-test.txt") + with open("requirements-test.txt") as rtfile: + packages += rtfile.read() + + if INSTALL_LIBRARY_FROM_SOURCE: + session.install("-e", _get_repo_root()) + + if post_install: + post_install(session) + + if "pytest-parallel" in packages: + concurrent_args.extend(["--workers", "auto", "--tests-per-worker", "auto"]) + elif "pytest-xdist" in packages: + concurrent_args.extend(["-n", "auto"]) + + session.run( + "pytest", + *(PYTEST_COMMON_ARGS + session.posargs + concurrent_args), + # Pytest will return 5 when no tests are collected. This can happen + # on travis where slow and flaky tests are excluded. + # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html + success_codes=[0, 5], + env=get_pytest_env_vars(), + ) @nox.session(python=ALL_VERSIONS) From ae90feee4d04057b505b8dda7cd0b4c99b22e530 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Fri, 4 Mar 2022 13:03:47 -0500 Subject: [PATCH 6/9] fix(deps): require google-api-core>=1.31.5, >=2.3.2 (#293) fix(deps): require proto-plus>=1.15.0 --- setup.py | 4 ++-- testing/constraints-3.6.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index b3aa2683..852a0f2c 100644 --- a/setup.py +++ b/setup.py @@ -27,9 +27,9 @@ # NOTE: Maintainers, please do not require google-api-core>=2.x.x # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 - "google-api-core[grpc] >= 1.28.0, <3.0.0dev", + "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", "grpc-google-iam-v1 >= 0.12.3, < 0.13dev", - "proto-plus >= 1.10.0", + "proto-plus >= 1.15.0", ] extras = {"libcst": "libcst >= 0.2.5"} diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index 02028c8a..3755c967 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -5,7 +5,7 @@ # # e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", # Then this file should have foo==1.14.0 -google-api-core==1.28.0 +google-api-core==1.31.5 grpc-google-iam-v1==0.12.3 -proto-plus==1.10.0 +proto-plus==1.15.0 libcst==0.2.5 From 72259189eb971874864ef4ddb3dd733640479035 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 5 Mar 2022 00:38:20 +0000 Subject: [PATCH 7/9] chore(deps): update actions/download-artifact action to v3 (#296) Source-Link: https://github.com/googleapis/synthtool/commit/38e11ad1104dcc1e63b52691ddf2fe4015d06955 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 --- .github/.OwlBot.lock.yaml | 2 +- .github/workflows/unittest.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 7e08e05a..44c78f7c 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:5d8da01438ece4021d135433f2cf3227aa39ef0eaccc941d62aa35e6902832ae + digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index e87fe5b7..e5be6edb 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -26,7 +26,7 @@ jobs: run: | nox -s unit-${{ matrix.python }} - name: Upload coverage results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: coverage-artifacts path: .coverage-${{ matrix.python }} @@ -47,7 +47,7 @@ jobs: python -m pip install --upgrade setuptools pip wheel python -m pip install coverage - name: Download coverage results - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: coverage-artifacts path: .coverage-results/ From 394bd43ecfb455706bcca9ea5d8c44b5e904b3f1 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sat, 5 Mar 2022 17:54:26 +0100 Subject: [PATCH 8/9] chore(deps): update dependency google-cloud-pubsub to v2.10.0 (#297) --- samples/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index e9e977ae..366da9c3 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-pubsub==2.9.0 +google-cloud-pubsub==2.10.0 google-cloud-securitycenter==1.9.0 \ No newline at end of file From 0c1858b649fa075e89eff0ddc67b6e43218c5fed Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 7 Mar 2022 11:43:14 -0500 Subject: [PATCH 9/9] chore(main): release 1.10.0 (#294) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou --- CHANGELOG.md | 13 +++++++++++++ setup.py | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15ba2f46..2ba7b9bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ [1]: https://pypi.org/project/google-cloud-securitycenter/#history +## [1.10.0](https://github.com/googleapis/python-securitycenter/compare/v1.9.0...v1.10.0) (2022-03-05) + + +### Features + +* Add BigQuery export APIs ([#289](https://github.com/googleapis/python-securitycenter/issues/289)) ([0a29512](https://github.com/googleapis/python-securitycenter/commit/0a29512a1b1e22a2205311a39f40759bfeafe468)) + + +### Bug Fixes + +* **deps:** require google-api-core>=1.31.5, >=2.3.2 ([#293](https://github.com/googleapis/python-securitycenter/issues/293)) ([ae90fee](https://github.com/googleapis/python-securitycenter/commit/ae90feee4d04057b505b8dda7cd0b4c99b22e530)) +* **deps:** require proto-plus>=1.15.0 ([ae90fee](https://github.com/googleapis/python-securitycenter/commit/ae90feee4d04057b505b8dda7cd0b4c99b22e530)) + ## [1.9.0](https://github.com/googleapis/python-securitycenter/compare/v1.8.0...v1.9.0) (2022-02-26) diff --git a/setup.py b/setup.py index 852a0f2c..2f2c8d59 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ name = "google-cloud-securitycenter" description = "Cloud Security Command Center API client library" -version = "1.9.0" +version = "1.10.0" release_status = "Development Status :: 5 - Production/Stable" dependencies = [ # NOTE: Maintainers, please do not require google-api-core>=2.x.x