diff --git a/packages/google-cloud-securitycenter/docs/v1p1beta1/snippets_notification_configs.py b/packages/google-cloud-securitycenter/docs/snippets_notification_configs.py similarity index 89% rename from packages/google-cloud-securitycenter/docs/v1p1beta1/snippets_notification_configs.py rename to packages/google-cloud-securitycenter/docs/snippets_notification_configs.py index 062ad07f4ba3..42d1f70f9bc1 100644 --- a/packages/google-cloud-securitycenter/docs/v1p1beta1/snippets_notification_configs.py +++ b/packages/google-cloud-securitycenter/docs/snippets_notification_configs.py @@ -19,10 +19,7 @@ def create_notification_config(organization_id, notification_config_id, pubsub_topic): # [START scc_create_notification_config] - from google.cloud import securitycenter_v1p1beta1 as securitycenter - from google.cloud.securitycenter_v1p1beta1.proto.notification_config_pb2 import ( - NotificationConfig, - ) + from google.cloud import securitycenter as securitycenter client = securitycenter.SecurityCenterClient() @@ -39,7 +36,6 @@ def create_notification_config(organization_id, notification_config_id, pubsub_t { "description": "Notification for active findings", "pubsub_topic": pubsub_topic, - "event_type": NotificationConfig.FINDING, "streaming_config": {"filter": 'state = "ACTIVE"',}, }, ) @@ -52,7 +48,7 @@ def create_notification_config(organization_id, notification_config_id, pubsub_t def delete_notification_config(organization_id, notification_config_id): # [START scc_delete_notification_config] - from google.cloud import securitycenter_v1p1beta1 as securitycenter + from google.cloud import securitycenter as securitycenter client = securitycenter.SecurityCenterClient() @@ -72,7 +68,7 @@ def delete_notification_config(organization_id, notification_config_id): def get_notification_config(organization_id, notification_config_id): # [START scc_get_notification_config] - from google.cloud import securitycenter_v1p1beta1 as securitycenter + from google.cloud import securitycenter as securitycenter client = securitycenter.SecurityCenterClient() @@ -92,7 +88,7 @@ def get_notification_config(organization_id, notification_config_id): def list_notification_configs(organization_id): # [START scc_list_notification_configs] - from google.cloud import securitycenter_v1p1beta1 as securitycenter + from google.cloud import securitycenter as securitycenter client = securitycenter.SecurityCenterClient() @@ -108,7 +104,7 @@ def list_notification_configs(organization_id): def update_notification_config(organization_id, notification_config_id, pubsub_topic): # [START scc_update_notification_config] - from google.cloud import securitycenter_v1p1beta1 as securitycenter + from google.cloud import securitycenter as securitycenter from google.protobuf import field_mask_pb2 client = securitycenter.SecurityCenterClient() diff --git a/packages/google-cloud-securitycenter/docs/v1p1beta1/snippets_notification_receiver.py b/packages/google-cloud-securitycenter/docs/snippets_notification_receiver.py similarity index 95% rename from packages/google-cloud-securitycenter/docs/v1p1beta1/snippets_notification_receiver.py rename to packages/google-cloud-securitycenter/docs/snippets_notification_receiver.py index 58192bbdd32d..fd2fdcae58de 100644 --- a/packages/google-cloud-securitycenter/docs/v1p1beta1/snippets_notification_receiver.py +++ b/packages/google-cloud-securitycenter/docs/snippets_notification_receiver.py @@ -20,7 +20,7 @@ def receive_notifications(project_id, subscription_name): # [START scc_receive_notifications] # Requires https://cloud.google.com/pubsub/docs/quickstart-client-libraries#pubsub-client-libraries-python from google.cloud import pubsub_v1 - from google.cloud.securitycenter_v1p1beta1.proto.notification_message_pb2 import ( + from google.cloud.securitycenter_v1.proto.notification_message_pb2 import ( NotificationMessage, ) from google.protobuf import json_format diff --git a/packages/google-cloud-securitycenter/docs/v1p1beta1/snippets_test.py b/packages/google-cloud-securitycenter/docs/snippets_notification_test.py similarity index 92% rename from packages/google-cloud-securitycenter/docs/v1p1beta1/snippets_test.py rename to packages/google-cloud-securitycenter/docs/snippets_notification_test.py index cb74f3f27c42..d24d0906e2fc 100644 --- a/packages/google-cloud-securitycenter/docs/v1p1beta1/snippets_test.py +++ b/packages/google-cloud-securitycenter/docs/snippets_notification_test.py @@ -18,10 +18,7 @@ import os import uuid -from google.cloud import securitycenter_v1p1beta1 as securitycenter -from google.cloud.securitycenter_v1p1beta1.proto.notification_config_pb2 import ( - NotificationConfig, -) +from google.cloud import securitycenter as securitycenter import pytest import snippets_notification_configs @@ -59,7 +56,6 @@ def new_notification_config_for_update(): { "description": "Notification for active findings", "pubsub_topic": PUBSUB_TOPIC, - "event_type": NotificationConfig.FINDING, "streaming_config": {"filter": "",}, }, ) @@ -79,7 +75,6 @@ def new_notification_config_for_get(): { "description": "Notification for active findings", "pubsub_topic": PUBSUB_TOPIC, - "event_type": NotificationConfig.FINDING, "streaming_config": {"filter": "",}, }, ) @@ -99,7 +94,6 @@ def deleted_notification_config(): { "description": "Notification for active findings", "pubsub_topic": PUBSUB_TOPIC, - "event_type": NotificationConfig.FINDING, "streaming_config": {"filter": "",}, }, ) diff --git a/packages/google-cloud-securitycenter/noxfile.py b/packages/google-cloud-securitycenter/noxfile.py index cb949f768fb5..ab80499ce02e 100644 --- a/packages/google-cloud-securitycenter/noxfile.py +++ b/packages/google-cloud-securitycenter/noxfile.py @@ -176,7 +176,7 @@ def snippets(session): os.path.join('docs', 'snippets_orgs.py'), os.path.join('docs', 'snippets_findings.py'), os.path.join('docs', 'snippets_security_marks.py'), - os.path.join('docs', 'v1p1beta1', 'snippets_test.py'), + os.path.join('docs', 'snippets_notification_test.py'), *session.posargs