From 98017aba4d73f5e81935025184ab962b84d24575 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 20 Apr 2023 20:01:03 +0000 Subject: [PATCH 1/2] feat: add cloud_dlp_inspection and cloud_dlp_data_profile fields to finding's list of attributes docs: miscellaneous style improvements PiperOrigin-RevId: 525798516 Source-Link: https://github.com/googleapis/googleapis/commit/36a885f998c5f0e86dbd0bdde98d5c1069d70067 Source-Link: https://github.com/googleapis/googleapis-gen/commit/c47a1b79926eb4b9fc47f445a3a8971314075de7 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXNlY3VyaXR5Y2VudGVyLy5Pd2xCb3QueWFtbCIsImgiOiJjNDdhMWI3OTkyNmViNGI5ZmM0N2Y0NDVhM2E4OTcxMzE0MDc1ZGU3In0= --- .../v1/.eslintignore | 7 + .../v1/.eslintrc.json | 3 + .../google-cloud-securitycenter/v1/.gitignore | 14 + .../google-cloud-securitycenter/v1/.jsdoc.js | 55 + .../v1/.mocharc.js | 33 + .../v1/.prettierrc.js | 22 + .../google-cloud-securitycenter/v1/README.md | 1 + .../v1/linkinator.config.json | 16 + .../v1/package.json | 64 + .../cloud/securitycenter/v1/access.proto | 108 + .../cloud/securitycenter/v1/asset.proto | 134 + .../securitycenter/v1/bigquery_export.proto | 101 + .../v1/cloud_dlp_data_profile.proto | 42 + .../v1/cloud_dlp_inspection.proto | 54 + .../cloud/securitycenter/v1/compliance.proto | 39 + .../cloud/securitycenter/v1/connection.proto | 66 + .../securitycenter/v1/contact_details.proto | 37 + .../cloud/securitycenter/v1/container.proto | 45 + .../cloud/securitycenter/v1/database.proto | 52 + ...urity_health_analytics_custom_module.proto | 81 + .../securitycenter/v1/exfiltration.proto | 52 + .../securitycenter/v1/external_system.proto | 58 + .../google/cloud/securitycenter/v1/file.proto | 52 + .../cloud/securitycenter/v1/finding.proto | 362 + .../cloud/securitycenter/v1/folder.proto | 36 + .../cloud/securitycenter/v1/iam_binding.proto | 52 + .../cloud/securitycenter/v1/indicator.proto | 83 + .../securitycenter/v1/kernel_rootkit.proto | 62 + .../cloud/securitycenter/v1/kubernetes.proto | 181 + .../cloud/securitycenter/v1/label.proto | 35 + .../securitycenter/v1/mitre_attack.proto | 211 + .../cloud/securitycenter/v1/mute_config.proto | 91 + .../v1/notification_config.proto | 99 + .../v1/notification_message.proto | 44 + .../v1/organization_settings.proto | 85 + .../cloud/securitycenter/v1/process.proto | 74 + .../cloud/securitycenter/v1/resource.proto | 58 + .../v1/run_asset_discovery_response.proto | 51 + ...urity_health_analytics_custom_config.proto | 101 + ...urity_health_analytics_custom_module.proto | 110 + .../securitycenter/v1/security_marks.proto | 69 + .../v1/securitycenter_service.proto | 2215 +++++ .../cloud/securitycenter/v1/source.proto | 69 + .../securitycenter/v1/vulnerability.proto | 216 + .../v1/security_center.bulk_mute_findings.js | 87 + ...security_center.create_big_query_export.js | 76 + .../v1/security_center.create_finding.js | 75 + .../v1/security_center.create_mute_config.js | 76 + ...urity_center.create_notification_config.js | 78 + ...security_health_analytics_custom_module.js | 71 + .../v1/security_center.create_source.js | 68 + ...security_center.delete_big_query_export.js | 64 + .../v1/security_center.delete_mute_config.js | 64 + ...urity_center.delete_notification_config.js | 64 + ...security_health_analytics_custom_module.js | 65 + .../security_center.get_big_query_export.js | 64 + ...security_health_analytics_custom_module.js | 65 + .../v1/security_center.get_iam_policy.js | 67 + .../v1/security_center.get_mute_config.js | 64 + ...security_center.get_notification_config.js | 64 + ...curity_center.get_organization_settings.js | 62 + ...security_health_analytics_custom_module.js | 65 + .../v1/security_center.get_source.js | 62 + .../v1/security_center.group_assets.js | 176 + .../v1/security_center.group_findings.js | 180 + .../v1/security_center.list_assets.js | 187 + .../security_center.list_big_query_exports.js | 79 + ...ecurity_health_analytics_custom_modules.js | 75 + ...ecurity_health_analytics_custom_modules.js | 75 + .../v1/security_center.list_findings.js | 191 + .../v1/security_center.list_mute_configs.js | 79 + ...curity_center.list_notification_configs.js | 76 + ...ecurity_health_analytics_custom_modules.js | 75 + .../v1/security_center.list_sources.js | 76 + .../v1/security_center.run_asset_discovery.js | 63 + .../v1/security_center.set_finding_state.js | 76 + .../v1/security_center.set_iam_policy.js | 77 + .../generated/v1/security_center.set_mute.js | 71 + .../security_center.test_iam_permissions.js | 70 + ...security_center.update_big_query_export.js | 66 + .../security_center.update_external_system.js | 66 + .../v1/security_center.update_finding.js | 74 + .../v1/security_center.update_mute_config.js | 66 + ...urity_center.update_notification_config.js | 66 + ...ity_center.update_organization_settings.js | 66 + ...security_health_analytics_custom_module.js | 65 + .../security_center.update_security_marks.js | 75 + .../v1/security_center.update_source.js | 66 + ...tadata.google.cloud.securitycenter.v1.json | 2051 ++++ .../v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 507 + .../v1/src/v1/index.ts | 19 + .../v1/src/v1/security_center_client.ts | 8207 ++++++++++++++++ .../src/v1/security_center_client_config.json | 233 + .../v1/src/v1/security_center_proto_list.json | 37 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../v1/test/gapic_security_center_v1.ts | 8298 +++++++++++++++++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v1beta1/.eslintignore | 7 + .../v1beta1/.eslintrc.json | 3 + .../v1beta1/.gitignore | 14 + .../v1beta1/.jsdoc.js | 55 + .../v1beta1/.mocharc.js | 33 + .../v1beta1/.prettierrc.js | 22 + .../v1beta1/README.md | 1 + .../v1beta1/linkinator.config.json | 16 + .../v1beta1/package.json | 64 + .../cloud/securitycenter/v1beta1/asset.proto | 92 + .../securitycenter/v1beta1/finding.proto | 109 + .../v1beta1/organization_settings.proto | 78 + .../run_asset_discovery_response.proto | 48 + .../v1beta1/security_marks.proto | 52 + .../v1beta1/securitycenter_service.proto | 823 ++ .../cloud/securitycenter/v1beta1/source.proto | 55 + .../v1beta1/security_center.create_finding.js | 75 + .../v1beta1/security_center.create_source.js | 68 + .../v1beta1/security_center.get_iam_policy.js | 67 + ...curity_center.get_organization_settings.js | 62 + .../v1beta1/security_center.get_source.js | 62 + .../v1beta1/security_center.group_assets.js | 139 + .../v1beta1/security_center.group_findings.js | 118 + .../v1beta1/security_center.list_assets.js | 144 + .../v1beta1/security_center.list_findings.js | 121 + .../v1beta1/security_center.list_sources.js | 75 + .../security_center.run_asset_discovery.js | 63 + .../security_center.set_finding_state.js | 74 + .../v1beta1/security_center.set_iam_policy.js | 77 + .../security_center.test_iam_permissions.js | 70 + .../v1beta1/security_center.update_finding.js | 70 + ...ity_center.update_organization_settings.js | 65 + .../security_center.update_security_marks.js | 69 + .../v1beta1/security_center.update_source.js | 65 + ...a.google.cloud.securitycenter.v1beta1.json | 895 ++ .../v1beta1/src/index.ts | 25 + .../v1beta1/src/v1beta1/gapic_metadata.json | 223 + .../v1beta1/src/v1beta1/index.ts | 19 + .../src/v1beta1/security_center_client.ts | 3268 +++++++ .../security_center_client_config.json | 116 + .../v1beta1/security_center_proto_list.json | 9 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1beta1/system-test/install.ts | 49 + .../test/gapic_security_center_v1beta1.ts | 3173 +++++++ .../v1beta1/tsconfig.json | 19 + .../v1beta1/webpack.config.js | 64 + .../v1p1beta1/.eslintignore | 7 + .../v1p1beta1/.eslintrc.json | 3 + .../v1p1beta1/.gitignore | 14 + .../v1p1beta1/.jsdoc.js | 55 + .../v1p1beta1/.mocharc.js | 33 + .../v1p1beta1/.prettierrc.js | 22 + .../v1p1beta1/README.md | 1 + .../v1p1beta1/linkinator.config.json | 16 + .../v1p1beta1/package.json | 64 + .../securitycenter/v1p1beta1/asset.proto | 134 + .../securitycenter/v1p1beta1/finding.proto | 145 + .../securitycenter/v1p1beta1/folder.proto | 37 + .../v1p1beta1/notification_config.proto | 107 + .../v1p1beta1/notification_message.proto | 43 + .../v1p1beta1/organization_settings.proto | 85 + .../securitycenter/v1p1beta1/resource.proto | 52 + .../run_asset_discovery_response.proto | 51 + .../v1p1beta1/security_marks.proto | 69 + .../v1p1beta1/securitycenter_service.proto | 1351 +++ .../securitycenter/v1p1beta1/source.proto | 68 + .../security_center.create_finding.js | 73 + ...urity_center.create_notification_config.js | 75 + .../security_center.create_source.js | 68 + ...urity_center.delete_notification_config.js | 62 + .../security_center.get_iam_policy.js | 67 + ...security_center.get_notification_config.js | 62 + ...curity_center.get_organization_settings.js | 62 + .../v1p1beta1/security_center.get_source.js | 62 + .../v1p1beta1/security_center.group_assets.js | 176 + .../security_center.group_findings.js | 172 + .../v1p1beta1/security_center.list_assets.js | 185 + .../security_center.list_findings.js | 181 + ...curity_center.list_notification_configs.js | 75 + .../v1p1beta1/security_center.list_sources.js | 76 + .../security_center.run_asset_discovery.js | 63 + .../security_center.set_finding_state.js | 74 + .../security_center.set_iam_policy.js | 77 + .../security_center.test_iam_permissions.js | 70 + .../security_center.update_finding.js | 74 + ...urity_center.update_notification_config.js | 66 + ...ity_center.update_organization_settings.js | 66 + .../security_center.update_security_marks.js | 74 + .../security_center.update_source.js | 66 + ...google.cloud.securitycenter.v1p1beta1.json | 1123 +++ .../v1p1beta1/src/index.ts | 25 + .../src/v1p1beta1/gapic_metadata.json | 277 + .../v1p1beta1/src/v1p1beta1/index.ts | 19 + .../src/v1p1beta1/security_center_client.ts | 4943 ++++++++++ .../security_center_client_config.json | 141 + .../v1p1beta1/security_center_proto_list.json | 13 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1p1beta1/system-test/install.ts | 49 + .../test/gapic_security_center_v1p1beta1.ts | 4304 +++++++++ .../v1p1beta1/tsconfig.json | 19 + .../v1p1beta1/webpack.config.js | 64 + 204 files changed, 54839 insertions(+) create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/README.md create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/package.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/access.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/asset.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/bigquery_export.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/cloud_dlp_data_profile.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/cloud_dlp_inspection.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/compliance.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/connection.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/contact_details.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/container.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/database.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/effective_security_health_analytics_custom_module.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/exfiltration.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/external_system.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/file.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/finding.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/folder.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/iam_binding.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/indicator.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/kernel_rootkit.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/kubernetes.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/label.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/mitre_attack.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/mute_config.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/notification_config.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/notification_message.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/organization_settings.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/process.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/resource.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_health_analytics_custom_config.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_health_analytics_custom_module.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_marks.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/securitycenter_service.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/source.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/vulnerability.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.bulk_mute_findings.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_big_query_export.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_finding.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_mute_config.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_notification_config.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_security_health_analytics_custom_module.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_source.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_big_query_export.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_mute_config.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_notification_config.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_security_health_analytics_custom_module.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_big_query_export.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_effective_security_health_analytics_custom_module.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_iam_policy.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_mute_config.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_notification_config.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_organization_settings.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_security_health_analytics_custom_module.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_source.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.group_assets.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.group_findings.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_assets.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_big_query_exports.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_descendant_security_health_analytics_custom_modules.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_effective_security_health_analytics_custom_modules.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_findings.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_mute_configs.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_notification_configs.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_security_health_analytics_custom_modules.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_sources.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.run_asset_discovery.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_finding_state.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_iam_policy.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_mute.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.test_iam_permissions.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_big_query_export.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_external_system.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_finding.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_mute_config.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_notification_config.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_organization_settings.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_security_health_analytics_custom_module.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_security_marks.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_source.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_client.ts create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_client_config.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_proto_list.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/test/gapic_security_center_v1.ts create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/.gitignore create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/README.md create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/package.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/asset.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/finding.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/organization_settings.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/security_marks.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/source.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.create_finding.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.create_source.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_iam_policy.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_organization_settings.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_source.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.group_assets.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.group_findings.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_assets.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_findings.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_sources.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.run_asset_discovery.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.set_finding_state.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.set_iam_policy.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.test_iam_permissions.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_finding.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_organization_settings.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_security_marks.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_source.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/index.ts create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_client.ts create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_client_config.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_proto_list.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/test/gapic_security_center_v1beta1.ts create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.gitignore create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/README.md create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/package.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/asset.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/finding.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/folder.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/resource.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/source.proto create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_finding.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_notification_config.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_source.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.delete_notification_config.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_iam_policy.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_notification_config.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_organization_settings.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_source.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.group_assets.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.group_findings.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_assets.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_findings.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_notification_configs.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_sources.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.run_asset_discovery.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.set_finding_state.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.set_iam_policy.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.test_iam_permissions.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_finding.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_notification_config.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_organization_settings.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_security_marks.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_source.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/index.ts create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_client.ts create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_client_config.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_proto_list.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/test/gapic_security_center_v1p1beta1.ts create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/webpack.config.js diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/.eslintignore b/owl-bot-staging/google-cloud-securitycenter/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/.eslintrc.json b/owl-bot-staging/google-cloud-securitycenter/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/.gitignore b/owl-bot-staging/google-cloud-securitycenter/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +/.coverage +/coverage +/.nyc_output +/docs/ +/out/ +/build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/.jsdoc.js b/owl-bot-staging/google-cloud-securitycenter/v1/.jsdoc.js new file mode 100644 index 00000000000..4d5ad9781e7 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2023 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/security-center', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/.mocharc.js b/owl-bot-staging/google-cloud-securitycenter/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/.prettierrc.js b/owl-bot-staging/google-cloud-securitycenter/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/README.md b/owl-bot-staging/google-cloud-securitycenter/v1/README.md new file mode 100644 index 00000000000..73f34764a12 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/README.md @@ -0,0 +1 @@ +Securitycenter: Nodejs Client diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/linkinator.config.json b/owl-bot-staging/google-cloud-securitycenter/v1/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/package.json b/owl-bot-staging/google-cloud-securitycenter/v1/package.json new file mode 100644 index 00000000000..efcfeb4e7ad --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/security-center", + "version": "0.1.0", + "description": "Securitycenter client for Node.js", + "repository": "googleapis/nodejs-securitycenter", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google securitycenter", + "securitycenter", + "security center" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.5.7" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^4.0.0", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.1.2", + "mocha": "^10.2.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.0.1", + "ts-loader": "^8.4.0", + "typescript": "^4.8.4", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/access.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/access.proto new file mode 100644 index 00000000000..d30e670f5a6 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/access.proto @@ -0,0 +1,108 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "AccessProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Represents an access event. +message Access { + // Associated email, such as "foo@google.com". + // + // The email address of the authenticated user or a service account acting on + // behalf of a third party principal making the request. For third party + // identity callers, the `principal_subject` field is populated instead of + // this field. For privacy reasons, the principal email address is sometimes + // redacted. For more information, see [Caller identities in audit + // logs](https://cloud.google.com/logging/docs/audit#user-id). + string principal_email = 1; + + // Caller's IP address, such as "1.1.1.1". + string caller_ip = 2; + + // The caller IP's geolocation, which identifies where the call came from. + Geolocation caller_ip_geo = 3; + + // Type of user agent associated with the finding. For example, an operating + // system shell or an embedded or standalone application. + string user_agent_family = 4; + + // This is the API service that the service account made a call to, e.g. + // "iam.googleapis.com" + string service_name = 5; + + // The method that the service account called, e.g. "SetIamPolicy". + string method_name = 6; + + // A string that represents the principal_subject that is associated with the + // identity. Unlike `principal_email`, `principal_subject` supports principals + // that aren't associated with email addresses, such as third party + // principals. For most identities, the format is + // `principal://iam.googleapis.com/{identity pool name}/subject/{subject}`. + // Some GKE identities, such as GKE_WORKLOAD, FREEFORM, and GKE_HUB_WORKLOAD, + // still use the legacy format `serviceAccount:{identity pool + // name}[{subject}]`. + string principal_subject = 7; + + // The name of the service account key that was used to create or exchange + // credentials when authenticating the service account that made the request. + // This is a scheme-less URI full resource name. For example: + // + // "//iam.googleapis.com/projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}". + // + string service_account_key_name = 8; + + // The identity delegation history of an authenticated service account that + // made the request. The `serviceAccountDelegationInfo[]` object contains + // information about the real authorities that try to access Google Cloud + // resources by delegating on a service account. When multiple authorities are + // present, they are guaranteed to be sorted based on the original ordering of + // the identity delegation events. + repeated ServiceAccountDelegationInfo service_account_delegation_info = 9; + + // A string that represents a username. The username provided depends on the + // type of the finding and is likely not an IAM principal. For example, this + // can be a system username if the finding is related to a virtual machine, or + // it can be an application login username. + string user_name = 11; +} + +// Identity delegation history of an authenticated service account. +message ServiceAccountDelegationInfo { + // The email address of a Google account. + string principal_email = 1; + + // A string representing the principal_subject associated with the identity. + // As compared to `principal_email`, supports principals that aren't + // associated with email addresses, such as third party principals. For most + // identities, the format will be `principal://iam.googleapis.com/{identity + // pool name}/subjects/{subject}` except for some GKE identities + // (GKE_WORKLOAD, FREEFORM, GKE_HUB_WORKLOAD) that are still in the legacy + // format `serviceAccount:{identity pool name}[{subject}]` + string principal_subject = 2; +} + +// Represents a geographical location for a given access. +message Geolocation { + // A CLDR. + string region_code = 1; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/asset.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/asset.proto new file mode 100644 index 00000000000..01462175af3 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/asset.proto @@ -0,0 +1,134 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1/folder.proto"; +import "google/cloud/securitycenter/v1/security_marks.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Security Command Center representation of a Google Cloud +// resource. +// +// The Asset is a Security Command Center resource that captures information +// about a single Google Cloud resource. All modifications to an Asset are only +// within the context of Security Command Center and don't affect the referenced +// Google Cloud resource. +message Asset { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/Asset" + pattern: "organizations/{organization}/assets/{asset}" + pattern: "folders/{folder}/assets/{asset}" + pattern: "projects/{project}/assets/{asset}" + }; + + // Security Command Center managed properties. These properties are managed by + // Security Command Center and cannot be modified by the user. + message SecurityCenterProperties { + // The full resource name of the Google Cloud resource this asset + // represents. This field is immutable after create time. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_name = 1; + + // The type of the Google Cloud resource. Examples include: APPLICATION, + // PROJECT, and ORGANIZATION. This is a case insensitive field defined by + // Security Command Center and/or the producer of the resource and is + // immutable after create time. + string resource_type = 2; + + // The full resource name of the immediate parent of the resource. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_parent = 3; + + // The full resource name of the project the resource belongs to. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_project = 4; + + // Owners of the Google Cloud resource. + repeated string resource_owners = 5; + + // The user defined display name for this resource. + string resource_display_name = 6; + + // The user defined display name for the parent of this resource. + string resource_parent_display_name = 7; + + // The user defined display name for the project of this resource. + string resource_project_display_name = 8; + + // Contains a Folder message for each folder in the assets ancestry. + // The first folder is the deepest nested folder, and the last folder is the + // folder directly under the Organization. + repeated Folder folders = 10; + } + + // Cloud IAM Policy information associated with the Google Cloud resource + // described by the Security Command Center asset. This information is managed + // and defined by the Google Cloud resource and cannot be modified by the + // user. + message IamPolicy { + // The JSON representation of the Policy associated with the asset. + // See https://cloud.google.com/iam/reference/rest/v1/Policy for format + // details. + string policy_blob = 1; + } + + // The relative resource name of this asset. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/assets/{asset_id}". + string name = 1; + + // Security Command Center managed properties. These properties are managed by + // Security Command Center and cannot be modified by the user. + SecurityCenterProperties security_center_properties = 2; + + // Resource managed properties. These properties are managed and defined by + // the Google Cloud resource and cannot be modified by the user. + map resource_properties = 7; + + // User specified security marks. These marks are entirely managed by the user + // and come from the SecurityMarks resource that belongs to the asset. + SecurityMarks security_marks = 8; + + // The time at which the asset was created in Security Command Center. + google.protobuf.Timestamp create_time = 9; + + // The time at which the asset was last updated or added in Cloud SCC. + google.protobuf.Timestamp update_time = 10; + + // Cloud IAM Policy information associated with the Google Cloud resource + // described by the Security Command Center asset. This information is managed + // and defined by the Google Cloud resource and cannot be modified by the + // user. + IamPolicy iam_policy = 11; + + // The canonical name of the resource. It's either + // "organizations/{organization_id}/assets/{asset_id}", + // "folders/{folder_id}/assets/{asset_id}" or + // "projects/{project_number}/assets/{asset_id}", depending on the closest CRM + // ancestor of the resource. + string canonical_name = 13; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/bigquery_export.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/bigquery_export.proto new file mode 100644 index 00000000000..8299f05e49f --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/bigquery_export.proto @@ -0,0 +1,101 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "BigQueryExportProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Configures how to deliver Findings to BigQuery Instance. +message BigQueryExport { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/BigQueryExport" + pattern: "organizations/{organization}/bigQueryExports/{export}" + pattern: "folders/{folder}/bigQueryExports/{export}" + pattern: "projects/{project}/bigQueryExports/{export}" + }; + + // 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. + string name = 1; + + // The description of the export (max of 1024 characters). + string description = 2; + + // 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. + string filter = 3; + + // 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 (_). + string dataset = 4; + + // Output only. The time at which the BigQuery export was created. + // This field is set by the server and will be ignored if provided on export + // on creation. + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The most recent time at which the BigQuery export was updated. + // This field is set by the server and will be ignored if provided on export + // creation or update. + google.protobuf.Timestamp update_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Email address of the user who last edited the BigQuery export. + // This field is set by the server and will be ignored if provided on export + // creation or update. + string most_recent_editor = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The service account that needs permission to create table and + // upload data to the BigQuery dataset. + string principal = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/cloud_dlp_data_profile.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/cloud_dlp_data_profile.proto new file mode 100644 index 00000000000..2a513f1dc03 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/cloud_dlp_data_profile.proto @@ -0,0 +1,42 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudDlpDataProfileProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; +option (google.api.resource_definition) = { + type: "dlp.googleapis.com/TableDataProfile" + pattern: "projects/{project}/tableProfiles/{table_profile}" + pattern: "projects/{project}/locations/{location}/tableProfiles/{table_profile}" +}; + +// The [data profile](https://cloud.google.com/dlp/docs/data-profiles) +// associated with the finding. +message CloudDlpDataProfile { + // Name of the data profile, for example, + // `projects/123/locations/europe/tableProfiles/8383929`. + string data_profile = 1 [(google.api.resource_reference) = { + type: "dlp.googleapis.com/TableDataProfile" + }]; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/cloud_dlp_inspection.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/cloud_dlp_inspection.proto new file mode 100644 index 00000000000..5d76ee71ee9 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/cloud_dlp_inspection.proto @@ -0,0 +1,54 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudDlpInspectionProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; +option (google.api.resource_definition) = { + type: "dlp.googleapis.com/DlpJob" + pattern: "projects/{project}/dlpJobs/{dlp_job}" + pattern: "projects/{project}/locations/{location}/dlpJobs/{dlp_job}" +}; + +// Details about the Cloud Data Loss Prevention (Cloud DLP) [inspection +// job](https://cloud.google.com/dlp/docs/concepts-job-triggers) that produced +// the finding. +message CloudDlpInspection { + // Name of the inspection job, for example, + // `projects/123/locations/europe/dlpJobs/i-8383929`. + string inspect_job = 1 + [(google.api.resource_reference) = { type: "dlp.googleapis.com/DlpJob" }]; + + // The [type of + // information](https://cloud.google.com/dlp/docs/infotypes-reference) found, + // for example, `EMAIL_ADDRESS` or `STREET_ADDRESS`. + string info_type = 2; + + // The number of times Cloud DLP found this infoType within this job + // and resource. + int64 info_type_count = 3; + + // Whether Cloud DLP scanned the complete resource or a sampled subset. + bool full_scan = 4; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/compliance.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/compliance.proto new file mode 100644 index 00000000000..bc183bb5e37 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/compliance.proto @@ -0,0 +1,39 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "ComplianceProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Contains compliance information about a security standard indicating unmet +// recommendations. +message Compliance { + // Refers to industry wide standards or benchmarks e.g. "cis", "pci", "owasp", + // etc. + string standard = 1; + + // Version of the standard/benchmark e.g. 1.1 + string version = 2; + + // Policies within the standard/benchmark e.g. A.12.4.1 + repeated string ids = 3; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/connection.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/connection.proto new file mode 100644 index 00000000000..43a2115674c --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/connection.proto @@ -0,0 +1,66 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "ConnectionProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Contains information about the IP connection associated with the finding. +message Connection { + // IANA Internet Protocol Number such as TCP(6) and UDP(17). + enum Protocol { + // Unspecified protocol (not HOPOPT). + PROTOCOL_UNSPECIFIED = 0; + + // Internet Control Message Protocol. + ICMP = 1; + + // Transmission Control Protocol. + TCP = 6; + + // User Datagram Protocol. + UDP = 17; + + // Generic Routing Encapsulation. + GRE = 47; + + // Encap Security Payload. + ESP = 50; + } + + // Destination IP address. Not present for sockets that are listening and not + // connected. + string destination_ip = 1; + + // Destination port. Not present for sockets that are listening and not + // connected. + int32 destination_port = 2; + + // Source IP address. + string source_ip = 3; + + // Source port. + int32 source_port = 4; + + // IANA Internet Protocol Number such as TCP(6) and UDP(17). + Protocol protocol = 5; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/contact_details.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/contact_details.proto new file mode 100644 index 00000000000..741ad8fae1d --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/contact_details.proto @@ -0,0 +1,37 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "ContactDetailsProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// The details pertaining to specific contacts +message ContactDetails { + // A list of contacts + repeated Contact contacts = 1; +} + +// The email address of a contact. +message Contact { + // An email address. For example, "`person123@company.com`". + string email = 1; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/container.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/container.proto new file mode 100644 index 00000000000..c90168991f6 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/container.proto @@ -0,0 +1,45 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/cloud/securitycenter/v1/label.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "ContainerProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Container associated with the finding. +message Container { + // Container name. + string name = 1; + + // Container image URI provided when configuring a pod/container. + // May identify a container image version using mutable tags. + string uri = 2; + + // Optional container image id, when provided by the container runtime. + // Uniquely identifies the container image launched using a container image + // digest. + string image_id = 3; + + // Container labels, as provided by the container runtime. + repeated Label labels = 4; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/database.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/database.proto new file mode 100644 index 00000000000..70bf3516103 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/database.proto @@ -0,0 +1,52 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "DatabaseProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Represents database access information, such as queries. +// A database may be a sub-resource of an instance (as in the case of CloudSQL +// instances or Cloud Spanner instances), or the database instance itself. +// Some database resources may not have the full resource name populated +// because these resource types are not yet supported by Cloud Asset Inventory +// (e.g. CloudSQL databases). In these cases only the display name will be +// provided. +message Database { + // The full resource name of the database the user connected to, if it is + // supported by CAI. (https://google.aip.dev/122#full-resource-names) + string name = 1; + + // The human readable name of the database the user connected to. + string display_name = 2; + + // The username used to connect to the DB. This may not necessarily be an IAM + // principal, and has no required format. + string user_name = 3; + + // The SQL statement associated with the relevant access. + string query = 4; + + // The target usernames/roles/groups of a SQL privilege grant (not an IAM + // policy change). + repeated string grantees = 5; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/effective_security_health_analytics_custom_module.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/effective_security_health_analytics_custom_module.proto new file mode 100644 index 00000000000..3c5cc8af3b0 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/effective_security_health_analytics_custom_module.proto @@ -0,0 +1,81 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1/security_health_analytics_custom_config.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "EffectiveSecurityHealthAnalyticsCustomModuleProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// An EffectiveSecurityHealthAnalyticsCustomModule is the representation of +// a Security Health Analytics custom module at a specified level of the +// resource hierarchy: organization, folder, or project. If a custom module is +// inherited from a parent organization or folder, the value of the +// `enablementState` property in EffectiveSecurityHealthAnalyticsCustomModule is +// set to the value that is effective in the parent, instead of `INHERITED`. +// For example, if the module is enabled in a parent organization or folder, the +// effective enablement_state for the module in all child folders or projects is +// also `enabled`. EffectiveSecurityHealthAnalyticsCustomModule is read-only. +message EffectiveSecurityHealthAnalyticsCustomModule { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/EffectiveSecurityHealthAnalyticsCustomModule" + pattern: "organizations/{organization}/securityHealthAnalyticsSettings/effectiveCustomModules/{effective_custom_module}" + pattern: "folders/{folder}/securityHealthAnalyticsSettings/effectiveCustomModules/{effective_custom_module}" + pattern: "projects/{project}/securityHealthAnalyticsSettings/effectiveCustomModules/{effective_custom_module}" + }; + + // The enablement state of the module. + enum EnablementState { + // Unspecified enablement state. + ENABLEMENT_STATE_UNSPECIFIED = 0; + + // The module is enabled at the given level. + ENABLED = 1; + + // The module is disabled at the given level. + DISABLED = 2; + } + + // Output only. The resource name of the custom module. + // Its format is + // "organizations/{organization}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}", + // or + // "folders/{folder}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}", + // or + // "projects/{project}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}" + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The user-specified configuration for the module. + CustomConfig custom_config = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The effective state of enablement for the module at the given + // level of the hierarchy. + EnablementState enablement_state = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The display name for the custom module. The name must be + // between 1 and 128 characters, start with a lowercase letter, and contain + // alphanumeric characters or underscores only. + string display_name = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/exfiltration.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/exfiltration.proto new file mode 100644 index 00000000000..4c3735dedf2 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/exfiltration.proto @@ -0,0 +1,52 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "ExfiltrationProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Exfiltration represents a data exfiltration attempt of one or more +// sources to one or more targets. Sources represent the source +// of data that is exfiltrated, and Targets represents the destination the +// data was copied to. +message Exfiltration { + // If there are multiple sources, then the data is considered "joined" between + // them. For instance, BigQuery can join multiple tables, and each + // table would be considered a source. + repeated ExfilResource sources = 1; + + // If there are multiple targets, each target would get a complete copy of the + // "joined" source data. + repeated ExfilResource targets = 2; +} + +// Resource that has been exfiltrated or exfiltrated_to. +message ExfilResource { + // Resource's URI (https://google.aip.dev/122#full-resource-names) + string name = 1; + + // Subcomponents of the asset that is exfiltrated - these could be + // URIs used during exfiltration, table names, databases, filenames, etc. + // For example, multiple tables may be exfiltrated from the same CloudSQL + // instance, or multiple files from the same Cloud Storage bucket. + repeated string components = 2; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/external_system.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/external_system.proto new file mode 100644 index 00000000000..0e23d6a675f --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/external_system.proto @@ -0,0 +1,58 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "ExternalSystemProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Representation of third party SIEM/SOAR fields within SCC. +message ExternalSystem { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/ExternalSystem" + pattern: "organizations/{organization}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}" + pattern: "folders/{folder}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}" + pattern: "projects/{project}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}" + }; + + // Full resource name of the external system, for example: + // "organizations/1234/sources/5678/findings/123456/externalSystems/jira", + // "folders/1234/sources/5678/findings/123456/externalSystems/jira", + // "projects/1234/sources/5678/findings/123456/externalSystems/jira" + string name = 1; + + // References primary/secondary etc assignees in the external system. + repeated string assignees = 2; + + // Identifier that's used to track the given finding in the external system. + string external_uid = 3; + + // Most recent status of the corresponding finding's ticket/tracker in the + // external system. + string status = 4; + + // The most recent time when the corresponding finding's ticket/tracker was + // updated in the external system. + google.protobuf.Timestamp external_system_update_time = 5; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/file.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/file.proto new file mode 100644 index 00000000000..4d7a459590c --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/file.proto @@ -0,0 +1,52 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "FileProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// File information about the related binary/library used by an executable, or +// the script used by a script interpreter +message File { + // Absolute path of the file as a JSON encoded string. + string path = 1; + + // Size of the file in bytes. + int64 size = 2; + + // SHA256 hash of the first hashed_size bytes of the file encoded as a + // hex string. If hashed_size == size, sha256 represents the SHA256 hash + // of the entire file. + string sha256 = 3; + + // The length in bytes of the file prefix that was hashed. If + // hashed_size == size, any hashes reported represent the entire + // file. + int64 hashed_size = 4; + + // True when the hash covers only a prefix of the file. + bool partially_hashed = 5; + + // Prefix of the file contents as a JSON encoded string. + // (Currently only populated for Malicious Script Executed findings.) + string contents = 6; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/finding.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/finding.proto new file mode 100644 index 00000000000..b57b7be4e7a --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/finding.proto @@ -0,0 +1,362 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1/access.proto"; +import "google/cloud/securitycenter/v1/cloud_dlp_data_profile.proto"; +import "google/cloud/securitycenter/v1/cloud_dlp_inspection.proto"; +import "google/cloud/securitycenter/v1/compliance.proto"; +import "google/cloud/securitycenter/v1/connection.proto"; +import "google/cloud/securitycenter/v1/contact_details.proto"; +import "google/cloud/securitycenter/v1/container.proto"; +import "google/cloud/securitycenter/v1/database.proto"; +import "google/cloud/securitycenter/v1/exfiltration.proto"; +import "google/cloud/securitycenter/v1/external_system.proto"; +import "google/cloud/securitycenter/v1/file.proto"; +import "google/cloud/securitycenter/v1/iam_binding.proto"; +import "google/cloud/securitycenter/v1/indicator.proto"; +import "google/cloud/securitycenter/v1/kernel_rootkit.proto"; +import "google/cloud/securitycenter/v1/kubernetes.proto"; +import "google/cloud/securitycenter/v1/mitre_attack.proto"; +import "google/cloud/securitycenter/v1/process.proto"; +import "google/cloud/securitycenter/v1/security_marks.proto"; +import "google/cloud/securitycenter/v1/vulnerability.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Security Command Center finding. +// +// A finding is a record of assessment data like security, risk, health, or +// privacy, that is ingested into Security Command Center for presentation, +// notification, analysis, policy testing, and enforcement. For example, a +// cross-site scripting (XSS) vulnerability in an App Engine application is a +// finding. +message Finding { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/Finding" + pattern: "organizations/{organization}/sources/{source}/findings/{finding}" + pattern: "folders/{folder}/sources/{source}/findings/{finding}" + pattern: "projects/{project}/sources/{source}/findings/{finding}" + }; + + // The state of the finding. + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // The finding requires attention and has not been addressed yet. + ACTIVE = 1; + + // The finding has been fixed, triaged as a non-issue or otherwise addressed + // and is no longer active. + INACTIVE = 2; + } + + // The severity of the finding. + enum Severity { + // This value is used for findings when a source doesn't write a severity + // value. + SEVERITY_UNSPECIFIED = 0; + + // Vulnerability: + // A critical vulnerability is easily discoverable by an external actor, + // exploitable, and results in the direct ability to execute arbitrary code, + // exfiltrate data, and otherwise gain additional access and privileges to + // cloud resources and workloads. Examples include publicly accessible + // unprotected user data and public SSH access with weak or no + // passwords. + // + // Threat: + // Indicates a threat that is able to access, modify, or delete data or + // execute unauthorized code within existing resources. + CRITICAL = 1; + + // Vulnerability: + // A high risk vulnerability can be easily discovered and exploited in + // combination with other vulnerabilities in order to gain direct access and + // the ability to execute arbitrary code, exfiltrate data, and otherwise + // gain additional access and privileges to cloud resources and workloads. + // An example is a database with weak or no passwords that is only + // accessible internally. This database could easily be compromised by an + // actor that had access to the internal network. + // + // Threat: + // Indicates a threat that is able to create new computational resources in + // an environment but not able to access data or execute code in existing + // resources. + HIGH = 2; + + // Vulnerability: + // A medium risk vulnerability could be used by an actor to gain access to + // resources or privileges that enable them to eventually (through multiple + // steps or a complex exploit) gain access and the ability to execute + // arbitrary code or exfiltrate data. An example is a service account with + // access to more projects than it should have. If an actor gains access to + // the service account, they could potentially use that access to manipulate + // a project the service account was not intended to. + // + // Threat: + // Indicates a threat that is able to cause operational impact but may not + // access data or execute unauthorized code. + MEDIUM = 3; + + // Vulnerability: + // A low risk vulnerability hampers a security organization's ability to + // detect vulnerabilities or active threats in their deployment, or prevents + // the root cause investigation of security issues. An example is monitoring + // and logs being disabled for resource configurations and access. + // + // Threat: + // Indicates a threat that has obtained minimal access to an environment but + // is not able to access data, execute code, or create resources. + LOW = 4; + } + + // Mute state a finding can be in. + enum Mute { + // Unspecified. + MUTE_UNSPECIFIED = 0; + + // Finding has been muted. + MUTED = 1; + + // Finding has been unmuted. + UNMUTED = 2; + + // Finding has never been muted/unmuted. + UNDEFINED = 4; + } + + // Represents what kind of Finding it is. + enum FindingClass { + // Unspecified finding class. + FINDING_CLASS_UNSPECIFIED = 0; + + // Describes unwanted or malicious activity. + THREAT = 1; + + // Describes a potential weakness in software that increases risk to + // Confidentiality & Integrity & Availability. + VULNERABILITY = 2; + + // Describes a potential weakness in cloud resource/asset configuration that + // increases risk. + MISCONFIGURATION = 3; + + // Describes a security observation that is for informational purposes. + OBSERVATION = 4; + + // Describes an error that prevents some SCC functionality. + SCC_ERROR = 5; + } + + // The [relative resource + // name](https://cloud.google.com/apis/design/resource_names#relative_resource_name) + // of the finding. Example: + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", + // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}", + // "projects/{project_id}/sources/{source_id}/findings/{finding_id}". + string name = 1; + + // The relative resource name of the source the finding belongs to. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // This field is immutable after creation time. + // For example: + // "organizations/{organization_id}/sources/{source_id}" + string parent = 2; + + // For findings on Google Cloud resources, the full resource + // name of the Google Cloud resource this finding is for. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + // When the finding is for a non-Google Cloud resource, the resourceName can + // be a customer or partner defined string. This field is immutable after + // creation time. + string resource_name = 3; + + // The state of the finding. + State state = 4; + + // The additional taxonomy group within findings from a given source. + // This field is immutable after creation time. + // Example: "XSS_FLASH_INJECTION" + string category = 5; + + // The URI that, if available, points to a web page outside of Security + // Command Center where additional information about the finding can be found. + // This field is guaranteed to be either empty or a well formed URL. + string external_uri = 6; + + // Source specific properties. These properties are managed by the source + // that writes the finding. The key names in the source_properties map must be + // between 1 and 255 characters, and must start with a letter and contain + // alphanumeric characters or underscores only. + map source_properties = 7; + + // Output only. User specified security marks. These marks are entirely + // managed by the user and come from the SecurityMarks resource that belongs + // to the finding. + SecurityMarks security_marks = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The time the finding was first detected. If an existing finding is updated, + // then this is the time the update occurred. + // For example, if the finding represents an open firewall, this property + // captures the time the detector believes the firewall became open. The + // accuracy is determined by the detector. If the finding is later resolved, + // then this time reflects when the finding was resolved. This must not + // be set to a value greater than the current timestamp. + google.protobuf.Timestamp event_time = 9; + + // The time at which the finding was created in Security Command Center. + google.protobuf.Timestamp create_time = 10; + + // The severity of the finding. This field is managed by the source that + // writes the finding. + Severity severity = 12; + + // The canonical name of the finding. It's either + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", + // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}" or + // "projects/{project_number}/sources/{source_id}/findings/{finding_id}", + // depending on the closest CRM ancestor of the resource associated with the + // finding. + string canonical_name = 14; + + // Indicates the mute state of a finding (either muted, unmuted + // or undefined). Unlike other attributes of a finding, a finding provider + // shouldn't set the value of mute. + Mute mute = 15; + + // The class of the finding. + FindingClass finding_class = 17; + + // Represents what's commonly known as an *indicator of compromise* (IoC) in + // computer forensics. This is an artifact observed on a network or in an + // operating system that, with high confidence, indicates a computer + // intrusion. For more information, see [Indicator of + // compromise](https://en.wikipedia.org/wiki/Indicator_of_compromise). + Indicator indicator = 18; + + // Represents vulnerability-specific fields like CVE and CVSS scores. + // CVE stands for Common Vulnerabilities and Exposures + // (https://cve.mitre.org/about/) + Vulnerability vulnerability = 20; + + // Output only. The most recent time this finding was muted or unmuted. + google.protobuf.Timestamp mute_update_time = 21 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Third party SIEM/SOAR fields within SCC, contains external + // system information and external system finding fields. + map external_systems = 22 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // MITRE ATT&CK tactics and techniques related to this finding. + // See: https://attack.mitre.org + MitreAttack mitre_attack = 25; + + // Access details associated with the finding, such as more information on the + // caller, which method was accessed, and from where. + Access access = 26; + + // Contains information about the IP connection associated with the finding. + repeated Connection connections = 31; + + // Records additional information about the mute operation, for example, the + // [mute configuration](/security-command-center/docs/how-to-mute-findings) + // that muted the finding and the user who muted the finding. + string mute_initiator = 28; + + // Represents operating system processes associated with the Finding. + repeated Process processes = 30; + + // Output only. Map containing the points of contact for the given finding. + // The key represents the type of contact, while the value contains a list of + // all the contacts that pertain. Please refer to: + // https://cloud.google.com/resource-manager/docs/managing-notification-contacts#notification-categories + // + // { + // "security": { + // "contacts": [ + // { + // "email": "person1@company.com" + // }, + // { + // "email": "person2@company.com" + // } + // ] + // } + // } + map contacts = 33 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Contains compliance information for security standards associated to the + // finding. + repeated Compliance compliances = 34; + + // Output only. The human readable display name of the finding source such as + // "Event Threat Detection" or "Security Health Analytics". + string parent_display_name = 36 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Contains more details about the finding. + string description = 37; + + // Represents exfiltrations associated with the finding. + Exfiltration exfiltration = 38; + + // Represents IAM bindings associated with the finding. + repeated IamBinding iam_bindings = 39; + + // Steps to address the finding. + string next_steps = 40; + + // Unique identifier of the module which generated the finding. + // Example: + // folders/598186756061/securityHealthAnalyticsSettings/customModules/56799441161885 + string module_name = 41; + + // Containers associated with the finding. This field provides information for + // both Kubernetes and non-Kubernetes containers. + repeated Container containers = 42; + + // Kubernetes resources associated with the finding. + Kubernetes kubernetes = 43; + + // Database associated with the finding. + Database database = 44; + + // File associated with the finding. + repeated File files = 46; + + // Cloud Data Loss Prevention (Cloud DLP) inspection results that are + // associated with the finding. + CloudDlpInspection cloud_dlp_inspection = 48; + + // Cloud DLP data profile that is associated with the finding. + CloudDlpDataProfile cloud_dlp_data_profile = 49; + + // Signature of the kernel rootkit. + KernelRootkit kernel_rootkit = 50; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/folder.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/folder.proto new file mode 100644 index 00000000000..e809154231c --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/folder.proto @@ -0,0 +1,36 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "FolderProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Message that contains the resource name and display name of a folder +// resource. +message Folder { + // Full resource name of this folder. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_folder = 1; + + // The user defined display name for this folder. + string resource_folder_display_name = 2; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/iam_binding.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/iam_binding.proto new file mode 100644 index 00000000000..533ac4bdadc --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/iam_binding.proto @@ -0,0 +1,52 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "IamBindingProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Represents a particular IAM binding, which captures a member's role addition, +// removal, or state. +message IamBinding { + // The type of action performed on a Binding in a policy. + enum Action { + // Unspecified. + ACTION_UNSPECIFIED = 0; + + // Addition of a Binding. + ADD = 1; + + // Removal of a Binding. + REMOVE = 2; + } + + // The action that was performed on a Binding. + Action action = 1; + + // Role that is assigned to "members". + // For example, "roles/viewer", "roles/editor", or "roles/owner". + string role = 2; + + // A single identity requesting access for a Cloud Platform resource, + // e.g. "foo@google.com". + string member = 3; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/indicator.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/indicator.proto new file mode 100644 index 00000000000..f36e8b4872d --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/indicator.proto @@ -0,0 +1,83 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "IndicatorProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Represents what's commonly known as an _indicator of compromise_ (IoC) in +// computer forensics. This is an artifact observed on a network or in an +// operating system that, with high confidence, indicates a computer intrusion. +// For more information, see [Indicator of +// compromise](https://en.wikipedia.org/wiki/Indicator_of_compromise). +message Indicator { + // Indicates what signature matched this process. + message ProcessSignature { + // A signature corresponding to memory page hashes. + message MemoryHashSignature { + // Memory hash detection contributing to the binary family match. + message Detection { + // The name of the binary associated with the memory hash + // signature detection. + string binary = 2; + + // The percentage of memory page hashes in the signature + // that were matched. + double percent_pages_matched = 3; + } + + // The binary family. + string binary_family = 1; + + // The list of memory hash detections contributing to the binary family + // match. + repeated Detection detections = 4; + } + + // A signature corresponding to a YARA rule. + message YaraRuleSignature { + // The name of the YARA rule. + string yara_rule = 5; + } + + oneof signature { + // Signature indicating that a binary family was matched. + MemoryHashSignature memory_hash_signature = 6; + + // Signature indicating that a YARA rule was matched. + YaraRuleSignature yara_rule_signature = 7; + } + } + + // The list of IP addresses that are associated with the finding. + repeated string ip_addresses = 1; + + // List of domains associated to the Finding. + repeated string domains = 2; + + // The list of matched signatures indicating that the given + // process is present in the environment. + repeated ProcessSignature signatures = 3; + + // The list of URIs associated to the Findings. + repeated string uris = 4; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/kernel_rootkit.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/kernel_rootkit.proto new file mode 100644 index 00000000000..6af2840bf06 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/kernel_rootkit.proto @@ -0,0 +1,62 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "KernelRootkitProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Kernel mode rootkit signatures. +message KernelRootkit { + // Rootkit name when available. + string name = 1; + + // True when unexpected modifications of kernel code memory are present. + bool unexpected_code_modification = 2; + + // True when unexpected modifications of kernel read-only data memory are + // present. + bool unexpected_read_only_data_modification = 3; + + // True when `ftrace` points are present with callbacks pointing to regions + // that are not in the expected kernel or module code range. + bool unexpected_ftrace_handler = 4; + + // True when `kprobe` points are present with callbacks pointing to regions + // that are not in the expected kernel or module code range. + bool unexpected_kprobe_handler = 5; + + // True when kernel code pages that are not in the expected kernel or module + // code regions are present. + bool unexpected_kernel_code_pages = 6; + + // True when system call handlers that are are not in the expected kernel or + // module code regions are present. + bool unexpected_system_call_handler = 7; + + // True when interrupt handlers that are are not in the expected kernel or + // module code regions are present. + bool unexpected_interrupt_handler = 8; + + // True when unexpected processes in the scheduler run queue are present. Such + // processes are in the run queue, but not in the process task list. + bool unexpected_processes_in_runqueue = 9; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/kubernetes.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/kubernetes.proto new file mode 100644 index 00000000000..ac1df835116 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/kubernetes.proto @@ -0,0 +1,181 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/cloud/securitycenter/v1/container.proto"; +import "google/cloud/securitycenter/v1/label.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "KubernetesProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Kubernetes-related attributes. +message Kubernetes { + // Kubernetes Pod. + message Pod { + // Kubernetes Pod namespace. + string ns = 1; + + // Kubernetes Pod name. + string name = 2; + + // Pod labels. For Kubernetes containers, these are applied to the + // container. + repeated Label labels = 3; + + // Pod containers associated with this finding, if any. + repeated Container containers = 4; + } + + // Kubernetes Nodes associated with the finding. + message Node { + // Full Resource name of the Compute Engine VM running the + // cluster node. + string name = 1; + } + + // Provides GKE Node Pool information. + message NodePool { + // Kubernetes Node pool name. + string name = 1; + + // Nodes associated with the finding. + repeated Node nodes = 2; + } + + // Kubernetes Role or ClusterRole. + message Role { + // Types of Kubernetes roles. + enum Kind { + // Role type is not specified. + KIND_UNSPECIFIED = 0; + + // Kubernetes Role. + ROLE = 1; + + // Kubernetes ClusterRole. + CLUSTER_ROLE = 2; + } + + // Role type. + Kind kind = 1; + + // Role namespace. + string ns = 2; + + // Role name. + string name = 3; + } + + // Represents a Kubernetes RoleBinding or ClusterRoleBinding. + message Binding { + // Namespace for binding. + string ns = 1; + + // Name for binding. + string name = 2; + + // The Role or ClusterRole referenced by the binding. + Role role = 3; + + // Represents one or more subjects that are bound to the role. Not always + // available for PATCH requests. + repeated Subject subjects = 4; + } + + // Represents a Kubernetes Subject. + message Subject { + // Auth types that can be used for Subject's kind field. + enum AuthType { + // Authentication is not specified. + AUTH_TYPE_UNSPECIFIED = 0; + + // User with valid certificate. + USER = 1; + + // Users managed by Kubernetes API with credentials stored as Secrets. + SERVICEACCOUNT = 2; + + // Collection of users. + GROUP = 3; + } + + // Authentication type for subject. + AuthType kind = 1; + + // Namespace for subject. + string ns = 2; + + // Name for subject. + string name = 3; + } + + // Conveys information about a Kubernetes access review (e.g. kubectl auth + // can-i ...) that was involved in a finding. + message AccessReview { + // Group is the API Group of the Resource. "*" means all. + string group = 1; + + // Namespace of the action being requested. Currently, there is no + // distinction between no namespace and all namespaces. Both + // are represented by "" (empty). + string ns = 2; + + // Name is the name of the resource being requested. Empty means all. + string name = 3; + + // Resource is the optional resource type requested. "*" means all. + string resource = 4; + + // Subresource is the optional subresource type. + string subresource = 5; + + // Verb is a Kubernetes resource API verb, like: get, list, watch, create, + // update, delete, proxy. "*" means all. + string verb = 6; + + // Version is the API Version of the Resource. "*" means all. + string version = 7; + } + + // Kubernetes Pods associated with the finding. This field will contain Pod + // records for each container that is owned by a Pod. + repeated Pod pods = 1; + + // Provides Kubernetes Node information. + repeated Node nodes = 2; + + // GKE Node Pools associated with the finding. This field will + // contain NodePool information for each Node, when it is available. + repeated NodePool node_pools = 3; + + // Provides Kubernetes role information for findings that involve + // Roles or ClusterRoles. + repeated Role roles = 4; + + // Provides Kubernetes role binding information for findings that involve + // RoleBindings or ClusterRoleBindings. + repeated Binding bindings = 5; + + // Provides information on any Kubernetes access reviews (i.e. privilege + // checks) relevant to the finding. + repeated AccessReview access_reviews = 6; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/label.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/label.proto new file mode 100644 index 00000000000..0760c82d840 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/label.proto @@ -0,0 +1,35 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "LabelProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Label represents a generic name=value label. Label has separate name and +// value fields to support filtering with contains(). +message Label { + // Label name. + string name = 1; + + // Label value. + string value = 2; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/mitre_attack.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/mitre_attack.proto new file mode 100644 index 00000000000..79425d2c60d --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/mitre_attack.proto @@ -0,0 +1,211 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "MitreAttackProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// MITRE ATT&CK tactics and techniques related to this finding. +// See: https://attack.mitre.org +message MitreAttack { + // MITRE ATT&CK tactics that can be referenced by SCC findings. + // See: https://attack.mitre.org/tactics/enterprise/ + enum Tactic { + // Unspecified value. + TACTIC_UNSPECIFIED = 0; + + // TA0043 + RECONNAISSANCE = 1; + + // TA0042 + RESOURCE_DEVELOPMENT = 2; + + // TA0001 + INITIAL_ACCESS = 5; + + // TA0002 + EXECUTION = 3; + + // TA0003 + PERSISTENCE = 6; + + // TA0004 + PRIVILEGE_ESCALATION = 8; + + // TA0005 + DEFENSE_EVASION = 7; + + // TA0006 + CREDENTIAL_ACCESS = 9; + + // TA0007 + DISCOVERY = 10; + + // TA0008 + LATERAL_MOVEMENT = 11; + + // TA0009 + COLLECTION = 12; + + // TA0011 + COMMAND_AND_CONTROL = 4; + + // TA0010 + EXFILTRATION = 13; + + // TA0040 + IMPACT = 14; + } + + // MITRE ATT&CK techniques that can be referenced by SCC findings. + // See: https://attack.mitre.org/techniques/enterprise/ + enum Technique { + // Unspecified value. + TECHNIQUE_UNSPECIFIED = 0; + + // T1595 + ACTIVE_SCANNING = 1; + + // T1595.001 + SCANNING_IP_BLOCKS = 2; + + // T1105 + INGRESS_TOOL_TRANSFER = 3; + + // T1106 + NATIVE_API = 4; + + // T1129 + SHARED_MODULES = 5; + + // T1059 + COMMAND_AND_SCRIPTING_INTERPRETER = 6; + + // T1059.004 + UNIX_SHELL = 7; + + // T1496 + RESOURCE_HIJACKING = 8; + + // T1090 + PROXY = 9; + + // T1090.002 + EXTERNAL_PROXY = 10; + + // T1090.003 + MULTI_HOP_PROXY = 11; + + // T1568 + DYNAMIC_RESOLUTION = 12; + + // T1552 + UNSECURED_CREDENTIALS = 13; + + // T1078 + VALID_ACCOUNTS = 14; + + // T1078.003 + LOCAL_ACCOUNTS = 15; + + // T1078.004 + CLOUD_ACCOUNTS = 16; + + // T1498 + NETWORK_DENIAL_OF_SERVICE = 17; + + // T1069 + PERMISSION_GROUPS_DISCOVERY = 18; + + // T1069.003 + CLOUD_GROUPS = 19; + + // T1567 + EXFILTRATION_OVER_WEB_SERVICE = 20; + + // T1567.002 + EXFILTRATION_TO_CLOUD_STORAGE = 21; + + // T1098 + ACCOUNT_MANIPULATION = 22; + + // T1098.004 + SSH_AUTHORIZED_KEYS = 23; + + // T1543 + CREATE_OR_MODIFY_SYSTEM_PROCESS = 24; + + // T1539 + STEAL_WEB_SESSION_COOKIE = 25; + + // T1578 + MODIFY_CLOUD_COMPUTE_INFRASTRUCTURE = 26; + + // T1190 + EXPLOIT_PUBLIC_FACING_APPLICATION = 27; + + // T1556 + MODIFY_AUTHENTICATION_PROCESS = 28; + + // T1485 + DATA_DESTRUCTION = 29; + + // T1484 + DOMAIN_POLICY_MODIFICATION = 30; + + // T1562 + IMPAIR_DEFENSES = 31; + + // T1046 + NETWORK_SERVICE_DISCOVERY = 32; + + // T1134 + ACCESS_TOKEN_MANIPULATION = 33; + + // T1548 + ABUSE_ELEVATION_CONTROL_MECHANISM = 34; + + // T1078.001 + DEFAULT_ACCOUNTS = 35; + } + + // The MITRE ATT&CK tactic most closely represented by this finding, if any. + Tactic primary_tactic = 1; + + // 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`). + repeated Technique primary_techniques = 2; + + // Additional MITRE ATT&CK tactics related to this finding, if any. + repeated Tactic additional_tactics = 3; + + // Additional MITRE ATT&CK techniques related to this finding, if any, along + // with any of their respective parent techniques. + repeated Technique additional_techniques = 4; + + // The MITRE ATT&CK version referenced by the above fields. E.g. "8". + string version = 5; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/mute_config.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/mute_config.proto new file mode 100644 index 00000000000..d2a8db68499 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/mute_config.proto @@ -0,0 +1,91 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "MuteConfigProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// A mute config is a Cloud SCC resource that contains the configuration +// to mute create/update events of findings. +message MuteConfig { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/MuteConfig" + pattern: "organizations/{organization}/muteConfigs/{mute_config}" + pattern: "folders/{folder}/muteConfigs/{mute_config}" + pattern: "projects/{project}/muteConfigs/{mute_config}" + }; + + // This field will be ignored if provided on config creation. Format + // "organizations/{organization}/muteConfigs/{mute_config}" + // "folders/{folder}/muteConfigs/{mute_config}" + // "projects/{project}/muteConfigs/{mute_config}" + string name = 1; + + // The human readable name to be displayed for the mute config. + string display_name = 2 [deprecated = true]; + + // A description of the mute config. + string description = 3; + + // Required. An expression that defines the filter to apply across + // create/update events of findings. While creating a filter string, be + // mindful of the scope in which the mute configuration is being created. + // E.g., If a filter contains project = X but is created under the project = Y + // scope, it might not match any findings. + // + // The following field and operator combinations are supported: + // + // * severity: `=`, `:` + // * category: `=`, `:` + // * resource.name: `=`, `:` + // * resource.project_name: `=`, `:` + // * resource.project_display_name: `=`, `:` + // * resource.folders.resource_folder: `=`, `:` + // * resource.parent_name: `=`, `:` + // * resource.parent_display_name: `=`, `:` + // * resource.type: `=`, `:` + // * finding_class: `=`, `:` + // * indicator.ip_addresses: `=`, `:` + // * indicator.domains: `=`, `:` + string filter = 4 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The time at which the mute config was created. + // This field is set by the server and will be ignored if provided on config + // creation. + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The most recent time at which the mute config was updated. + // This field is set by the server and will be ignored if provided on config + // creation or update. + google.protobuf.Timestamp update_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Email address of the user who last edited the mute config. + // This field is set by the server and will be ignored if provided on config + // creation or update. + string most_recent_editor = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/notification_config.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/notification_config.proto new file mode 100644 index 00000000000..de2a88b6bb1 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/notification_config.proto @@ -0,0 +1,99 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "NotificationConfigProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Topic" + pattern: "projects/{project}/topics/{topic}" +}; + +// Cloud Security Command Center (Cloud SCC) notification configs. +// +// A notification config is a Cloud SCC resource that contains the configuration +// to send notifications for create/update events of findings, assets and etc. +message NotificationConfig { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/NotificationConfig" + pattern: "organizations/{organization}/notificationConfigs/{notification_config}" + pattern: "folders/{folder}/notificationConfigs/{notification_config}" + pattern: "projects/{project}/notificationConfigs/{notification_config}" + }; + + // The config for streaming-based notifications, which send each event as soon + // as it is detected. + message StreamingConfig { + // Expression that defines the filter to apply across create/update events + // of assets or findings as specified by the event type. 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. + string filter = 1; + } + + // The relative resource name of this notification config. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/notificationConfigs/notify_public_bucket", + // "folders/{folder_id}/notificationConfigs/notify_public_bucket", + // or "projects/{project_id}/notificationConfigs/notify_public_bucket". + string name = 1; + + // The description of the notification config (max of 1024 characters). + string description = 2; + + // The Pub/Sub topic to send notifications to. Its format is + // "projects/[project_id]/topics/[topic]". + string pubsub_topic = 3 [ + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } + ]; + + // Output only. The service account that needs "pubsub.topics.publish" + // permission to publish to the Pub/Sub topic. + string service_account = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The config for triggering notifications. + oneof notify_config { + // The config for triggering streaming-based notifications. + StreamingConfig streaming_config = 5; + } +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/notification_message.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/notification_message.proto new file mode 100644 index 00000000000..59841d92ede --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/notification_message.proto @@ -0,0 +1,44 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/cloud/securitycenter/v1/finding.proto"; +import "google/cloud/securitycenter/v1/resource.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "NotificationMessageProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Cloud SCC's Notification +message NotificationMessage { + // Name of the notification config that generated current notification. + string notification_config_name = 1; + + // Notification Event. + oneof event { + // If it's a Finding based notification config, this field will be + // populated. + Finding finding = 2; + } + + // The Cloud resource tied to this notification's Finding. + Resource resource = 3; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/organization_settings.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/organization_settings.proto new file mode 100644 index 00000000000..66880a17c63 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/organization_settings.proto @@ -0,0 +1,85 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// User specified settings that are attached to the Security Command +// Center organization. +message OrganizationSettings { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/OrganizationSettings" + pattern: "organizations/{organization}/organizationSettings" + }; + + // The configuration used for Asset Discovery runs. + message AssetDiscoveryConfig { + // The mode of inclusion when running Asset Discovery. + // Asset discovery can be limited by explicitly identifying projects to be + // included or excluded. If INCLUDE_ONLY is set, then only those projects + // within the organization and their children are discovered during asset + // discovery. If EXCLUDE is set, then projects that don't match those + // projects are discovered during asset discovery. If neither are set, then + // all projects within the organization are discovered during asset + // discovery. + enum InclusionMode { + // Unspecified. Setting the mode with this value will disable + // inclusion/exclusion filtering for Asset Discovery. + INCLUSION_MODE_UNSPECIFIED = 0; + + // Asset Discovery will capture only the resources within the projects + // specified. All other resources will be ignored. + INCLUDE_ONLY = 1; + + // Asset Discovery will ignore all resources under the projects specified. + // All other resources will be retrieved. + EXCLUDE = 2; + } + + // The project ids to use for filtering asset discovery. + repeated string project_ids = 1; + + // The mode to use for filtering asset discovery. + InclusionMode inclusion_mode = 2; + + // The folder ids to use for filtering asset discovery. + // It consists of only digits, e.g., 756619654966. + repeated string folder_ids = 3; + } + + // The relative resource name of the settings. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/organizationSettings". + string name = 1; + + // A flag that indicates if Asset Discovery should be enabled. If the flag is + // set to `true`, then discovery of assets will occur. If it is set to `false, + // all historical assets will remain, but discovery of future assets will not + // occur. + bool enable_asset_discovery = 2; + + // The configuration used for Asset Discovery runs. + AssetDiscoveryConfig asset_discovery_config = 3; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/process.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/process.proto new file mode 100644 index 00000000000..3ec0a5c29f1 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/process.proto @@ -0,0 +1,74 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/cloud/securitycenter/v1/file.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "ProcessProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Represents an operating system process. +message Process { + // The process name visible in utilities like `top` and `ps`; it can + // be accessed via `/proc/[pid]/comm` and changed with `prctl(PR_SET_NAME)`. + string name = 12; + + // File information for the process executable. + File binary = 3; + + // File information for libraries loaded by the process. + repeated File libraries = 4; + + // When the process represents the invocation of a script, + // `binary` provides information about the interpreter while `script` + // provides information about the script file provided to the + // interpreter. + File script = 5; + + // Process arguments as JSON encoded strings. + repeated string args = 6; + + // True if `args` is incomplete. + bool arguments_truncated = 7; + + // Process environment variables. + repeated EnvironmentVariable env_variables = 8; + + // True if `env_variables` is incomplete. + bool env_variables_truncated = 9; + + // The process id. + int64 pid = 10; + + // The parent process id. + int64 parent_pid = 11; +} + +// EnvironmentVariable is a name-value pair to store environment variables for +// Process. +message EnvironmentVariable { + // Environment variable name as a JSON encoded string. + string name = 1; + + // Environment variable value as a JSON encoded string. + string val = 2; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/resource.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/resource.proto new file mode 100644 index 00000000000..626974ea962 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/resource.proto @@ -0,0 +1,58 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/field_behavior.proto"; +import "google/cloud/securitycenter/v1/folder.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "ResourceProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Information related to the Google Cloud resource. +message Resource { + // The full resource name of the resource. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string name = 1; + + // The human readable name of the resource. + string display_name = 8; + + // The full resource type of the resource. + string type = 6; + + // The full resource name of project that the resource belongs to. + string project = 2; + + // The project ID that the resource belongs to. + string project_display_name = 3; + + // The full resource name of resource's parent. + string parent = 4; + + // The human readable name of resource's parent. + string parent_display_name = 5; + + // Output only. Contains a Folder message for each folder in the assets + // ancestry. The first folder is the deepest nested folder, and the last + // folder is the folder directly under the Organization. + repeated Folder folders = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto new file mode 100644 index 00000000000..f331fb9ec78 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto @@ -0,0 +1,51 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/protobuf/duration.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Response of asset discovery run +message RunAssetDiscoveryResponse { + // The state of an asset discovery run. + enum State { + // Asset discovery run state was unspecified. + STATE_UNSPECIFIED = 0; + + // Asset discovery run completed successfully. + COMPLETED = 1; + + // Asset discovery run was cancelled with tasks still pending, as another + // run for the same organization was started with a higher priority. + SUPERSEDED = 2; + + // Asset discovery run was killed and terminated. + TERMINATED = 3; + } + + // The state of an asset discovery run. + State state = 1; + + // The duration between asset discovery run start and end + google.protobuf.Duration duration = 2; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_health_analytics_custom_config.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_health_analytics_custom_config.proto new file mode 100644 index 00000000000..337f0a3bb3f --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_health_analytics_custom_config.proto @@ -0,0 +1,101 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/type/expr.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "SecurityHealthAnalyticsCustomConfigProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Defines the properties in a custom module configuration for Security +// Health Analytics. Use the custom module configuration to create custom +// detectors that generate custom findings for resources that you specify. +message CustomConfig { + // A set of optional name-value pairs that define custom source properties to + // return with each finding that is generated by the custom module. The custom + // source properties that are defined here are included in the finding JSON + // under `sourceProperties`. + message CustomOutputSpec { + // An individual name-value pair that defines a custom source property. + message Property { + // Name of the property for the custom output. + string name = 1; + + // The CEL expression for the custom output. A resource property can be + // specified to return the value of the property or a text string enclosed + // in quotation marks. + google.type.Expr value_expression = 2; + } + + // A list of custom output properties to add to the finding. + repeated Property properties = 1; + } + + // Resource for selecting resource type. + message ResourceSelector { + // The resource types to run the detector on. + repeated string resource_types = 1; + } + + // Defines the valid value options for the severity of a finding. + enum Severity { + // Unspecified severity. + SEVERITY_UNSPECIFIED = 0; + + // Critical severity. + CRITICAL = 1; + + // High severity. + HIGH = 2; + + // Medium severity. + MEDIUM = 3; + + // Low severity. + LOW = 4; + } + + // The CEL expression to evaluate to produce findings. When the expression + // evaluates to true against a resource, a finding is generated. + google.type.Expr predicate = 1; + + // Custom output properties. + CustomOutputSpec custom_output = 2; + + // The resource types that the custom module operates on. Each custom module + // can specify up to 5 resource types. + ResourceSelector resource_selector = 3; + + // The severity to assign to findings generated by the module. + Severity severity = 4; + + // Text that describes the vulnerability or misconfiguration that the custom + // module detects. This explanation is returned with each finding instance to + // help investigators understand the detected issue. The text must be enclosed + // in quotation marks. + string description = 5; + + // An explanation of the recommended steps that security teams can take to + // resolve the detected issue. This explanation is returned with each finding + // generated by this module in the `nextSteps` property of the finding JSON. + string recommendation = 6; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_health_analytics_custom_module.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_health_analytics_custom_module.proto new file mode 100644 index 00000000000..7e7343d064f --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_health_analytics_custom_module.proto @@ -0,0 +1,110 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1/security_health_analytics_custom_config.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "SecurityHealthAnalyticsCustomModuleProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; +option (google.api.resource_definition) = { + type: "securitycenter.googleapis.com/SecurityHealthAnalyticsSettings" + pattern: "organizations/{organization}/securityHealthAnalyticsSettings" + pattern: "folders/{folder}/securityHealthAnalyticsSettings" + pattern: "projects/{project}/securityHealthAnalyticsSettings" +}; + +// Represents an instance of a Security Health Analytics custom module, +// including its full module name, display name, enablement state, and last +// updated time. You can create a custom module at the organization, folder, or +// project level. Custom modules that you create at the organization or folder +// level are inherited by the child folders and projects. +message SecurityHealthAnalyticsCustomModule { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/SecurityHealthAnalyticsCustomModule" + pattern: "organizations/{organization}/securityHealthAnalyticsSettings/customModules/{custom_module}" + pattern: "folders/{folder}/securityHealthAnalyticsSettings/customModules/{custom_module}" + pattern: "projects/{project}/securityHealthAnalyticsSettings/customModules/{custom_module}" + }; + + // Possible enablement states of a custom module. + enum EnablementState { + // Unspecified enablement state. + ENABLEMENT_STATE_UNSPECIFIED = 0; + + // The module is enabled at the given CRM resource. + ENABLED = 1; + + // The module is disabled at the given CRM resource. + DISABLED = 2; + + // State is inherited from an ancestor module. The module will either + // be effectively ENABLED or DISABLED based on its closest non-inherited + // ancestor module in the CRM hierarchy. + INHERITED = 3; + } + + // Immutable. The resource name of the custom module. + // Its format is + // "organizations/{organization}/securityHealthAnalyticsSettings/customModules/{customModule}", + // or + // "folders/{folder}/securityHealthAnalyticsSettings/customModules/{customModule}", + // or + // "projects/{project}/securityHealthAnalyticsSettings/customModules/{customModule}" + // + // The id {customModule} is server-generated and is not user settable. + // It will be a numeric id containing 1-20 digits. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // The display name of the Security Health Analytics custom module. This + // display name becomes the finding category for all findings that are + // returned by this custom module. The display name must be between 1 and + // 128 characters, start with a lowercase letter, and contain alphanumeric + // characters or underscores only. + string display_name = 2; + + // The enablement state of the custom module. + EnablementState enablement_state = 4; + + // Output only. The time at which the custom module was last updated. + google.protobuf.Timestamp update_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The editor that last updated the custom module. + string last_editor = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. If empty, indicates that the custom module was created in the + // organization, folder, or project in which you are viewing the custom + // module. Otherwise, `ancestor_module` specifies the organization or folder + // from which the custom module is inherited. + string ancestor_module = 7 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/SecurityHealthAnalyticsCustomModule" + } + ]; + + // The user specified custom configuration for the module. + CustomConfig custom_config = 8; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_marks.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_marks.proto new file mode 100644 index 00000000000..74c641dea83 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_marks.proto @@ -0,0 +1,69 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// User specified security marks that are attached to the parent Security +// Command Center resource. Security marks are scoped within a Security Command +// Center organization -- they can be modified and viewed by all users who have +// proper permissions on the organization. +message SecurityMarks { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/SecurityMarks" + pattern: "organizations/{organization}/assets/{asset}/securityMarks" + pattern: "organizations/{organization}/sources/{source}/findings/{finding}/securityMarks" + pattern: "folders/{folder}/assets/{asset}/securityMarks" + pattern: "projects/{project}/assets/{asset}/securityMarks" + pattern: "folders/{folder}/sources/{source}/findings/{finding}/securityMarks" + pattern: "projects/{project}/sources/{source}/findings/{finding}/securityMarks" + }; + + // The relative resource name of the SecurityMarks. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Examples: + // "organizations/{organization_id}/assets/{asset_id}/securityMarks" + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks". + string name = 1; + + // Mutable user specified security marks belonging to the parent resource. + // Constraints are as follows: + // + // * Keys and values are treated as case insensitive + // * Keys must be between 1 - 256 characters (inclusive) + // * Keys must be letters, numbers, underscores, or dashes + // * Values have leading and trailing whitespace trimmed, remaining + // characters must be between 1 - 4096 characters (inclusive) + map marks = 2; + + // The canonical name of the marks. + // Examples: + // "organizations/{organization_id}/assets/{asset_id}/securityMarks" + // "folders/{folder_id}/assets/{asset_id}/securityMarks" + // "projects/{project_number}/assets/{asset_id}/securityMarks" + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks" + // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}/securityMarks" + // "projects/{project_number}/sources/{source_id}/findings/{finding_id}/securityMarks" + string canonical_name = 3; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/securitycenter_service.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/securitycenter_service.proto new file mode 100644 index 00000000000..052c9cebccb --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/securitycenter_service.proto @@ -0,0 +1,2215 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1/asset.proto"; +import "google/cloud/securitycenter/v1/bigquery_export.proto"; +import "google/cloud/securitycenter/v1/effective_security_health_analytics_custom_module.proto"; +import "google/cloud/securitycenter/v1/external_system.proto"; +import "google/cloud/securitycenter/v1/finding.proto"; +import "google/cloud/securitycenter/v1/folder.proto"; +import "google/cloud/securitycenter/v1/mute_config.proto"; +import "google/cloud/securitycenter/v1/notification_config.proto"; +import "google/cloud/securitycenter/v1/organization_settings.proto"; +import "google/cloud/securitycenter/v1/run_asset_discovery_response.proto"; +import "google/cloud/securitycenter/v1/security_health_analytics_custom_module.proto"; +import "google/cloud/securitycenter/v1/security_marks.proto"; +import "google/cloud/securitycenter/v1/source.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// V1 APIs for Security Center service. +service SecurityCenter { + option (google.api.default_host) = "securitycenter.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Kicks off an LRO to bulk mute findings for a parent based on a filter. The + // parent can be either an organization, folder or project. The findings + // matched by the filter will be muted after the LRO is done. + rpc BulkMuteFindings(BulkMuteFindingsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*}/findings:bulkMute" + body: "*" + additional_bindings { + post: "/v1/{parent=folders/*}/findings:bulkMute" + body: "*" + } + additional_bindings { + post: "/v1/{parent=projects/*}/findings:bulkMute" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.securitycenter.v1.BulkMuteFindingsResponse" + metadata_type: "google.protobuf.Empty" + }; + } + + // Creates a resident SecurityHealthAnalyticsCustomModule at the scope of the + // given CRM parent, and also creates inherited + // SecurityHealthAnalyticsCustomModules for all CRM descendants of the given + // parent. These modules are enabled by default. + rpc CreateSecurityHealthAnalyticsCustomModule( + CreateSecurityHealthAnalyticsCustomModuleRequest) + returns (SecurityHealthAnalyticsCustomModule) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*/securityHealthAnalyticsSettings}/customModules" + body: "security_health_analytics_custom_module" + additional_bindings { + post: "/v1/{parent=folders/*/securityHealthAnalyticsSettings}/customModules" + body: "security_health_analytics_custom_module" + } + additional_bindings { + post: "/v1/{parent=projects/*/securityHealthAnalyticsSettings}/customModules" + body: "security_health_analytics_custom_module" + } + }; + option (google.api.method_signature) = + "parent,security_health_analytics_custom_module"; + } + + // Creates a source. + rpc CreateSource(CreateSourceRequest) returns (Source) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*}/sources" + body: "source" + }; + option (google.api.method_signature) = "parent,source"; + } + + // Creates a finding. The corresponding source must exist for finding creation + // to succeed. + rpc CreateFinding(CreateFindingRequest) returns (Finding) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*/sources/*}/findings" + body: "finding" + }; + option (google.api.method_signature) = "parent,finding_id,finding"; + } + + // Creates a mute config. + rpc CreateMuteConfig(CreateMuteConfigRequest) returns (MuteConfig) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*}/muteConfigs" + body: "mute_config" + additional_bindings { + post: "/v1/{parent=folders/*}/muteConfigs" + body: "mute_config" + } + additional_bindings { + post: "/v1/{parent=projects/*}/muteConfigs" + body: "mute_config" + } + }; + option (google.api.method_signature) = "parent,mute_config"; + option (google.api.method_signature) = "parent,mute_config,mute_config_id"; + } + + // Creates a notification config. + rpc CreateNotificationConfig(CreateNotificationConfigRequest) + returns (NotificationConfig) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*}/notificationConfigs" + body: "notification_config" + additional_bindings { + post: "/v1/{parent=folders/*}/notificationConfigs" + body: "notification_config" + } + additional_bindings { + post: "/v1/{parent=projects/*}/notificationConfigs" + body: "notification_config" + } + }; + option (google.api.method_signature) = + "parent,config_id,notification_config"; + option (google.api.method_signature) = "parent,notification_config"; + } + + // Deletes an existing mute config. + rpc DeleteMuteConfig(DeleteMuteConfigRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=organizations/*/muteConfigs/*}" + additional_bindings { delete: "/v1/{name=folders/*/muteConfigs/*}" } + additional_bindings { delete: "/v1/{name=projects/*/muteConfigs/*}" } + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a notification config. + rpc DeleteNotificationConfig(DeleteNotificationConfigRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=organizations/*/notificationConfigs/*}" + additional_bindings { + delete: "/v1/{name=folders/*/notificationConfigs/*}" + } + additional_bindings { + delete: "/v1/{name=projects/*/notificationConfigs/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Deletes the specified SecurityHealthAnalyticsCustomModule and all of its + // descendants in the CRM hierarchy. This method is only supported for + // resident custom modules. + rpc DeleteSecurityHealthAnalyticsCustomModule( + DeleteSecurityHealthAnalyticsCustomModuleRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=organizations/*/securityHealthAnalyticsSettings/customModules/*}" + additional_bindings { + delete: "/v1/{name=folders/*/securityHealthAnalyticsSettings/customModules/*}" + } + additional_bindings { + delete: "/v1/{name=projects/*/securityHealthAnalyticsSettings/customModules/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Gets a BigQuery export. + rpc GetBigQueryExport(GetBigQueryExportRequest) returns (BigQueryExport) { + option (google.api.http) = { + get: "/v1/{name=organizations/*/bigQueryExports/*}" + additional_bindings { get: "/v1/{name=folders/*/bigQueryExports/*}" } + additional_bindings { get: "/v1/{name=projects/*/bigQueryExports/*}" } + }; + option (google.api.method_signature) = "name"; + } + + // Gets the access control policy on the specified Source. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) + returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=organizations/*/sources/*}:getIamPolicy" + body: "*" + }; + option (google.api.method_signature) = "resource"; + } + + // Gets a mute config. + rpc GetMuteConfig(GetMuteConfigRequest) returns (MuteConfig) { + option (google.api.http) = { + get: "/v1/{name=organizations/*/muteConfigs/*}" + additional_bindings { get: "/v1/{name=folders/*/muteConfigs/*}" } + additional_bindings { get: "/v1/{name=projects/*/muteConfigs/*}" } + }; + option (google.api.method_signature) = "name"; + } + + // Gets a notification config. + rpc GetNotificationConfig(GetNotificationConfigRequest) + returns (NotificationConfig) { + option (google.api.http) = { + get: "/v1/{name=organizations/*/notificationConfigs/*}" + additional_bindings { get: "/v1/{name=folders/*/notificationConfigs/*}" } + additional_bindings { get: "/v1/{name=projects/*/notificationConfigs/*}" } + }; + option (google.api.method_signature) = "name"; + } + + // Gets the settings for an organization. + rpc GetOrganizationSettings(GetOrganizationSettingsRequest) + returns (OrganizationSettings) { + option (google.api.http) = { + get: "/v1/{name=organizations/*/organizationSettings}" + }; + option (google.api.method_signature) = "name"; + } + + // Retrieves an EffectiveSecurityHealthAnalyticsCustomModule. + rpc GetEffectiveSecurityHealthAnalyticsCustomModule( + GetEffectiveSecurityHealthAnalyticsCustomModuleRequest) + returns (EffectiveSecurityHealthAnalyticsCustomModule) { + option (google.api.http) = { + get: "/v1/{name=organizations/*/securityHealthAnalyticsSettings/effectiveCustomModules/*}" + additional_bindings { + get: "/v1/{name=folders/*/securityHealthAnalyticsSettings/effectiveCustomModules/*}" + } + additional_bindings { + get: "/v1/{name=projects/*/securityHealthAnalyticsSettings/effectiveCustomModules/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Retrieves a SecurityHealthAnalyticsCustomModule. + rpc GetSecurityHealthAnalyticsCustomModule( + GetSecurityHealthAnalyticsCustomModuleRequest) + returns (SecurityHealthAnalyticsCustomModule) { + option (google.api.http) = { + get: "/v1/{name=organizations/*/securityHealthAnalyticsSettings/customModules/*}" + additional_bindings { + get: "/v1/{name=folders/*/securityHealthAnalyticsSettings/customModules/*}" + } + additional_bindings { + get: "/v1/{name=projects/*/securityHealthAnalyticsSettings/customModules/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Gets a source. + rpc GetSource(GetSourceRequest) returns (Source) { + option (google.api.http) = { + get: "/v1/{name=organizations/*/sources/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Filters an organization's assets and groups them by their specified + // properties. + rpc GroupAssets(GroupAssetsRequest) returns (GroupAssetsResponse) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*}/assets:group" + body: "*" + additional_bindings { + post: "/v1/{parent=folders/*}/assets:group" + body: "*" + } + additional_bindings { + post: "/v1/{parent=projects/*}/assets:group" + body: "*" + } + }; + } + + // Filters an organization or source's findings and groups them by their + // specified properties. + // + // To group across all sources provide a `-` as the source id. + // Example: /v1/organizations/{organization_id}/sources/-/findings, + // /v1/folders/{folder_id}/sources/-/findings, + // /v1/projects/{project_id}/sources/-/findings + rpc GroupFindings(GroupFindingsRequest) returns (GroupFindingsResponse) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*/sources/*}/findings:group" + body: "*" + additional_bindings { + post: "/v1/{parent=folders/*/sources/*}/findings:group" + body: "*" + } + additional_bindings { + post: "/v1/{parent=projects/*/sources/*}/findings:group" + body: "*" + } + }; + option (google.api.method_signature) = "parent,group_by"; + } + + // Lists an organization's assets. + rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { + option (google.api.http) = { + get: "/v1/{parent=organizations/*}/assets" + additional_bindings { get: "/v1/{parent=folders/*}/assets" } + additional_bindings { get: "/v1/{parent=projects/*}/assets" } + }; + } + + // Returns a list of all resident SecurityHealthAnalyticsCustomModules under + // the given CRM parent and all of the parent’s CRM descendants. + rpc ListDescendantSecurityHealthAnalyticsCustomModules( + ListDescendantSecurityHealthAnalyticsCustomModulesRequest) + returns (ListDescendantSecurityHealthAnalyticsCustomModulesResponse) { + option (google.api.http) = { + get: "/v1/{parent=organizations/*/securityHealthAnalyticsSettings}/customModules:listDescendant" + additional_bindings { + get: "/v1/{parent=folders/*/securityHealthAnalyticsSettings}/customModules:listDescendant" + } + additional_bindings { + get: "/v1/{parent=projects/*/securityHealthAnalyticsSettings}/customModules:listDescendant" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Lists an organization or source's findings. + // + // To list across all sources provide a `-` as the source id. + // Example: /v1/organizations/{organization_id}/sources/-/findings + rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { + option (google.api.http) = { + get: "/v1/{parent=organizations/*/sources/*}/findings" + additional_bindings { get: "/v1/{parent=folders/*/sources/*}/findings" } + additional_bindings { get: "/v1/{parent=projects/*/sources/*}/findings" } + }; + } + + // Lists mute configs. + rpc ListMuteConfigs(ListMuteConfigsRequest) + returns (ListMuteConfigsResponse) { + option (google.api.http) = { + get: "/v1/{parent=organizations/*}/muteConfigs" + additional_bindings { get: "/v1/{parent=folders/*}/muteConfigs" } + additional_bindings { get: "/v1/{parent=projects/*}/muteConfigs" } + }; + option (google.api.method_signature) = "parent"; + } + + // Lists notification configs. + rpc ListNotificationConfigs(ListNotificationConfigsRequest) + returns (ListNotificationConfigsResponse) { + option (google.api.http) = { + get: "/v1/{parent=organizations/*}/notificationConfigs" + additional_bindings { get: "/v1/{parent=folders/*}/notificationConfigs" } + additional_bindings { get: "/v1/{parent=projects/*}/notificationConfigs" } + }; + option (google.api.method_signature) = "parent"; + } + + // Returns a list of all EffectiveSecurityHealthAnalyticsCustomModules for the + // given parent. This includes resident modules defined at the scope of the + // parent, and inherited modules, inherited from CRM ancestors. + rpc ListEffectiveSecurityHealthAnalyticsCustomModules( + ListEffectiveSecurityHealthAnalyticsCustomModulesRequest) + returns (ListEffectiveSecurityHealthAnalyticsCustomModulesResponse) { + option (google.api.http) = { + get: "/v1/{parent=organizations/*/securityHealthAnalyticsSettings}/effectiveCustomModules" + additional_bindings { + get: "/v1/{parent=folders/*/securityHealthAnalyticsSettings}/effectiveCustomModules" + } + additional_bindings { + get: "/v1/{parent=projects/*/securityHealthAnalyticsSettings}/effectiveCustomModules" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Returns a list of all SecurityHealthAnalyticsCustomModules for the given + // parent. This includes resident modules defined at the scope of the parent, + // and inherited modules, inherited from CRM ancestors. + rpc ListSecurityHealthAnalyticsCustomModules( + ListSecurityHealthAnalyticsCustomModulesRequest) + returns (ListSecurityHealthAnalyticsCustomModulesResponse) { + option (google.api.http) = { + get: "/v1/{parent=organizations/*/securityHealthAnalyticsSettings}/customModules" + additional_bindings { + get: "/v1/{parent=folders/*/securityHealthAnalyticsSettings}/customModules" + } + additional_bindings { + get: "/v1/{parent=projects/*/securityHealthAnalyticsSettings}/customModules" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Lists all sources belonging to an organization. + rpc ListSources(ListSourcesRequest) returns (ListSourcesResponse) { + option (google.api.http) = { + get: "/v1/{parent=organizations/*}/sources" + additional_bindings { get: "/v1/{parent=folders/*}/sources" } + additional_bindings { get: "/v1/{parent=projects/*}/sources" } + }; + option (google.api.method_signature) = "parent"; + } + + // Runs asset discovery. The discovery is tracked with a long-running + // operation. + // + // This API can only be called with limited frequency for an organization. If + // it is called too frequently the caller will receive a TOO_MANY_REQUESTS + // error. + rpc RunAssetDiscovery(RunAssetDiscoveryRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*}/assets:runDiscovery" + body: "*" + }; + option (google.api.method_signature) = "parent"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.securitycenter.v1.RunAssetDiscoveryResponse" + metadata_type: "google.protobuf.Empty" + }; + } + + // Updates the state of a finding. + rpc SetFindingState(SetFindingStateRequest) returns (Finding) { + option (google.api.http) = { + post: "/v1/{name=organizations/*/sources/*/findings/*}:setState" + body: "*" + additional_bindings { + post: "/v1/{name=folders/*/sources/*/findings/*}:setState" + body: "*" + } + additional_bindings { + post: "/v1/{name=projects/*/sources/*/findings/*}:setState" + body: "*" + } + }; + option (google.api.method_signature) = "name,state,start_time"; + } + + // Updates the mute state of a finding. + rpc SetMute(SetMuteRequest) returns (Finding) { + option (google.api.http) = { + post: "/v1/{name=organizations/*/sources/*/findings/*}:setMute" + body: "*" + additional_bindings { + post: "/v1/{name=folders/*/sources/*/findings/*}:setMute" + body: "*" + } + additional_bindings { + post: "/v1/{name=projects/*/sources/*/findings/*}:setMute" + body: "*" + } + }; + option (google.api.method_signature) = "name,mute"; + } + + // Sets the access control policy on the specified Source. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) + returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=organizations/*/sources/*}:setIamPolicy" + body: "*" + }; + option (google.api.method_signature) = "resource,policy"; + } + + // Returns the permissions that a caller has on the specified source. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) + returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1/{resource=organizations/*/sources/*}:testIamPermissions" + body: "*" + }; + option (google.api.method_signature) = "resource,permissions"; + } + + // Updates external system. This is for a given finding. + rpc UpdateExternalSystem(UpdateExternalSystemRequest) + returns (ExternalSystem) { + option (google.api.http) = { + patch: "/v1/{external_system.name=organizations/*/sources/*/findings/*/externalSystems/*}" + body: "external_system" + additional_bindings { + patch: "/v1/{external_system.name=folders/*/sources/*/findings/*/externalSystems/*}" + body: "external_system" + } + additional_bindings { + patch: "/v1/{external_system.name=projects/*/sources/*/findings/*/externalSystems/*}" + body: "external_system" + } + }; + option (google.api.method_signature) = "external_system,update_mask"; + } + + // Creates or updates a finding. The corresponding source must exist for a + // finding creation to succeed. + rpc UpdateFinding(UpdateFindingRequest) returns (Finding) { + option (google.api.http) = { + patch: "/v1/{finding.name=organizations/*/sources/*/findings/*}" + body: "finding" + additional_bindings { + patch: "/v1/{finding.name=folders/*/sources/*/findings/*}" + body: "finding" + } + additional_bindings { + patch: "/v1/{finding.name=projects/*/sources/*/findings/*}" + body: "finding" + } + }; + option (google.api.method_signature) = "finding"; + } + + // Updates a mute config. + rpc UpdateMuteConfig(UpdateMuteConfigRequest) returns (MuteConfig) { + option (google.api.http) = { + patch: "/v1/{mute_config.name=organizations/*/muteConfigs/*}" + body: "mute_config" + additional_bindings { + patch: "/v1/{mute_config.name=folders/*/muteConfigs/*}" + body: "mute_config" + } + additional_bindings { + patch: "/v1/{mute_config.name=projects/*/muteConfigs/*}" + body: "mute_config" + } + }; + option (google.api.method_signature) = "mute_config,update_mask"; + } + + // + // Updates a notification config. The following update + // fields are allowed: description, pubsub_topic, streaming_config.filter + rpc UpdateNotificationConfig(UpdateNotificationConfigRequest) + returns (NotificationConfig) { + option (google.api.http) = { + patch: "/v1/{notification_config.name=organizations/*/notificationConfigs/*}" + body: "notification_config" + additional_bindings { + patch: "/v1/{notification_config.name=folders/*/notificationConfigs/*}" + body: "notification_config" + } + additional_bindings { + patch: "/v1/{notification_config.name=projects/*/notificationConfigs/*}" + body: "notification_config" + } + }; + option (google.api.method_signature) = "notification_config"; + option (google.api.method_signature) = "notification_config,update_mask"; + } + + // Updates an organization's settings. + rpc UpdateOrganizationSettings(UpdateOrganizationSettingsRequest) + returns (OrganizationSettings) { + option (google.api.http) = { + patch: "/v1/{organization_settings.name=organizations/*/organizationSettings}" + body: "organization_settings" + }; + option (google.api.method_signature) = "organization_settings"; + } + + // Updates the SecurityHealthAnalyticsCustomModule under the given name based + // on the given update mask. Updating the enablement state is supported on + // both resident and inherited modules (though resident modules cannot have an + // enablement state of "inherited"). Updating the display name and custom + // config of a module is supported on resident modules only. + rpc UpdateSecurityHealthAnalyticsCustomModule( + UpdateSecurityHealthAnalyticsCustomModuleRequest) + returns (SecurityHealthAnalyticsCustomModule) { + option (google.api.http) = { + patch: "/v1/{security_health_analytics_custom_module.name=organizations/*/securityHealthAnalyticsSettings/customModules/*}" + body: "security_health_analytics_custom_module" + additional_bindings { + patch: "/v1/{security_health_analytics_custom_module.name=folders/*/securityHealthAnalyticsSettings/customModules/*}" + body: "security_health_analytics_custom_module" + } + additional_bindings { + patch: "/v1/{security_health_analytics_custom_module.name=projects/*/securityHealthAnalyticsSettings/customModules/*}" + body: "security_health_analytics_custom_module" + } + }; + option (google.api.method_signature) = + "security_health_analytics_custom_module,update_mask"; + } + + // Updates a source. + rpc UpdateSource(UpdateSourceRequest) returns (Source) { + option (google.api.http) = { + patch: "/v1/{source.name=organizations/*/sources/*}" + body: "source" + }; + option (google.api.method_signature) = "source"; + } + + // Updates security marks. + rpc UpdateSecurityMarks(UpdateSecurityMarksRequest) returns (SecurityMarks) { + option (google.api.http) = { + patch: "/v1/{security_marks.name=organizations/*/assets/*/securityMarks}" + body: "security_marks" + additional_bindings { + patch: "/v1/{security_marks.name=folders/*/assets/*/securityMarks}" + body: "security_marks" + } + additional_bindings { + patch: "/v1/{security_marks.name=projects/*/assets/*/securityMarks}" + body: "security_marks" + } + additional_bindings { + patch: "/v1/{security_marks.name=organizations/*/sources/*/findings/*/securityMarks}" + body: "security_marks" + } + additional_bindings { + patch: "/v1/{security_marks.name=folders/*/sources/*/findings/*/securityMarks}" + body: "security_marks" + } + additional_bindings { + patch: "/v1/{security_marks.name=projects/*/sources/*/findings/*/securityMarks}" + body: "security_marks" + } + }; + option (google.api.method_signature) = "security_marks"; + } + + // Creates a BigQuery export. + rpc CreateBigQueryExport(CreateBigQueryExportRequest) + returns (BigQueryExport) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*}/bigQueryExports" + body: "big_query_export" + additional_bindings { + post: "/v1/{parent=folders/*}/bigQueryExports" + body: "big_query_export" + } + additional_bindings { + post: "/v1/{parent=projects/*}/bigQueryExports" + body: "big_query_export" + } + }; + option (google.api.method_signature) = + "parent,big_query_export,big_query_export_id"; + } + + // Deletes an existing BigQuery export. + rpc DeleteBigQueryExport(DeleteBigQueryExportRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=organizations/*/bigQueryExports/*}" + additional_bindings { delete: "/v1/{name=folders/*/bigQueryExports/*}" } + additional_bindings { delete: "/v1/{name=projects/*/bigQueryExports/*}" } + }; + option (google.api.method_signature) = "name"; + } + + // Updates a BigQuery export. + rpc UpdateBigQueryExport(UpdateBigQueryExportRequest) + returns (BigQueryExport) { + option (google.api.http) = { + patch: "/v1/{big_query_export.name=organizations/*/bigQueryExports/*}" + body: "big_query_export" + additional_bindings { + patch: "/v1/{big_query_export.name=folders/*/bigQueryExports/*}" + body: "big_query_export" + } + additional_bindings { + patch: "/v1/{big_query_export.name=projects/*/bigQueryExports/*}" + body: "big_query_export" + } + }; + option (google.api.method_signature) = "big_query_export,update_mask"; + } + + // 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. + rpc ListBigQueryExports(ListBigQueryExportsRequest) + returns (ListBigQueryExportsResponse) { + option (google.api.http) = { + get: "/v1/{parent=organizations/*}/bigQueryExports" + additional_bindings { get: "/v1/{parent=folders/*}/bigQueryExports" } + additional_bindings { get: "/v1/{parent=projects/*}/bigQueryExports" } + }; + option (google.api.method_signature) = "parent"; + } +} + +// Request message for bulk findings update. +// +// Note: +// 1. If multiple bulk update requests match the same resource, the order in +// which they get executed is not defined. +// 2. Once a bulk operation is started, there is no way to stop it. +message BulkMuteFindingsRequest { + // Required. The parent, at which bulk action needs to be applied. Its format + // is "organizations/[organization_id]", "folders/[folder_id]", + // "projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "*" } + ]; + + // Expression that identifies findings that should be updated. + // 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. + string filter = 2; + + // This can be a mute configuration name or any identifier for mute/unmute + // of findings based on the filter. + string mute_annotation = 3 [deprecated = true]; +} + +// The response to a BulkMute request. Contains the LRO information. +message BulkMuteFindingsResponse {} + +// Request message for creating a finding. +message CreateFindingRequest { + // Required. Resource name of the new finding's parent. Its format should be + // "organizations/[organization_id]/sources/[source_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; + + // Required. Unique identifier provided by the client within the parent scope. + // It must be alphanumeric and less than or equal to 32 characters and + // greater than 0 characters in length. + string finding_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Finding being created. The name and security_marks will be + // ignored as they are both output only fields on this resource. + Finding finding = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for creating a mute config. +message CreateMuteConfigRequest { + // Required. Resource name of the new mute configs's parent. Its format is + // "organizations/[organization_id]", "folders/[folder_id]", or + // "projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/MuteConfig" + } + ]; + + // Required. The mute config being created. + MuteConfig mute_config = 2 [(google.api.field_behavior) = REQUIRED]; + + // 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. + string mute_config_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for creating a notification config. +message CreateNotificationConfigRequest { + // Required. Resource name of the new notification config's parent. Its format + // is "organizations/[organization_id]", "folders/[folder_id]", or + // "projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/NotificationConfig" + } + ]; + + // Required. + // Unique identifier provided by the client within the parent scope. + // It must be between 1 and 128 characters and contain alphanumeric + // characters, underscores, or hyphens only. + string config_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The notification config being created. The name and the service + // account will be ignored as they are both output only fields on this + // resource. + NotificationConfig notification_config = 3 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for creating Security Health Analytics custom modules. +message CreateSecurityHealthAnalyticsCustomModuleRequest { + // Required. Resource name of the new custom module's parent. Its format is + // "organizations/{organization}/securityHealthAnalyticsSettings", + // "folders/{folder}/securityHealthAnalyticsSettings", or + // "projects/{project}/securityHealthAnalyticsSettings" + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/SecurityHealthAnalyticsCustomModule" + } + ]; + + // Required. SecurityHealthAnalytics custom module to create. The provided + // name is ignored and reset with provided parent information and + // server-generated ID. + SecurityHealthAnalyticsCustomModule security_health_analytics_custom_module = + 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for creating a source. +message CreateSourceRequest { + // Required. Resource name of the new source's parent. Its format should be + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // Required. The Source being created, only the display_name and description + // will be used. All other fields will be ignored. + Source source = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for deleting a mute config. +message DeleteMuteConfigRequest { + // Required. Name of the mute config to delete. Its format is + // organizations/{organization}/muteConfigs/{config_id}, + // folders/{folder}/muteConfigs/{config_id}, or + // projects/{project}/muteConfigs/{config_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/MuteConfig" + } + ]; +} + +// Request message for deleting a notification config. +message DeleteNotificationConfigRequest { + // Required. Name of the notification config to delete. Its format is + // "organizations/[organization_id]/notificationConfigs/[config_id]", + // "folders/[folder_id]/notificationConfigs/[config_id]", + // or "projects/[project_id]/notificationConfigs/[config_id]". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/NotificationConfig" + } + ]; +} + +// Request message for deleting Security Health Analytics custom modules. +message DeleteSecurityHealthAnalyticsCustomModuleRequest { + // Required. Name of the custom module to delete. Its format is + // "organizations/{organization}/securityHealthAnalyticsSettings/customModules/{customModule}", + // "folders/{folder}/securityHealthAnalyticsSettings/customModules/{customModule}", + // or + // "projects/{project}/securityHealthAnalyticsSettings/customModules/{customModule}" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/SecurityHealthAnalyticsCustomModule" + } + ]; +} + +// Request message for retrieving a BigQuery export. +message GetBigQueryExportRequest { + // Required. Name of the BigQuery export to retrieve. Its format is + // organizations/{organization}/bigQueryExports/{export_id}, + // folders/{folder}/bigQueryExports/{export_id}, or + // projects/{project}/bigQueryExports/{export_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/BigQueryExport" + } + ]; +} + +// Request message for retrieving a mute config. +message GetMuteConfigRequest { + // Required. Name of the mute config to retrieve. Its format is + // organizations/{organization}/muteConfigs/{config_id}, + // folders/{folder}/muteConfigs/{config_id}, or + // projects/{project}/muteConfigs/{config_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/MuteConfig" + } + ]; +} + +// Request message for getting a notification config. +message GetNotificationConfigRequest { + // Required. Name of the notification config to get. Its format is + // "organizations/[organization_id]/notificationConfigs/[config_id]", + // "folders/[folder_id]/notificationConfigs/[config_id]", + // or "projects/[project_id]/notificationConfigs/[config_id]". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/NotificationConfig" + } + ]; +} + +// Request message for getting organization settings. +message GetOrganizationSettingsRequest { + // Required. Name of the organization to get organization settings for. Its + // format is "organizations/[organization_id]/organizationSettings". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/OrganizationSettings" + } + ]; +} + +// Request message for getting effective Security Health Analytics custom +// modules. +message GetEffectiveSecurityHealthAnalyticsCustomModuleRequest { + // Required. Name of the effective custom module to get. Its format is + // "organizations/{organization}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}", + // "folders/{folder}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}", + // or + // "projects/{project}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/EffectiveSecurityHealthAnalyticsCustomModule" + } + ]; +} + +// Request message for getting Security Health Analytics custom modules. +message GetSecurityHealthAnalyticsCustomModuleRequest { + // Required. Name of the custom module to get. Its format is + // "organizations/{organization}/securityHealthAnalyticsSettings/customModules/{customModule}", + // "folders/{folder}/securityHealthAnalyticsSettings/customModules/{customModule}", + // or + // "projects/{project}/securityHealthAnalyticsSettings/customModules/{customModule}" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/SecurityHealthAnalyticsCustomModule" + } + ]; +} + +// Request message for getting a source. +message GetSourceRequest { + // Required. Relative resource name of the source. Its format is + // "organizations/[organization_id]/source/[source_id]". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; +} + +// Request message for grouping by assets. +message GroupAssetsRequest { + // Required. The name of the parent to group the assets by. Its format is + // "organizations/[organization_id]", "folders/[folder_id]", or + // "projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/Asset" + } + ]; + + // Expression that defines the filter to apply across assets. + // 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 Asset resource. Examples include: + // + // * name + // * security_center_properties.resource_name + // * resource_properties.a_property + // * security_marks.marks.marka + // + // 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. + // + // The following field and operator combinations are supported: + // + // * name: `=` + // * update_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `update_time = "2019-06-10T16:07:18-07:00"` + // `update_time = 1560208038000` + // + // * create_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `create_time = "2019-06-10T16:07:18-07:00"` + // `create_time = 1560208038000` + // + // * iam_policy.policy_blob: `=`, `:` + // * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + // * security_marks.marks: `=`, `:` + // * security_center_properties.resource_name: `=`, `:` + // * security_center_properties.resource_display_name: `=`, `:` + // * security_center_properties.resource_type: `=`, `:` + // * security_center_properties.resource_parent: `=`, `:` + // * security_center_properties.resource_parent_display_name: `=`, `:` + // * security_center_properties.resource_project: `=`, `:` + // * security_center_properties.resource_project_display_name: `=`, `:` + // * security_center_properties.resource_owners: `=`, `:` + // + // For example, `resource_properties.size = 100` is a valid filter string. + // + // Use a partial match on the empty string to filter based on a property + // existing: `resource_properties.my_property : ""` + // + // Use a negated partial match on the empty string to filter based on a + // property not existing: `-resource_properties.my_property : ""` + string filter = 2; + + // Required. Expression that defines what assets fields to use for grouping. + // The string value should follow SQL syntax: comma separated list of fields. + // For example: + // "security_center_properties.resource_project,security_center_properties.project". + // + // The following fields are supported when compare_duration is not set: + // + // * security_center_properties.resource_project + // * security_center_properties.resource_project_display_name + // * security_center_properties.resource_type + // * security_center_properties.resource_parent + // * security_center_properties.resource_parent_display_name + // + // The following fields are supported when compare_duration is set: + // + // * security_center_properties.resource_type + // * security_center_properties.resource_project_display_name + // * security_center_properties.resource_parent_display_name + string group_by = 3 [(google.api.field_behavior) = REQUIRED]; + + // When compare_duration is set, the GroupResult's "state_change" property is + // updated to indicate whether the asset was added, removed, or remained + // present during the compare_duration period of time that precedes the + // read_time. This is the time between (read_time - compare_duration) and + // read_time. + // + // The state change value is derived based on the presence of the asset at the + // two points in time. Intermediate state changes between the two times don't + // affect the result. For example, the results aren't affected if the asset is + // removed and re-created again. + // + // Possible "state_change" values when compare_duration is specified: + // + // * "ADDED": indicates that the asset was not present at the start of + // compare_duration, but present at reference_time. + // * "REMOVED": indicates that the asset was present at the start of + // compare_duration, but not present at reference_time. + // * "ACTIVE": indicates that the asset was present at both the + // start and the end of the time period defined by + // compare_duration and reference_time. + // + // If compare_duration is not specified, then the only possible state_change + // is "UNUSED", which will be the state_change set for all assets present at + // read_time. + // + // If this field is set then `state_change` must be a specified field in + // `group_by`. + google.protobuf.Duration compare_duration = 4; + + // Time used as a reference point when filtering assets. The filter is limited + // to assets existing at the supplied time and their values are those at that + // specific time. Absence of this field will default to the API's version of + // NOW. + google.protobuf.Timestamp read_time = 5; + + // The value returned by the last `GroupAssetsResponse`; indicates + // that this is a continuation of a prior `GroupAssets` call, and that the + // system should return the next page of data. + string page_token = 7; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 8; +} + +// Response message for grouping by assets. +message GroupAssetsResponse { + // Group results. There exists an element for each existing unique + // combination of property/values. The element contains a count for the number + // of times those specific property/values appear. + repeated GroupResult group_by_results = 1; + + // Time used for executing the groupBy request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of results matching the query. + int32 total_size = 4; +} + +// Request message for grouping by findings. +message GroupFindingsRequest { + // Required. Name of the source to groupBy. Its format is + // "organizations/[organization_id]/sources/[source_id]", + // folders/[folder_id]/sources/[source_id], or + // projects/[project_id]/sources/[source_id]. To groupBy across all sources + // provide a source_id of `-`. For example: + // organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + // or projects/{project_id}/sources/- + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; + + // Expression that defines the filter to apply across findings. + // The expression is a list of one 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. Examples include: + // + // * name + // * source_properties.a_property + // * security_marks.marks.marka + // + // 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. + // + // The following field and operator combinations are supported: + // + // * name: `=` + // * parent: `=`, `:` + // * resource_name: `=`, `:` + // * state: `=`, `:` + // * category: `=`, `:` + // * external_uri: `=`, `:` + // * event_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `event_time = "2019-06-10T16:07:18-07:00"` + // `event_time = 1560208038000` + // + // * severity: `=`, `:` + // * workflow_state: `=`, `:` + // * security_marks.marks: `=`, `:` + // * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + // + // For example, `source_properties.size = 100` is a valid filter string. + // + // Use a partial match on the empty string to filter based on a property + // existing: `source_properties.my_property : ""` + // + // Use a negated partial match on the empty string to filter based on a + // property not existing: `-source_properties.my_property : ""` + // + // * resource: + // * resource.name: `=`, `:` + // * resource.parent_name: `=`, `:` + // * resource.parent_display_name: `=`, `:` + // * resource.project_name: `=`, `:` + // * resource.project_display_name: `=`, `:` + // * resource.type: `=`, `:` + string filter = 2; + + // Required. Expression that defines what assets fields to use for grouping + // (including `state_change`). The string value should follow SQL syntax: + // comma separated list of fields. For example: "parent,resource_name". + // + // The following fields are supported: + // + // * resource_name + // * category + // * state + // * parent + // * severity + // + // The following fields are supported when compare_duration is set: + // + // * state_change + string group_by = 3 [(google.api.field_behavior) = REQUIRED]; + + // Time used as a reference point when filtering findings. The filter is + // limited to findings existing at the supplied time and their values are + // those at that specific time. Absence of this field will default to the + // API's version of NOW. + google.protobuf.Timestamp read_time = 4; + + // When compare_duration is set, the GroupResult's "state_change" attribute is + // updated to indicate whether the finding had its state changed, the + // finding's state remained unchanged, or if the finding was added during the + // compare_duration period of time that precedes the read_time. This is the + // time between (read_time - compare_duration) and read_time. + // + // The state_change value is derived based on the presence and state of the + // finding at the two points in time. Intermediate state changes between the + // two times don't affect the result. For example, the results aren't affected + // if the finding is made inactive and then active again. + // + // Possible "state_change" values when compare_duration is specified: + // + // * "CHANGED": indicates that the finding was present and matched the given + // filter at the start of compare_duration, but changed its + // state at read_time. + // * "UNCHANGED": indicates that the finding was present and matched the given + // filter at the start of compare_duration and did not change + // state at read_time. + // * "ADDED": indicates that the finding did not match the given filter or + // was not present at the start of compare_duration, but was + // present at read_time. + // * "REMOVED": indicates that the finding was present and matched the + // filter at the start of compare_duration, but did not match + // the filter at read_time. + // + // If compare_duration is not specified, then the only possible state_change + // is "UNUSED", which will be the state_change set for all findings present + // at read_time. + // + // If this field is set then `state_change` must be a specified field in + // `group_by`. + google.protobuf.Duration compare_duration = 5; + + // The value returned by the last `GroupFindingsResponse`; indicates + // that this is a continuation of a prior `GroupFindings` call, and + // that the system should return the next page of data. + string page_token = 7; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 8; +} + +// Response message for group by findings. +message GroupFindingsResponse { + // Group results. There exists an element for each existing unique + // combination of property/values. The element contains a count for the number + // of times those specific property/values appear. + repeated GroupResult group_by_results = 1; + + // Time used for executing the groupBy request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of results matching the query. + int32 total_size = 4; +} + +// Result containing the properties and count of a groupBy request. +message GroupResult { + // Properties matching the groupBy fields in the request. + map properties = 1; + + // Total count of resources for the given properties. + int64 count = 2; +} + +// Request message for listing descendant Security Health Analytics custom +// modules. +message ListDescendantSecurityHealthAnalyticsCustomModulesRequest { + // Required. Name of parent to list descendant custom modules. Its format is + // "organizations/{organization}/securityHealthAnalyticsSettings", + // "folders/{folder}/securityHealthAnalyticsSettings", or + // "projects/{project}/securityHealthAnalyticsSettings" + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/SecurityHealthAnalyticsCustomModule" + } + ]; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 2; + + // The value returned by the last call indicating a continuation + string page_token = 3; +} + +// Response message for listing descendant Security Health Analytics custom +// modules. +message ListDescendantSecurityHealthAnalyticsCustomModulesResponse { + // Custom modules belonging to the requested parent and its descendants. + repeated SecurityHealthAnalyticsCustomModule + security_health_analytics_custom_modules = 1; + + // If not empty, indicates that there may be more custom modules to be + // returned. + string next_page_token = 2; +} + +// Request message for listing mute configs at a given scope e.g. organization, +// folder or project. +message ListMuteConfigsRequest { + // Required. The parent, which owns the collection of mute configs. Its format + // is "organizations/[organization_id]", "folders/[folder_id]", + // "projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/MuteConfig" + } + ]; + + // 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. + int32 page_size = 2; + + // A page token, received from a previous `ListMuteConfigs` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListMuteConfigs` must + // match the call that provided the page token. + string page_token = 3; +} + +// Response message for listing mute configs. +message ListMuteConfigsResponse { + // The mute configs from the specified parent. + repeated MuteConfig mute_configs = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for listing notification configs. +message ListNotificationConfigsRequest { + // Required. The name of the parent in which to list the notification + // configurations. Its format is "organizations/[organization_id]", + // "folders/[folder_id]", or "projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/NotificationConfig" + } + ]; + + // The value returned by the last `ListNotificationConfigsResponse`; indicates + // that this is a continuation of a prior `ListNotificationConfigs` call, and + // that the system should return the next page of data. + string page_token = 2; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 3; +} + +// Response message for listing notification configs. +message ListNotificationConfigsResponse { + // Notification configs belonging to the requested parent. + repeated NotificationConfig notification_configs = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 2; +} + +// Request message for listing effective Security Health Analytics custom +// modules. +message ListEffectiveSecurityHealthAnalyticsCustomModulesRequest { + // Required. Name of parent to list effective custom modules. Its format is + // "organizations/{organization}/securityHealthAnalyticsSettings", + // "folders/{folder}/securityHealthAnalyticsSettings", or + // "projects/{project}/securityHealthAnalyticsSettings" + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/SecurityHealthAnalyticsCustomModule" + } + ]; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 2; + + // The value returned by the last call indicating a continuation + string page_token = 3; +} + +// Response message for listing effective Security Health Analytics custom +// modules. +message ListEffectiveSecurityHealthAnalyticsCustomModulesResponse { + // Effective custom modules belonging to the requested parent. + repeated EffectiveSecurityHealthAnalyticsCustomModule + effective_security_health_analytics_custom_modules = 1; + + // If not empty, indicates that there may be more effective custom modules to + // be returned. + string next_page_token = 2; +} + +// Request message for listing Security Health Analytics custom modules. +message ListSecurityHealthAnalyticsCustomModulesRequest { + // Required. Name of parent to list custom modules. Its format is + // "organizations/{organization}/securityHealthAnalyticsSettings", + // "folders/{folder}/securityHealthAnalyticsSettings", or + // "projects/{project}/securityHealthAnalyticsSettings" + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/SecurityHealthAnalyticsCustomModule" + } + ]; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 2; + + // The value returned by the last call indicating a continuation + string page_token = 3; +} + +// Response message for listing Security Health Analytics custom modules. +message ListSecurityHealthAnalyticsCustomModulesResponse { + // Custom modules belonging to the requested parent. + repeated SecurityHealthAnalyticsCustomModule + security_health_analytics_custom_modules = 1; + + // If not empty, indicates that there may be more custom modules to be + // returned. + string next_page_token = 2; +} + +// Request message for listing sources. +message ListSourcesRequest { + // Required. Resource name of the parent of sources to list. Its format should + // be "organizations/[organization_id]", "folders/[folder_id]", or + // "projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/Source" + } + ]; + + // The value returned by the last `ListSourcesResponse`; indicates + // that this is a continuation of a prior `ListSources` call, and + // that the system should return the next page of data. + string page_token = 2; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 7; +} + +// Response message for listing sources. +message ListSourcesResponse { + // Sources belonging to the requested parent. + repeated Source sources = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 2; +} + +// Request message for listing assets. +message ListAssetsRequest { + // Required. The name of the parent resource that contains the assets. The + // value that you can specify on parent depends on the method in which you + // specify parent. You can specify one of the following values: + // "organizations/[organization_id]", "folders/[folder_id]", or + // "projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/Asset" + } + ]; + + // Expression that defines the filter to apply across assets. + // 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 Asset resource. Examples include: + // + // * name + // * security_center_properties.resource_name + // * resource_properties.a_property + // * security_marks.marks.marka + // + // 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. + // + // The following are the allowed field and operator combinations: + // + // * name: `=` + // * update_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `update_time = "2019-06-10T16:07:18-07:00"` + // `update_time = 1560208038000` + // + // * create_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `create_time = "2019-06-10T16:07:18-07:00"` + // `create_time = 1560208038000` + // + // * iam_policy.policy_blob: `=`, `:` + // * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + // * security_marks.marks: `=`, `:` + // * security_center_properties.resource_name: `=`, `:` + // * security_center_properties.resource_display_name: `=`, `:` + // * security_center_properties.resource_type: `=`, `:` + // * security_center_properties.resource_parent: `=`, `:` + // * security_center_properties.resource_parent_display_name: `=`, `:` + // * security_center_properties.resource_project: `=`, `:` + // * security_center_properties.resource_project_display_name: `=`, `:` + // * security_center_properties.resource_owners: `=`, `:` + // + // For example, `resource_properties.size = 100` is a valid filter string. + // + // Use a partial match on the empty string to filter based on a property + // existing: `resource_properties.my_property : ""` + // + // Use a negated partial match on the empty string to filter based on a + // property not existing: `-resource_properties.my_property : ""` + string filter = 2; + + // Expression that defines what fields and order to use for sorting. The + // string value should follow SQL syntax: comma separated list of fields. For + // example: "name,resource_properties.a_property". The default sorting order + // is ascending. To specify descending order for a field, a suffix " desc" + // should be appended to the field name. For example: "name + // desc,resource_properties.a_property". Redundant space characters in the + // syntax are insignificant. "name desc,resource_properties.a_property" and " + // name desc , resource_properties.a_property " are equivalent. + // + // The following fields are supported: + // name + // update_time + // resource_properties + // security_marks.marks + // security_center_properties.resource_name + // security_center_properties.resource_display_name + // security_center_properties.resource_parent + // security_center_properties.resource_parent_display_name + // security_center_properties.resource_project + // security_center_properties.resource_project_display_name + // security_center_properties.resource_type + string order_by = 3; + + // Time used as a reference point when filtering assets. The filter is limited + // to assets existing at the supplied time and their values are those at that + // specific time. Absence of this field will default to the API's version of + // NOW. + google.protobuf.Timestamp read_time = 4; + + // When compare_duration is set, the ListAssetsResult's "state_change" + // attribute is updated to indicate whether the asset was added, removed, or + // remained present during the compare_duration period of time that precedes + // the read_time. This is the time between (read_time - compare_duration) and + // read_time. + // + // The state_change value is derived based on the presence of the asset at the + // two points in time. Intermediate state changes between the two times don't + // affect the result. For example, the results aren't affected if the asset is + // removed and re-created again. + // + // Possible "state_change" values when compare_duration is specified: + // + // * "ADDED": indicates that the asset was not present at the start of + // compare_duration, but present at read_time. + // * "REMOVED": indicates that the asset was present at the start of + // compare_duration, but not present at read_time. + // * "ACTIVE": indicates that the asset was present at both the + // start and the end of the time period defined by + // compare_duration and read_time. + // + // If compare_duration is not specified, then the only possible state_change + // is "UNUSED", which will be the state_change set for all assets present at + // read_time. + google.protobuf.Duration compare_duration = 5; + + // A field mask to specify the ListAssetsResult fields to be listed in the + // response. + // An empty field mask will list all fields. + google.protobuf.FieldMask field_mask = 7; + + // The value returned by the last `ListAssetsResponse`; indicates + // that this is a continuation of a prior `ListAssets` call, and + // that the system should return the next page of data. + string page_token = 8; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 9; +} + +// Response message for listing assets. +message ListAssetsResponse { + // Result containing the Asset and its State. + message ListAssetsResult { + // The change in state of the asset. + // + // When querying across two points in time this describes + // the change between the two points: ADDED, REMOVED, or ACTIVE. + // If there was no compare_duration supplied in the request the state change + // will be: UNUSED + enum StateChange { + // State change is unused, this is the canonical default for this enum. + UNUSED = 0; + + // Asset was added between the points in time. + ADDED = 1; + + // Asset was removed between the points in time. + REMOVED = 2; + + // Asset was present at both point(s) in time. + ACTIVE = 3; + } + + // Asset matching the search request. + Asset asset = 1; + + // State change of the asset between the points in time. + StateChange state_change = 2; + } + + // Assets matching the list request. + repeated ListAssetsResult list_assets_results = 1; + + // Time used for executing the list request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of assets matching the query. + int32 total_size = 4; +} + +// Request message for listing findings. +message ListFindingsRequest { + // Required. Name of the source the findings belong to. Its format is + // "organizations/[organization_id]/sources/[source_id], + // folders/[folder_id]/sources/[source_id], or + // projects/[project_id]/sources/[source_id]". To list across all sources + // provide a source_id of `-`. For example: + // organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + // projects/{projects_id}/sources/- + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; + + // Expression that defines the filter to apply across findings. + // The expression is a list of one 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. Examples include: + // + // * name + // * source_properties.a_property + // * security_marks.marks.marka + // + // 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. + // + // The following field and operator combinations are supported: + // + // * name: `=` + // * parent: `=`, `:` + // * resource_name: `=`, `:` + // * state: `=`, `:` + // * category: `=`, `:` + // * external_uri: `=`, `:` + // * event_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `event_time = "2019-06-10T16:07:18-07:00"` + // `event_time = 1560208038000` + // + // * severity: `=`, `:` + // * workflow_state: `=`, `:` + // * security_marks.marks: `=`, `:` + // * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + // + // For example, `source_properties.size = 100` is a valid filter string. + // + // Use a partial match on the empty string to filter based on a property + // existing: `source_properties.my_property : ""` + // + // Use a negated partial match on the empty string to filter based on a + // property not existing: `-source_properties.my_property : ""` + // + // * resource: + // * resource.name: `=`, `:` + // * resource.parent_name: `=`, `:` + // * resource.parent_display_name: `=`, `:` + // * resource.project_name: `=`, `:` + // * resource.project_display_name: `=`, `:` + // * resource.type: `=`, `:` + // * resource.folders.resource_folder: `=`, `:` + // * resource.display_name: `=`, `:` + string filter = 2; + + // Expression that defines what fields and order to use for sorting. The + // string value should follow SQL syntax: comma separated list of fields. For + // example: "name,resource_properties.a_property". The default sorting order + // is ascending. To specify descending order for a field, a suffix " desc" + // should be appended to the field name. For example: "name + // desc,source_properties.a_property". Redundant space characters in the + // syntax are insignificant. "name desc,source_properties.a_property" and " + // name desc , source_properties.a_property " are equivalent. + // + // The following fields are supported: + // name + // parent + // state + // category + // resource_name + // event_time + // source_properties + // security_marks.marks + string order_by = 3; + + // Time used as a reference point when filtering findings. The filter is + // limited to findings existing at the supplied time and their values are + // those at that specific time. Absence of this field will default to the + // API's version of NOW. + google.protobuf.Timestamp read_time = 4; + + // When compare_duration is set, the ListFindingsResult's "state_change" + // attribute is updated to indicate whether the finding had its state changed, + // the finding's state remained unchanged, or if the finding was added in any + // state during the compare_duration period of time that precedes the + // read_time. This is the time between (read_time - compare_duration) and + // read_time. + // + // The state_change value is derived based on the presence and state of the + // finding at the two points in time. Intermediate state changes between the + // two times don't affect the result. For example, the results aren't affected + // if the finding is made inactive and then active again. + // + // Possible "state_change" values when compare_duration is specified: + // + // * "CHANGED": indicates that the finding was present and matched the given + // filter at the start of compare_duration, but changed its + // state at read_time. + // * "UNCHANGED": indicates that the finding was present and matched the given + // filter at the start of compare_duration and did not change + // state at read_time. + // * "ADDED": indicates that the finding did not match the given filter or + // was not present at the start of compare_duration, but was + // present at read_time. + // * "REMOVED": indicates that the finding was present and matched the + // filter at the start of compare_duration, but did not match + // the filter at read_time. + // + // If compare_duration is not specified, then the only possible state_change + // is "UNUSED", which will be the state_change set for all findings present at + // read_time. + google.protobuf.Duration compare_duration = 5; + + // A field mask to specify the Finding fields to be listed in the response. + // An empty field mask will list all fields. + google.protobuf.FieldMask field_mask = 7; + + // The value returned by the last `ListFindingsResponse`; indicates + // that this is a continuation of a prior `ListFindings` call, and + // that the system should return the next page of data. + string page_token = 8; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 9; +} + +// Response message for listing findings. +message ListFindingsResponse { + // Result containing the Finding and its StateChange. + message ListFindingsResult { + // The change in state of the finding. + // + // When querying across two points in time this describes + // the change in the finding between the two points: CHANGED, UNCHANGED, + // ADDED, or REMOVED. Findings can not be deleted, so REMOVED implies that + // the finding at timestamp does not match the filter specified, but it did + // at timestamp - compare_duration. If there was no compare_duration + // supplied in the request the state change will be: UNUSED + enum StateChange { + // State change is unused, this is the canonical default for this enum. + UNUSED = 0; + + // The finding has changed state in some way between the points in time + // and existed at both points. + CHANGED = 1; + + // The finding has not changed state between the points in time and + // existed at both points. + UNCHANGED = 2; + + // The finding was created between the points in time. + ADDED = 3; + + // The finding at timestamp does not match the filter specified, but it + // did at timestamp - compare_duration. + REMOVED = 4; + } + + // Information related to the Google Cloud resource that is + // associated with this finding. + message Resource { + // The full resource name of the resource. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string name = 1; + + // The human readable name of the resource. + string display_name = 8; + + // The full resource type of the resource. + string type = 6; + + // The full resource name of project that the resource belongs to. + string project_name = 2; + + // The project ID that the resource belongs to. + string project_display_name = 3; + + // The full resource name of resource's parent. + string parent_name = 4; + + // The human readable name of resource's parent. + string parent_display_name = 5; + + // Contains a Folder message for each folder in the assets ancestry. + // The first folder is the deepest nested folder, and the last folder is + // the folder directly under the Organization. + repeated Folder folders = 7; + } + + // Finding matching the search request. + Finding finding = 1; + + // State change of the finding between the points in time. + StateChange state_change = 2; + + // Output only. Resource that is associated with this finding. + Resource resource = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Findings matching the list request. + repeated ListFindingsResult list_findings_results = 1; + + // Time used for executing the list request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of findings matching the query. + int32 total_size = 4; +} + +// Request message for updating a finding's state. +message SetFindingStateRequest { + // Required. The [relative resource + // name](https://cloud.google.com/apis/design/resource_names#relative_resource_name) + // of the finding. Example: + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", + // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}", + // "projects/{project_id}/sources/{source_id}/findings/{finding_id}". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Finding" + } + ]; + + // Required. The desired State of the finding. + Finding.State state = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The time at which the updated state takes effect. + google.protobuf.Timestamp start_time = 3 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for updating a finding's mute status. +message SetMuteRequest { + // Required. The [relative resource + // name](https://cloud.google.com/apis/design/resource_names#relative_resource_name) + // of the finding. Example: + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", + // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}", + // "projects/{project_id}/sources/{source_id}/findings/{finding_id}". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Finding" + } + ]; + + // Required. The desired state of the Mute. + Finding.Mute mute = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for running asset discovery for an organization. +message RunAssetDiscoveryRequest { + // Required. Name of the organization to run asset discovery for. Its format + // is "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; +} + +// Request message for updating a ExternalSystem resource. +message UpdateExternalSystemRequest { + // Required. The external system resource to update. + ExternalSystem external_system = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the external system resource. + // + // If empty all mutable fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating or creating a finding. +message UpdateFindingRequest { + // Required. The finding resource to update or create if it does not already + // exist. parent, security_marks, and update_time will be ignored. + // + // In the case of creation, the finding id portion of the name must be + // alphanumeric and less than or equal to 32 characters and greater than 0 + // characters in length. + Finding finding = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the finding resource. This field should + // not be specified when creating a finding. + // + // When updating a finding, an empty mask is treated as updating all mutable + // fields and replacing source_properties. Individual source_properties can + // be added/updated by using "source_properties." in the field + // mask. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating a mute config. +message UpdateMuteConfigRequest { + // Required. The mute config being updated. + MuteConfig mute_config = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + // If empty all mutable fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating a notification config. +message UpdateNotificationConfigRequest { + // Required. The notification config to update. + NotificationConfig notification_config = 1 + [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the notification config. + // + // If empty all mutable fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating an organization's settings. +message UpdateOrganizationSettingsRequest { + // Required. The organization settings resource to update. + OrganizationSettings organization_settings = 1 + [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the settings resource. + // + // If empty all mutable fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating Security Health Analytics custom modules. +message UpdateSecurityHealthAnalyticsCustomModuleRequest { + // Required. The SecurityHealthAnalytics custom module to update. + SecurityHealthAnalyticsCustomModule security_health_analytics_custom_module = + 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to update. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating a source. +message UpdateSourceRequest { + // Required. The source resource to update. + Source source = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the source resource. + // + // If empty all mutable fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating a SecurityMarks resource. +message UpdateSecurityMarksRequest { + // Required. The security marks resource to update. + SecurityMarks security_marks = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the security marks resource. + // + // The field mask must not contain duplicate fields. + // If empty or set to "marks", all marks will be replaced. Individual + // marks can be updated using "marks.". + google.protobuf.FieldMask update_mask = 2; + + // The time at which the updated SecurityMarks take effect. + // If not set uses current server time. Updates will be applied to the + // SecurityMarks that are active immediately preceding this time. Must be + // earlier or equal to the server time. + google.protobuf.Timestamp start_time = 3; +} + +// Request message for creating a BigQuery export. +message CreateBigQueryExportRequest { + // Required. The name of the parent resource of the new BigQuery export. Its + // format is "organizations/[organization_id]", "folders/[folder_id]", or + // "projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/BigQueryExport" + } + ]; + + // Required. The BigQuery export being created. + BigQueryExport big_query_export = 2 [(google.api.field_behavior) = REQUIRED]; + + // 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. + string big_query_export_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for updating a BigQuery export. +message UpdateBigQueryExportRequest { + // Required. The BigQuery export being updated. + BigQueryExport big_query_export = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + // If empty all mutable fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for listing BigQuery exports at a given scope e.g. +// organization, folder or project. +message ListBigQueryExportsRequest { + // Required. The parent, which owns the collection of BigQuery exports. Its + // format is "organizations/[organization_id]", "folders/[folder_id]", + // "projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/BigQueryExport" + } + ]; + + // 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. + int32 page_size = 2; + + // 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. + string page_token = 3; +} + +// Response message for listing BigQuery exports. +message ListBigQueryExportsResponse { + // The BigQuery exports from the specified parent. + repeated BigQueryExport big_query_exports = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for deleting a BigQuery export. +message DeleteBigQueryExportRequest { + // Required. The name of the BigQuery export to delete. Its format is + // organizations/{organization}/bigQueryExports/{export_id}, + // folders/{folder}/bigQueryExports/{export_id}, or + // projects/{project}/bigQueryExports/{export_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/BigQueryExport" + } + ]; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/source.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/source.proto new file mode 100644 index 00000000000..0aed0286225 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/source.proto @@ -0,0 +1,69 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Security Command Center finding source. A finding source +// is an entity or a mechanism that can produce a finding. A source is like a +// container of findings that come from the same scanner, logger, monitor, and +// other tools. +message Source { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/Source" + pattern: "organizations/{organization}/sources/{source}" + pattern: "folders/{folder}/sources/{source}" + pattern: "projects/{project}/sources/{source}" + }; + + // The relative resource name of this source. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/sources/{source_id}" + string name = 1; + + // The source's display name. + // A source's display name must be unique amongst its siblings, for example, + // two sources with the same parent can't share the same display name. + // The display name must have a length between 1 and 64 characters + // (inclusive). + string display_name = 2; + + // The description of the source (max of 1024 characters). + // Example: + // "Web Security Scanner is a web security scanner for common + // vulnerabilities in App Engine applications. It can automatically + // scan and detect four common vulnerabilities, including cross-site-scripting + // (XSS), Flash injection, mixed content (HTTP in HTTPS), and + // outdated or insecure libraries." + string description = 3; + + // The canonical name of the finding. It's either + // "organizations/{organization_id}/sources/{source_id}", + // "folders/{folder_id}/sources/{source_id}" or + // "projects/{project_number}/sources/{source_id}", + // depending on the closest CRM ancestor of the resource associated with the + // finding. + string canonical_name = 14; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/vulnerability.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/vulnerability.proto new file mode 100644 index 00000000000..457e88c7319 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/vulnerability.proto @@ -0,0 +1,216 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "VulnerabilityProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Refers to common vulnerability fields e.g. cve, cvss, cwe etc. +message Vulnerability { + // CVE stands for Common Vulnerabilities and Exposures + // (https://cve.mitre.org/about/) + Cve cve = 1; +} + +// CVE stands for Common Vulnerabilities and Exposures. +// More information: https://cve.mitre.org +message Cve { + // The unique identifier for the vulnerability. e.g. CVE-2021-34527 + string id = 1; + + // Additional information about the CVE. + // e.g. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-34527 + repeated Reference references = 2; + + // Describe Common Vulnerability Scoring System specified at + // https://www.first.org/cvss/v3.1/specification-document + Cvssv3 cvssv3 = 3; + + // Whether upstream fix is available for the CVE. + bool upstream_fix_available = 4; +} + +// Additional Links +message Reference { + // Source of the reference e.g. NVD + string source = 1; + + // Uri for the mentioned source e.g. + // https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-34527. + string uri = 2; +} + +// Common Vulnerability Scoring System version 3. +message Cvssv3 { + // This metric reflects the context by which vulnerability exploitation is + // possible. + enum AttackVector { + // Invalid value. + ATTACK_VECTOR_UNSPECIFIED = 0; + + // The vulnerable component is bound to the network stack and the set of + // possible attackers extends beyond the other options listed below, up to + // and including the entire Internet. + ATTACK_VECTOR_NETWORK = 1; + + // The vulnerable component is bound to the network stack, but the attack is + // limited at the protocol level to a logically adjacent topology. + ATTACK_VECTOR_ADJACENT = 2; + + // The vulnerable component is not bound to the network stack and the + // attacker's path is via read/write/execute capabilities. + ATTACK_VECTOR_LOCAL = 3; + + // The attack requires the attacker to physically touch or manipulate the + // vulnerable component. + ATTACK_VECTOR_PHYSICAL = 4; + } + + // This metric describes the conditions beyond the attacker's control that + // must exist in order to exploit the vulnerability. + enum AttackComplexity { + // Invalid value. + ATTACK_COMPLEXITY_UNSPECIFIED = 0; + + // Specialized access conditions or extenuating circumstances do not exist. + // An attacker can expect repeatable success when attacking the vulnerable + // component. + ATTACK_COMPLEXITY_LOW = 1; + + // A successful attack depends on conditions beyond the attacker's control. + // That is, a successful attack cannot be accomplished at will, but requires + // the attacker to invest in some measurable amount of effort in preparation + // or execution against the vulnerable component before a successful attack + // can be expected. + ATTACK_COMPLEXITY_HIGH = 2; + } + + // This metric describes the level of privileges an attacker must possess + // before successfully exploiting the vulnerability. + enum PrivilegesRequired { + // Invalid value. + PRIVILEGES_REQUIRED_UNSPECIFIED = 0; + + // The attacker is unauthorized prior to attack, and therefore does not + // require any access to settings or files of the vulnerable system to + // carry out an attack. + PRIVILEGES_REQUIRED_NONE = 1; + + // The attacker requires privileges that provide basic user capabilities + // that could normally affect only settings and files owned by a user. + // Alternatively, an attacker with Low privileges has the ability to access + // only non-sensitive resources. + PRIVILEGES_REQUIRED_LOW = 2; + + // The attacker requires privileges that provide significant (e.g., + // administrative) control over the vulnerable component allowing access to + // component-wide settings and files. + PRIVILEGES_REQUIRED_HIGH = 3; + } + + // This metric captures the requirement for a human user, other than the + // attacker, to participate in the successful compromise of the vulnerable + // component. + enum UserInteraction { + // Invalid value. + USER_INTERACTION_UNSPECIFIED = 0; + + // The vulnerable system can be exploited without interaction from any user. + USER_INTERACTION_NONE = 1; + + // Successful exploitation of this vulnerability requires a user to take + // some action before the vulnerability can be exploited. + USER_INTERACTION_REQUIRED = 2; + } + + // The Scope metric captures whether a vulnerability in one vulnerable + // component impacts resources in components beyond its security scope. + enum Scope { + // Invalid value. + SCOPE_UNSPECIFIED = 0; + + // An exploited vulnerability can only affect resources managed by the same + // security authority. + SCOPE_UNCHANGED = 1; + + // An exploited vulnerability can affect resources beyond the security scope + // managed by the security authority of the vulnerable component. + SCOPE_CHANGED = 2; + } + + // The Impact metrics capture the effects of a successfully exploited + // vulnerability on the component that suffers the worst outcome that is most + // directly and predictably associated with the attack. + enum Impact { + // Invalid value. + IMPACT_UNSPECIFIED = 0; + + // High impact. + IMPACT_HIGH = 1; + + // Low impact. + IMPACT_LOW = 2; + + // No impact. + IMPACT_NONE = 3; + } + + // The base score is a function of the base metric scores. + double base_score = 1; + + // Base Metrics + // Represents the intrinsic characteristics of a vulnerability that are + // constant over time and across user environments. + // This metric reflects the context by which vulnerability exploitation is + // possible. + AttackVector attack_vector = 5; + + // This metric describes the conditions beyond the attacker's control that + // must exist in order to exploit the vulnerability. + AttackComplexity attack_complexity = 6; + + // This metric describes the level of privileges an attacker must possess + // before successfully exploiting the vulnerability. + PrivilegesRequired privileges_required = 7; + + // This metric captures the requirement for a human user, other than the + // attacker, to participate in the successful compromise of the vulnerable + // component. + UserInteraction user_interaction = 8; + + // The Scope metric captures whether a vulnerability in one vulnerable + // component impacts resources in components beyond its security scope. + Scope scope = 9; + + // This metric measures the impact to the confidentiality of the information + // resources managed by a software component due to a successfully exploited + // vulnerability. + Impact confidentiality_impact = 10; + + // This metric measures the impact to integrity of a successfully exploited + // vulnerability. + Impact integrity_impact = 11; + + // This metric measures the impact to the availability of the impacted + // component resulting from a successfully exploited vulnerability. + Impact availability_impact = 12; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.bulk_mute_findings.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.bulk_mute_findings.js new file mode 100644 index 00000000000..1e0ce0ee9c7 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.bulk_mute_findings.js @@ -0,0 +1,87 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, at which bulk action needs to be applied. Its format + * is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + */ + // const parent = 'abc123' + /** + * Expression that identifies findings that should be updated. + * 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. + */ + // const filter = 'abc123' + /** + * This can be a mute configuration name or any identifier for mute/unmute + * of findings based on the filter. + */ + // const muteAnnotation = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callBulkMuteFindings() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await securitycenterClient.bulkMuteFindings(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBulkMuteFindings(); + // [END securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_big_query_export.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_big_query_export.js new file mode 100644 index 00000000000..f5ffc8a929f --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_big_query_export.js @@ -0,0 +1,76 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, bigQueryExport, bigQueryExportId) { + // [START securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the parent resource of the new BigQuery export. Its + * format is "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + */ + // const parent = 'abc123' + /** + * Required. The BigQuery export being created. + */ + // const bigQueryExport = {} + /** + * 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. + */ + // const bigQueryExportId = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateBigQueryExport() { + // Construct request + const request = { + parent, + bigQueryExport, + bigQueryExportId, + }; + + // Run request + const response = await securitycenterClient.createBigQueryExport(request); + console.log(response); + } + + callCreateBigQueryExport(); + // [END securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_finding.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_finding.js new file mode 100644 index 00000000000..4ef3d71c721 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_finding.js @@ -0,0 +1,75 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, findingId, finding) { + // [START securitycenter_v1_generated_SecurityCenter_CreateFinding_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new finding's parent. Its format should be + * "organizations/[organization_id]/sources/[source_id]". + */ + // const parent = 'abc123' + /** + * Required. Unique identifier provided by the client within the parent scope. + * It must be alphanumeric and less than or equal to 32 characters and + * greater than 0 characters in length. + */ + // const findingId = 'abc123' + /** + * Required. The Finding being created. The name and security_marks will be + * ignored as they are both output only fields on this resource. + */ + // const finding = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateFinding() { + // Construct request + const request = { + parent, + findingId, + finding, + }; + + // Run request + const response = await securitycenterClient.createFinding(request); + console.log(response); + } + + callCreateFinding(); + // [END securitycenter_v1_generated_SecurityCenter_CreateFinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_mute_config.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_mute_config.js new file mode 100644 index 00000000000..dec237a4b8e --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_mute_config.js @@ -0,0 +1,76 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, muteConfig, muteConfigId) { + // [START securitycenter_v1_generated_SecurityCenter_CreateMuteConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new mute configs's parent. Its format is + * "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + */ + // const parent = 'abc123' + /** + * Required. The mute config being created. + */ + // const muteConfig = {} + /** + * 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. + */ + // const muteConfigId = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateMuteConfig() { + // Construct request + const request = { + parent, + muteConfig, + muteConfigId, + }; + + // Run request + const response = await securitycenterClient.createMuteConfig(request); + console.log(response); + } + + callCreateMuteConfig(); + // [END securitycenter_v1_generated_SecurityCenter_CreateMuteConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_notification_config.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_notification_config.js new file mode 100644 index 00000000000..51e50e56fdf --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_notification_config.js @@ -0,0 +1,78 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, configId, notificationConfig) { + // [START securitycenter_v1_generated_SecurityCenter_CreateNotificationConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new notification config's parent. Its format + * is "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + */ + // const parent = 'abc123' + /** + * Required. + * Unique identifier provided by the client within the parent scope. + * It must be between 1 and 128 characters and contain alphanumeric + * characters, underscores, or hyphens only. + */ + // const configId = 'abc123' + /** + * Required. The notification config being created. The name and the service + * account will be ignored as they are both output only fields on this + * resource. + */ + // const notificationConfig = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateNotificationConfig() { + // Construct request + const request = { + parent, + configId, + notificationConfig, + }; + + // Run request + const response = await securitycenterClient.createNotificationConfig(request); + console.log(response); + } + + callCreateNotificationConfig(); + // [END securitycenter_v1_generated_SecurityCenter_CreateNotificationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_security_health_analytics_custom_module.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_security_health_analytics_custom_module.js new file mode 100644 index 00000000000..1bd26975723 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_security_health_analytics_custom_module.js @@ -0,0 +1,71 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, securityHealthAnalyticsCustomModule) { + // [START securitycenter_v1_generated_SecurityCenter_CreateSecurityHealthAnalyticsCustomModule_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new custom module's parent. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings", + * "folders/{folder}/securityHealthAnalyticsSettings", or + * "projects/{project}/securityHealthAnalyticsSettings" + */ + // const parent = 'abc123' + /** + * Required. SecurityHealthAnalytics custom module to create. The provided + * name is ignored and reset with provided parent information and + * server-generated ID. + */ + // const securityHealthAnalyticsCustomModule = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateSecurityHealthAnalyticsCustomModule() { + // Construct request + const request = { + parent, + securityHealthAnalyticsCustomModule, + }; + + // Run request + const response = await securitycenterClient.createSecurityHealthAnalyticsCustomModule(request); + console.log(response); + } + + callCreateSecurityHealthAnalyticsCustomModule(); + // [END securitycenter_v1_generated_SecurityCenter_CreateSecurityHealthAnalyticsCustomModule_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_source.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_source.js new file mode 100644 index 00000000000..65ebcff52cb --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_source.js @@ -0,0 +1,68 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, source) { + // [START securitycenter_v1_generated_SecurityCenter_CreateSource_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new source's parent. Its format should be + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + /** + * Required. The Source being created, only the display_name and description + * will be used. All other fields will be ignored. + */ + // const source = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateSource() { + // Construct request + const request = { + parent, + source, + }; + + // Run request + const response = await securitycenterClient.createSource(request); + console.log(response); + } + + callCreateSource(); + // [END securitycenter_v1_generated_SecurityCenter_CreateSource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_big_query_export.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_big_query_export.js new file mode 100644 index 00000000000..8431ed836b6 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_big_query_export.js @@ -0,0 +1,64 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the BigQuery export to delete. Its format is + * organizations/{organization}/bigQueryExports/{export_id}, + * folders/{folder}/bigQueryExports/{export_id}, or + * projects/{project}/bigQueryExports/{export_id} + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callDeleteBigQueryExport() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.deleteBigQueryExport(request); + console.log(response); + } + + callDeleteBigQueryExport(); + // [END securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_mute_config.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_mute_config.js new file mode 100644 index 00000000000..52be7752588 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_mute_config.js @@ -0,0 +1,64 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_DeleteMuteConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the mute config to delete. Its format is + * organizations/{organization}/muteConfigs/{config_id}, + * folders/{folder}/muteConfigs/{config_id}, or + * projects/{project}/muteConfigs/{config_id} + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callDeleteMuteConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.deleteMuteConfig(request); + console.log(response); + } + + callDeleteMuteConfig(); + // [END securitycenter_v1_generated_SecurityCenter_DeleteMuteConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_notification_config.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_notification_config.js new file mode 100644 index 00000000000..51096d1b3e3 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_notification_config.js @@ -0,0 +1,64 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_DeleteNotificationConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the notification config to delete. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]", + * "folders/[folder_id]/notificationConfigs/[config_id]", + * or "projects/[project_id]/notificationConfigs/[config_id]". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callDeleteNotificationConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.deleteNotificationConfig(request); + console.log(response); + } + + callDeleteNotificationConfig(); + // [END securitycenter_v1_generated_SecurityCenter_DeleteNotificationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_security_health_analytics_custom_module.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_security_health_analytics_custom_module.js new file mode 100644 index 00000000000..86a77685ef9 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_security_health_analytics_custom_module.js @@ -0,0 +1,65 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_DeleteSecurityHealthAnalyticsCustomModule_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the custom module to delete. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings/customModules/{customModule}", + * "folders/{folder}/securityHealthAnalyticsSettings/customModules/{customModule}", + * or + * "projects/{project}/securityHealthAnalyticsSettings/customModules/{customModule}" + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callDeleteSecurityHealthAnalyticsCustomModule() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.deleteSecurityHealthAnalyticsCustomModule(request); + console.log(response); + } + + callDeleteSecurityHealthAnalyticsCustomModule(); + // [END securitycenter_v1_generated_SecurityCenter_DeleteSecurityHealthAnalyticsCustomModule_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_big_query_export.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_big_query_export.js new file mode 100644 index 00000000000..9d29e830f32 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_big_query_export.js @@ -0,0 +1,64 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the BigQuery export to retrieve. Its format is + * organizations/{organization}/bigQueryExports/{export_id}, + * folders/{folder}/bigQueryExports/{export_id}, or + * projects/{project}/bigQueryExports/{export_id} + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetBigQueryExport() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getBigQueryExport(request); + console.log(response); + } + + callGetBigQueryExport(); + // [END securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_effective_security_health_analytics_custom_module.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_effective_security_health_analytics_custom_module.js new file mode 100644 index 00000000000..476cc6aaf3f --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_effective_security_health_analytics_custom_module.js @@ -0,0 +1,65 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_GetEffectiveSecurityHealthAnalyticsCustomModule_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the effective custom module to get. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}", + * "folders/{folder}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}", + * or + * "projects/{project}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}" + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetEffectiveSecurityHealthAnalyticsCustomModule() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getEffectiveSecurityHealthAnalyticsCustomModule(request); + console.log(response); + } + + callGetEffectiveSecurityHealthAnalyticsCustomModule(); + // [END securitycenter_v1_generated_SecurityCenter_GetEffectiveSecurityHealthAnalyticsCustomModule_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_iam_policy.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_iam_policy.js new file mode 100644 index 00000000000..3901f396ce1 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_iam_policy.js @@ -0,0 +1,67 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource) { + // [START securitycenter_v1_generated_SecurityCenter_GetIamPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + */ + // const options = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await securitycenterClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END securitycenter_v1_generated_SecurityCenter_GetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_mute_config.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_mute_config.js new file mode 100644 index 00000000000..e3c35dce8c9 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_mute_config.js @@ -0,0 +1,64 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_GetMuteConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the mute config to retrieve. Its format is + * organizations/{organization}/muteConfigs/{config_id}, + * folders/{folder}/muteConfigs/{config_id}, or + * projects/{project}/muteConfigs/{config_id} + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetMuteConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getMuteConfig(request); + console.log(response); + } + + callGetMuteConfig(); + // [END securitycenter_v1_generated_SecurityCenter_GetMuteConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_notification_config.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_notification_config.js new file mode 100644 index 00000000000..b0d9970d8f5 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_notification_config.js @@ -0,0 +1,64 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_GetNotificationConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the notification config to get. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]", + * "folders/[folder_id]/notificationConfigs/[config_id]", + * or "projects/[project_id]/notificationConfigs/[config_id]". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetNotificationConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getNotificationConfig(request); + console.log(response); + } + + callGetNotificationConfig(); + // [END securitycenter_v1_generated_SecurityCenter_GetNotificationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_organization_settings.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_organization_settings.js new file mode 100644 index 00000000000..06be4bf79f5 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_organization_settings.js @@ -0,0 +1,62 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_GetOrganizationSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to get organization settings for. Its + * format is "organizations/[organization_id]/organizationSettings". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetOrganizationSettings() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getOrganizationSettings(request); + console.log(response); + } + + callGetOrganizationSettings(); + // [END securitycenter_v1_generated_SecurityCenter_GetOrganizationSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_security_health_analytics_custom_module.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_security_health_analytics_custom_module.js new file mode 100644 index 00000000000..1c231328f48 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_security_health_analytics_custom_module.js @@ -0,0 +1,65 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_GetSecurityHealthAnalyticsCustomModule_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the custom module to get. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings/customModules/{customModule}", + * "folders/{folder}/securityHealthAnalyticsSettings/customModules/{customModule}", + * or + * "projects/{project}/securityHealthAnalyticsSettings/customModules/{customModule}" + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetSecurityHealthAnalyticsCustomModule() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getSecurityHealthAnalyticsCustomModule(request); + console.log(response); + } + + callGetSecurityHealthAnalyticsCustomModule(); + // [END securitycenter_v1_generated_SecurityCenter_GetSecurityHealthAnalyticsCustomModule_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_source.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_source.js new file mode 100644 index 00000000000..2e45be1ae47 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_source.js @@ -0,0 +1,62 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_GetSource_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Relative resource name of the source. Its format is + * "organizations/[organization_id]/source/[source_id]". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetSource() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getSource(request); + console.log(response); + } + + callGetSource(); + // [END securitycenter_v1_generated_SecurityCenter_GetSource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.group_assets.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.group_assets.js new file mode 100644 index 00000000000..9a77c9a7694 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.group_assets.js @@ -0,0 +1,176 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, groupBy) { + // [START securitycenter_v1_generated_SecurityCenter_GroupAssets_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the parent to group the assets by. Its format is + * "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across assets. + * 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 Asset resource. Examples include: + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * 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. + * The following field and operator combinations are supported: + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * For example, `resource_properties.size = 100` is a valid filter string. + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + */ + // const filter = 'abc123' + /** + * Required. Expression that defines what assets fields to use for grouping. + * The string value should follow SQL syntax: comma separated list of fields. + * For example: + * "security_center_properties.resource_project,security_center_properties.project". + * The following fields are supported when compare_duration is not set: + * * security_center_properties.resource_project + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * * security_center_properties.resource_parent_display_name + * The following fields are supported when compare_duration is set: + * * security_center_properties.resource_type + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_parent_display_name + */ + // const groupBy = 'abc123' + /** + * When compare_duration is set, the GroupResult's "state_change" property is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * The state change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * Possible "state_change" values when compare_duration is specified: + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * If this field is set then `state_change` must be a specified field in + * `group_by`. + */ + // const compareDuration = {} + /** + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + */ + // const readTime = {} + /** + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGroupAssets() { + // Construct request + const request = { + parent, + groupBy, + }; + + // Run request + const iterable = await securitycenterClient.groupAssetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callGroupAssets(); + // [END securitycenter_v1_generated_SecurityCenter_GroupAssets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.group_findings.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.group_findings.js new file mode 100644 index 00000000000..e86776056e5 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.group_findings.js @@ -0,0 +1,180 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, groupBy) { + // [START securitycenter_v1_generated_SecurityCenter_GroupFindings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]", + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]. To groupBy across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + * or projects/{project_id}/sources/- + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across findings. + * The expression is a list of one 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. Examples include: + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * 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. + * The following field and operator combinations are supported: + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * * severity: `=`, `:` + * * workflow_state: `=`, `:` + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * For example, `source_properties.size = 100` is a valid filter string. + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * * resource: + * * resource.name: `=`, `:` + * * resource.parent_name: `=`, `:` + * * resource.parent_display_name: `=`, `:` + * * resource.project_name: `=`, `:` + * * resource.project_display_name: `=`, `:` + * * resource.type: `=`, `:` + */ + // const filter = 'abc123' + /** + * Required. Expression that defines what assets fields to use for grouping + * (including `state_change`). The string value should follow SQL syntax: + * comma separated list of fields. For example: "parent,resource_name". + * The following fields are supported: + * * resource_name + * * category + * * state + * * parent + * * severity + * The following fields are supported when compare_duration is set: + * * state_change + */ + // const groupBy = 'abc123' + /** + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + */ + // const readTime = {} + /** + * When compare_duration is set, the GroupResult's "state_change" attribute is + * updated to indicate whether the finding had its state changed, the + * finding's state remained unchanged, or if the finding was added during the + * compare_duration period of time that precedes the read_time. This is the + * time between (read_time - compare_duration) and read_time. + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * Possible "state_change" values when compare_duration is specified: + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present + * at read_time. + * If this field is set then `state_change` must be a specified field in + * `group_by`. + */ + // const compareDuration = {} + /** + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGroupFindings() { + // Construct request + const request = { + parent, + groupBy, + }; + + // Run request + const iterable = await securitycenterClient.groupFindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callGroupFindings(); + // [END securitycenter_v1_generated_SecurityCenter_GroupFindings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_assets.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_assets.js new file mode 100644 index 00000000000..0c96ef702f2 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_assets.js @@ -0,0 +1,187 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_ListAssets_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the parent resource that contains the assets. The + * value that you can specify on parent depends on the method in which you + * specify parent. You can specify one of the following values: + * "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across assets. + * 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 Asset resource. Examples include: + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * 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. + * The following are the allowed field and operator combinations: + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * For example, `resource_properties.size = 100` is a valid filter string. + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + */ + // const filter = 'abc123' + /** + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * The following fields are supported: + * name + * update_time + * resource_properties + * security_marks.marks + * security_center_properties.resource_name + * security_center_properties.resource_display_name + * security_center_properties.resource_parent + * security_center_properties.resource_parent_display_name + * security_center_properties.resource_project + * security_center_properties.resource_project_display_name + * security_center_properties.resource_type + */ + // const orderBy = 'abc123' + /** + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + */ + // const readTime = {} + /** + * When compare_duration is set, the ListAssetsResult's "state_change" + * attribute is updated to indicate whether the asset was added, removed, or + * remained present during the compare_duration period of time that precedes + * the read_time. This is the time between (read_time - compare_duration) and + * read_time. + * The state_change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * Possible "state_change" values when compare_duration is specified: + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + */ + // const compareDuration = {} + /** + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + */ + // const fieldMask = {} + /** + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListAssets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listAssetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAssets(); + // [END securitycenter_v1_generated_SecurityCenter_ListAssets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_big_query_exports.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_big_query_exports.js new file mode 100644 index 00000000000..0cd39cf6921 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_big_query_exports.js @@ -0,0 +1,79 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns the collection of BigQuery exports. Its + * format is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + */ + // const parent = 'abc123' + /** + * 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. + */ + // const pageSize = 1234 + /** + * 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. + */ + // const pageToken = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListBigQueryExports() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listBigQueryExportsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBigQueryExports(); + // [END securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_descendant_security_health_analytics_custom_modules.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_descendant_security_health_analytics_custom_modules.js new file mode 100644 index 00000000000..778c97b4877 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_descendant_security_health_analytics_custom_modules.js @@ -0,0 +1,75 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_ListDescendantSecurityHealthAnalyticsCustomModules_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of parent to list descendant custom modules. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings", + * "folders/{folder}/securityHealthAnalyticsSettings", or + * "projects/{project}/securityHealthAnalyticsSettings" + */ + // const parent = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + /** + * The value returned by the last call indicating a continuation + */ + // const pageToken = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListDescendantSecurityHealthAnalyticsCustomModules() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listDescendantSecurityHealthAnalyticsCustomModulesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDescendantSecurityHealthAnalyticsCustomModules(); + // [END securitycenter_v1_generated_SecurityCenter_ListDescendantSecurityHealthAnalyticsCustomModules_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_effective_security_health_analytics_custom_modules.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_effective_security_health_analytics_custom_modules.js new file mode 100644 index 00000000000..5eac21f2c77 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_effective_security_health_analytics_custom_modules.js @@ -0,0 +1,75 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_ListEffectiveSecurityHealthAnalyticsCustomModules_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of parent to list effective custom modules. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings", + * "folders/{folder}/securityHealthAnalyticsSettings", or + * "projects/{project}/securityHealthAnalyticsSettings" + */ + // const parent = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + /** + * The value returned by the last call indicating a continuation + */ + // const pageToken = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListEffectiveSecurityHealthAnalyticsCustomModules() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listEffectiveSecurityHealthAnalyticsCustomModulesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListEffectiveSecurityHealthAnalyticsCustomModules(); + // [END securitycenter_v1_generated_SecurityCenter_ListEffectiveSecurityHealthAnalyticsCustomModules_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_findings.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_findings.js new file mode 100644 index 00000000000..909c58a0515 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_findings.js @@ -0,0 +1,191 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_ListFindings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id], + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]". To list across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + * projects/{projects_id}/sources/- + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across findings. + * The expression is a list of one 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. Examples include: + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * 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. + * The following field and operator combinations are supported: + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * * severity: `=`, `:` + * * workflow_state: `=`, `:` + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * For example, `source_properties.size = 100` is a valid filter string. + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * * resource: + * * resource.name: `=`, `:` + * * resource.parent_name: `=`, `:` + * * resource.parent_display_name: `=`, `:` + * * resource.project_name: `=`, `:` + * * resource.project_display_name: `=`, `:` + * * resource.type: `=`, `:` + * * resource.folders.resource_folder: `=`, `:` + * * resource.display_name: `=`, `:` + */ + // const filter = 'abc123' + /** + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * The following fields are supported: + * name + * parent + * state + * category + * resource_name + * event_time + * source_properties + * security_marks.marks + */ + // const orderBy = 'abc123' + /** + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + */ + // const readTime = {} + /** + * When compare_duration is set, the ListFindingsResult's "state_change" + * attribute is updated to indicate whether the finding had its state changed, + * the finding's state remained unchanged, or if the finding was added in any + * state during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * Possible "state_change" values when compare_duration is specified: + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present at + * read_time. + */ + // const compareDuration = {} + /** + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + */ + // const fieldMask = {} + /** + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListFindings() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listFindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFindings(); + // [END securitycenter_v1_generated_SecurityCenter_ListFindings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_mute_configs.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_mute_configs.js new file mode 100644 index 00000000000..3427c281eb3 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_mute_configs.js @@ -0,0 +1,79 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_ListMuteConfigs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns the collection of mute configs. Its format + * is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + */ + // const parent = 'abc123' + /** + * 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. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListMuteConfigs` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListMuteConfigs` must + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListMuteConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listMuteConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMuteConfigs(); + // [END securitycenter_v1_generated_SecurityCenter_ListMuteConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_notification_configs.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_notification_configs.js new file mode 100644 index 00000000000..7a0dfec9fce --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_notification_configs.js @@ -0,0 +1,76 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_ListNotificationConfigs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the parent in which to list the notification + * configurations. Its format is "organizations/[organization_id]", + * "folders/[folder_id]", or "projects/[project_id]". + */ + // const parent = 'abc123' + /** + * The value returned by the last `ListNotificationConfigsResponse`; indicates + * that this is a continuation of a prior `ListNotificationConfigs` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListNotificationConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listNotificationConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListNotificationConfigs(); + // [END securitycenter_v1_generated_SecurityCenter_ListNotificationConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_security_health_analytics_custom_modules.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_security_health_analytics_custom_modules.js new file mode 100644 index 00000000000..513f96d67aa --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_security_health_analytics_custom_modules.js @@ -0,0 +1,75 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_ListSecurityHealthAnalyticsCustomModules_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of parent to list custom modules. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings", + * "folders/{folder}/securityHealthAnalyticsSettings", or + * "projects/{project}/securityHealthAnalyticsSettings" + */ + // const parent = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + /** + * The value returned by the last call indicating a continuation + */ + // const pageToken = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListSecurityHealthAnalyticsCustomModules() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listSecurityHealthAnalyticsCustomModulesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSecurityHealthAnalyticsCustomModules(); + // [END securitycenter_v1_generated_SecurityCenter_ListSecurityHealthAnalyticsCustomModules_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_sources.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_sources.js new file mode 100644 index 00000000000..e1f7a076417 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_sources.js @@ -0,0 +1,76 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_ListSources_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the parent of sources to list. Its format should + * be "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + */ + // const parent = 'abc123' + /** + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListSources() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listSourcesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSources(); + // [END securitycenter_v1_generated_SecurityCenter_ListSources_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.run_asset_discovery.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.run_asset_discovery.js new file mode 100644 index 00000000000..9e9e4f42480 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.run_asset_discovery.js @@ -0,0 +1,63 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to run asset discovery for. Its format + * is "organizations/[organization_id]". + */ + // const parent = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callRunAssetDiscovery() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await securitycenterClient.runAssetDiscovery(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRunAssetDiscovery(); + // [END securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_finding_state.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_finding_state.js new file mode 100644 index 00000000000..5ff07ee6428 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_finding_state.js @@ -0,0 +1,76 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, state, startTime) { + // [START securitycenter_v1_generated_SecurityCenter_SetFindingState_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource + * name (https://cloud.google.com/apis/design/resource_names#relative_resource_name) + * of the finding. Example: + * "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", + * "folders/{folder_id}/sources/{source_id}/findings/{finding_id}", + * "projects/{project_id}/sources/{source_id}/findings/{finding_id}". + */ + // const name = 'abc123' + /** + * Required. The desired State of the finding. + */ + // const state = {} + /** + * Required. The time at which the updated state takes effect. + */ + // const startTime = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callSetFindingState() { + // Construct request + const request = { + name, + state, + startTime, + }; + + // Run request + const response = await securitycenterClient.setFindingState(request); + console.log(response); + } + + callSetFindingState(); + // [END securitycenter_v1_generated_SecurityCenter_SetFindingState_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_iam_policy.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_iam_policy.js new file mode 100644 index 00000000000..828a587ecf1 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_iam_policy.js @@ -0,0 +1,77 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource, policy) { + // [START securitycenter_v1_generated_SecurityCenter_SetIamPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + */ + // const policy = {} + /** + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * `paths: "bindings, etag"` + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await securitycenterClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END securitycenter_v1_generated_SecurityCenter_SetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_mute.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_mute.js new file mode 100644 index 00000000000..d1e22987715 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_mute.js @@ -0,0 +1,71 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, mute) { + // [START securitycenter_v1_generated_SecurityCenter_SetMute_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource + * name (https://cloud.google.com/apis/design/resource_names#relative_resource_name) + * of the finding. Example: + * "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", + * "folders/{folder_id}/sources/{source_id}/findings/{finding_id}", + * "projects/{project_id}/sources/{source_id}/findings/{finding_id}". + */ + // const name = 'abc123' + /** + * Required. The desired state of the Mute. + */ + // const mute = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callSetMute() { + // Construct request + const request = { + name, + mute, + }; + + // Run request + const response = await securitycenterClient.setMute(request); + console.log(response); + } + + callSetMute(); + // [END securitycenter_v1_generated_SecurityCenter_SetMute_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.test_iam_permissions.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.test_iam_permissions.js new file mode 100644 index 00000000000..f00a7ed09b0 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.test_iam_permissions.js @@ -0,0 +1,70 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource, permissions) { + // [START securitycenter_v1_generated_SecurityCenter_TestIamPermissions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). + */ + // const permissions = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await securitycenterClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END securitycenter_v1_generated_SecurityCenter_TestIamPermissions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_big_query_export.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_big_query_export.js new file mode 100644 index 00000000000..d81a8c86db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_big_query_export.js @@ -0,0 +1,66 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(bigQueryExport) { + // [START securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The BigQuery export being updated. + */ + // const bigQueryExport = {} + /** + * The list of fields to be updated. + * If empty all mutable fields will be updated. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateBigQueryExport() { + // Construct request + const request = { + bigQueryExport, + }; + + // Run request + const response = await securitycenterClient.updateBigQueryExport(request); + console.log(response); + } + + callUpdateBigQueryExport(); + // [END securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_external_system.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_external_system.js new file mode 100644 index 00000000000..d6bd90c80d3 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_external_system.js @@ -0,0 +1,66 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(externalSystem) { + // [START securitycenter_v1_generated_SecurityCenter_UpdateExternalSystem_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The external system resource to update. + */ + // const externalSystem = {} + /** + * The FieldMask to use when updating the external system resource. + * If empty all mutable fields will be updated. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateExternalSystem() { + // Construct request + const request = { + externalSystem, + }; + + // Run request + const response = await securitycenterClient.updateExternalSystem(request); + console.log(response); + } + + callUpdateExternalSystem(); + // [END securitycenter_v1_generated_SecurityCenter_UpdateExternalSystem_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_finding.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_finding.js new file mode 100644 index 00000000000..7aeb185be42 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_finding.js @@ -0,0 +1,74 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(finding) { + // [START securitycenter_v1_generated_SecurityCenter_UpdateFinding_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The finding resource to update or create if it does not already + * exist. parent, security_marks, and update_time will be ignored. + * In the case of creation, the finding id portion of the name must be + * alphanumeric and less than or equal to 32 characters and greater than 0 + * characters in length. + */ + // const finding = {} + /** + * The FieldMask to use when updating the finding resource. This field should + * not be specified when creating a finding. + * When updating a finding, an empty mask is treated as updating all mutable + * fields and replacing source_properties. Individual source_properties can + * be added/updated by using "source_properties." in the field + * mask. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateFinding() { + // Construct request + const request = { + finding, + }; + + // Run request + const response = await securitycenterClient.updateFinding(request); + console.log(response); + } + + callUpdateFinding(); + // [END securitycenter_v1_generated_SecurityCenter_UpdateFinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_mute_config.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_mute_config.js new file mode 100644 index 00000000000..71e4ac6daa3 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_mute_config.js @@ -0,0 +1,66 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(muteConfig) { + // [START securitycenter_v1_generated_SecurityCenter_UpdateMuteConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The mute config being updated. + */ + // const muteConfig = {} + /** + * The list of fields to be updated. + * If empty all mutable fields will be updated. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateMuteConfig() { + // Construct request + const request = { + muteConfig, + }; + + // Run request + const response = await securitycenterClient.updateMuteConfig(request); + console.log(response); + } + + callUpdateMuteConfig(); + // [END securitycenter_v1_generated_SecurityCenter_UpdateMuteConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_notification_config.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_notification_config.js new file mode 100644 index 00000000000..2769e3cd8f3 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_notification_config.js @@ -0,0 +1,66 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(notificationConfig) { + // [START securitycenter_v1_generated_SecurityCenter_UpdateNotificationConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The notification config to update. + */ + // const notificationConfig = {} + /** + * The FieldMask to use when updating the notification config. + * If empty all mutable fields will be updated. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateNotificationConfig() { + // Construct request + const request = { + notificationConfig, + }; + + // Run request + const response = await securitycenterClient.updateNotificationConfig(request); + console.log(response); + } + + callUpdateNotificationConfig(); + // [END securitycenter_v1_generated_SecurityCenter_UpdateNotificationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_organization_settings.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_organization_settings.js new file mode 100644 index 00000000000..bfe708a3f06 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_organization_settings.js @@ -0,0 +1,66 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(organizationSettings) { + // [START securitycenter_v1_generated_SecurityCenter_UpdateOrganizationSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The organization settings resource to update. + */ + // const organizationSettings = {} + /** + * The FieldMask to use when updating the settings resource. + * If empty all mutable fields will be updated. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateOrganizationSettings() { + // Construct request + const request = { + organizationSettings, + }; + + // Run request + const response = await securitycenterClient.updateOrganizationSettings(request); + console.log(response); + } + + callUpdateOrganizationSettings(); + // [END securitycenter_v1_generated_SecurityCenter_UpdateOrganizationSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_security_health_analytics_custom_module.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_security_health_analytics_custom_module.js new file mode 100644 index 00000000000..f23ceaf32a2 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_security_health_analytics_custom_module.js @@ -0,0 +1,65 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(securityHealthAnalyticsCustomModule) { + // [START securitycenter_v1_generated_SecurityCenter_UpdateSecurityHealthAnalyticsCustomModule_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The SecurityHealthAnalytics custom module to update. + */ + // const securityHealthAnalyticsCustomModule = {} + /** + * The list of fields to update. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateSecurityHealthAnalyticsCustomModule() { + // Construct request + const request = { + securityHealthAnalyticsCustomModule, + }; + + // Run request + const response = await securitycenterClient.updateSecurityHealthAnalyticsCustomModule(request); + console.log(response); + } + + callUpdateSecurityHealthAnalyticsCustomModule(); + // [END securitycenter_v1_generated_SecurityCenter_UpdateSecurityHealthAnalyticsCustomModule_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_security_marks.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_security_marks.js new file mode 100644 index 00000000000..884a807d2f8 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_security_marks.js @@ -0,0 +1,75 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(securityMarks) { + // [START securitycenter_v1_generated_SecurityCenter_UpdateSecurityMarks_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The security marks resource to update. + */ + // const securityMarks = {} + /** + * The FieldMask to use when updating the security marks resource. + * The field mask must not contain duplicate fields. + * If empty or set to "marks", all marks will be replaced. Individual + * marks can be updated using "marks.". + */ + // const updateMask = {} + /** + * The time at which the updated SecurityMarks take effect. + * If not set uses current server time. Updates will be applied to the + * SecurityMarks that are active immediately preceding this time. Must be + * earlier or equal to the server time. + */ + // const startTime = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateSecurityMarks() { + // Construct request + const request = { + securityMarks, + }; + + // Run request + const response = await securitycenterClient.updateSecurityMarks(request); + console.log(response); + } + + callUpdateSecurityMarks(); + // [END securitycenter_v1_generated_SecurityCenter_UpdateSecurityMarks_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_source.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_source.js new file mode 100644 index 00000000000..f8c2bdffc96 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_source.js @@ -0,0 +1,66 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(source) { + // [START securitycenter_v1_generated_SecurityCenter_UpdateSource_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The source resource to update. + */ + // const source = {} + /** + * The FieldMask to use when updating the source resource. + * If empty all mutable fields will be updated. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateSource() { + // Construct request + const request = { + source, + }; + + // Run request + const response = await securitycenterClient.updateSource(request); + console.log(response); + } + + callUpdateSource(); + // [END securitycenter_v1_generated_SecurityCenter_UpdateSource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json new file mode 100644 index 00000000000..f58fb1865bc --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json @@ -0,0 +1,2051 @@ +{ + "clientLibrary": { + "name": "nodejs-securitycenter", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.securitycenter.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_async", + "title": "SecurityCenter bulkMuteFindings Sample", + "origin": "API_DEFINITION", + "description": " Kicks off an LRO to bulk mute findings for a parent based on a filter. The parent can be either an organization, folder or project. The findings matched by the filter will be muted after the LRO is done.", + "canonical": true, + "file": "security_center.bulk_mute_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BulkMuteFindings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.BulkMuteFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "mute_annotation", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "BulkMuteFindings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.BulkMuteFindings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateSecurityHealthAnalyticsCustomModule_async", + "title": "SecurityCenter createSecurityHealthAnalyticsCustomModule Sample", + "origin": "API_DEFINITION", + "description": " Creates a resident SecurityHealthAnalyticsCustomModule at the scope of the given CRM parent, and also creates inherited SecurityHealthAnalyticsCustomModules for all CRM descendants of the given parent. These modules are enabled by default.", + "canonical": true, + "file": "security_center.create_security_health_analytics_custom_module.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSecurityHealthAnalyticsCustomModule", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateSecurityHealthAnalyticsCustomModule", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "security_health_analytics_custom_module", + "type": ".google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule" + } + ], + "resultType": ".google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateSecurityHealthAnalyticsCustomModule", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateSecurityHealthAnalyticsCustomModule", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateSource_async", + "title": "SecurityCenter createSource Sample", + "origin": "API_DEFINITION", + "description": " Creates a source.", + "canonical": true, + "file": "security_center.create_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSource", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateSource", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "source", + "type": ".google.cloud.securitycenter.v1.Source" + } + ], + "resultType": ".google.cloud.securitycenter.v1.Source", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateSource", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateSource", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateFinding_async", + "title": "SecurityCenter createFinding Sample", + "origin": "API_DEFINITION", + "description": " Creates a finding. The corresponding source must exist for finding creation to succeed.", + "canonical": true, + "file": "security_center.create_finding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFinding", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateFinding", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "finding_id", + "type": "TYPE_STRING" + }, + { + "name": "finding", + "type": ".google.cloud.securitycenter.v1.Finding" + } + ], + "resultType": ".google.cloud.securitycenter.v1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateFinding", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateFinding", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateMuteConfig_async", + "title": "SecurityCenter createMuteConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a mute config.", + "canonical": true, + "file": "security_center.create_mute_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateMuteConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateMuteConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "mute_config", + "type": ".google.cloud.securitycenter.v1.MuteConfig" + }, + { + "name": "mute_config_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.MuteConfig", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateMuteConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateMuteConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateNotificationConfig_async", + "title": "SecurityCenter createNotificationConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a notification config.", + "canonical": true, + "file": "security_center.create_notification_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateNotificationConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateNotificationConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "config_id", + "type": "TYPE_STRING" + }, + { + "name": "notification_config", + "type": ".google.cloud.securitycenter.v1.NotificationConfig" + } + ], + "resultType": ".google.cloud.securitycenter.v1.NotificationConfig", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateNotificationConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateNotificationConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_DeleteMuteConfig_async", + "title": "SecurityCenter deleteMuteConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes an existing mute config.", + "canonical": true, + "file": "security_center.delete_mute_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteMuteConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteMuteConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "DeleteMuteConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteMuteConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_DeleteNotificationConfig_async", + "title": "SecurityCenter deleteNotificationConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes a notification config.", + "canonical": true, + "file": "security_center.delete_notification_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteNotificationConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteNotificationConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "DeleteNotificationConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteNotificationConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_DeleteSecurityHealthAnalyticsCustomModule_async", + "title": "SecurityCenter deleteSecurityHealthAnalyticsCustomModule Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified SecurityHealthAnalyticsCustomModule and all of its descendants in the CRM hierarchy. This method is only supported for resident custom modules.", + "canonical": true, + "file": "security_center.delete_security_health_analytics_custom_module.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSecurityHealthAnalyticsCustomModule", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteSecurityHealthAnalyticsCustomModule", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "DeleteSecurityHealthAnalyticsCustomModule", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteSecurityHealthAnalyticsCustomModule", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_async", + "title": "SecurityCenter getBigQueryExport Sample", + "origin": "API_DEFINITION", + "description": " Gets a BigQuery export.", + "canonical": true, + "file": "security_center.get_big_query_export.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBigQueryExport", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetBigQueryExport", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.BigQueryExport", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "GetBigQueryExport", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetBigQueryExport", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_GetIamPolicy_async", + "title": "SecurityCenter getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the access control policy on the specified Source.", + "canonical": true, + "file": "security_center.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetIamPolicy", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_GetMuteConfig_async", + "title": "SecurityCenter getMuteConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a mute config.", + "canonical": true, + "file": "security_center.get_mute_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetMuteConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetMuteConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.MuteConfig", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "GetMuteConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetMuteConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_GetNotificationConfig_async", + "title": "SecurityCenter getNotificationConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a notification config.", + "canonical": true, + "file": "security_center.get_notification_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNotificationConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetNotificationConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.NotificationConfig", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "GetNotificationConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetNotificationConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_GetOrganizationSettings_async", + "title": "SecurityCenter getOrganizationSettings Sample", + "origin": "API_DEFINITION", + "description": " Gets the settings for an organization.", + "canonical": true, + "file": "security_center.get_organization_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetOrganizationSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.OrganizationSettings", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "GetOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetOrganizationSettings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_GetEffectiveSecurityHealthAnalyticsCustomModule_async", + "title": "SecurityCenter getEffectiveSecurityHealthAnalyticsCustomModule Sample", + "origin": "API_DEFINITION", + "description": " Retrieves an EffectiveSecurityHealthAnalyticsCustomModule.", + "canonical": true, + "file": "security_center.get_effective_security_health_analytics_custom_module.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetEffectiveSecurityHealthAnalyticsCustomModule", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetEffectiveSecurityHealthAnalyticsCustomModule", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "GetEffectiveSecurityHealthAnalyticsCustomModule", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetEffectiveSecurityHealthAnalyticsCustomModule", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_GetSecurityHealthAnalyticsCustomModule_async", + "title": "SecurityCenter getSecurityHealthAnalyticsCustomModule Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a SecurityHealthAnalyticsCustomModule.", + "canonical": true, + "file": "security_center.get_security_health_analytics_custom_module.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSecurityHealthAnalyticsCustomModule", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetSecurityHealthAnalyticsCustomModule", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "GetSecurityHealthAnalyticsCustomModule", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetSecurityHealthAnalyticsCustomModule", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_GetSource_async", + "title": "SecurityCenter getSource Sample", + "origin": "API_DEFINITION", + "description": " Gets a source.", + "canonical": true, + "file": "security_center.get_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSource", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetSource", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.Source", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "GetSource", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetSource", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_GroupAssets_async", + "title": "SecurityCenter groupAssets Sample", + "origin": "API_DEFINITION", + "description": " Filters an organization's assets and groups them by their specified properties.", + "canonical": true, + "file": "security_center.group_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 168, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GroupAssets", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GroupAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "group_by", + "type": "TYPE_STRING" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1.GroupAssetsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "GroupAssets", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GroupAssets", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_GroupFindings_async", + "title": "SecurityCenter groupFindings Sample", + "origin": "API_DEFINITION", + "description": " Filters an organization or source's findings and groups them by their specified properties. To group across all sources provide a `-` as the source id. Example: /v1/organizations/{organization_id}/sources/-/findings, /v1/folders/{folder_id}/sources/-/findings, /v1/projects/{project_id}/sources/-/findings", + "canonical": true, + "file": "security_center.group_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 172, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GroupFindings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GroupFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "group_by", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1.GroupFindingsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "GroupFindings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GroupFindings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_ListAssets_async", + "title": "SecurityCenter listAssets Sample", + "origin": "API_DEFINITION", + "description": " Lists an organization's assets.", + "canonical": true, + "file": "security_center.list_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 179, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAssets", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1.ListAssetsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "ListAssets", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListAssets", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_ListDescendantSecurityHealthAnalyticsCustomModules_async", + "title": "SecurityCenter listDescendantSecurityHealthAnalyticsCustomModules Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of all resident SecurityHealthAnalyticsCustomModules under the given CRM parent and all of the parent’s CRM descendants.", + "canonical": true, + "file": "security_center.list_descendant_security_health_analytics_custom_modules.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDescendantSecurityHealthAnalyticsCustomModules", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListDescendantSecurityHealthAnalyticsCustomModules", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "ListDescendantSecurityHealthAnalyticsCustomModules", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListDescendantSecurityHealthAnalyticsCustomModules", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_ListFindings_async", + "title": "SecurityCenter listFindings Sample", + "origin": "API_DEFINITION", + "description": " Lists an organization or source's findings. To list across all sources provide a `-` as the source id. Example: /v1/organizations/{organization_id}/sources/-/findings", + "canonical": true, + "file": "security_center.list_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 183, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFindings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1.ListFindingsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "ListFindings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListFindings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_ListMuteConfigs_async", + "title": "SecurityCenter listMuteConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists mute configs.", + "canonical": true, + "file": "security_center.list_mute_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMuteConfigs", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListMuteConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.ListMuteConfigsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "ListMuteConfigs", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListMuteConfigs", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_ListNotificationConfigs_async", + "title": "SecurityCenter listNotificationConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists notification configs.", + "canonical": true, + "file": "security_center.list_notification_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNotificationConfigs", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListNotificationConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1.ListNotificationConfigsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "ListNotificationConfigs", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListNotificationConfigs", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_ListEffectiveSecurityHealthAnalyticsCustomModules_async", + "title": "SecurityCenter listEffectiveSecurityHealthAnalyticsCustomModules Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of all EffectiveSecurityHealthAnalyticsCustomModules for the given parent. This includes resident modules defined at the scope of the parent, and inherited modules, inherited from CRM ancestors.", + "canonical": true, + "file": "security_center.list_effective_security_health_analytics_custom_modules.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListEffectiveSecurityHealthAnalyticsCustomModules", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListEffectiveSecurityHealthAnalyticsCustomModules", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "ListEffectiveSecurityHealthAnalyticsCustomModules", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListEffectiveSecurityHealthAnalyticsCustomModules", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_ListSecurityHealthAnalyticsCustomModules_async", + "title": "SecurityCenter listSecurityHealthAnalyticsCustomModules Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of all SecurityHealthAnalyticsCustomModules for the given parent. This includes resident modules defined at the scope of the parent, and inherited modules, inherited from CRM ancestors.", + "canonical": true, + "file": "security_center.list_security_health_analytics_custom_modules.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSecurityHealthAnalyticsCustomModules", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListSecurityHealthAnalyticsCustomModules", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "ListSecurityHealthAnalyticsCustomModules", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListSecurityHealthAnalyticsCustomModules", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_ListSources_async", + "title": "SecurityCenter listSources Sample", + "origin": "API_DEFINITION", + "description": " Lists all sources belonging to an organization.", + "canonical": true, + "file": "security_center.list_sources.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSources", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListSources", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1.ListSourcesResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "ListSources", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListSources", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_async", + "title": "SecurityCenter runAssetDiscovery Sample", + "origin": "API_DEFINITION", + "description": " Runs asset discovery. The discovery is tracked with a long-running operation. This API can only be called with limited frequency for an organization. If it is called too frequently the caller will receive a TOO_MANY_REQUESTS error.", + "canonical": true, + "file": "security_center.run_asset_discovery.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RunAssetDiscovery", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.RunAssetDiscovery", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "RunAssetDiscovery", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.RunAssetDiscovery", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_SetFindingState_async", + "title": "SecurityCenter setFindingState Sample", + "origin": "API_DEFINITION", + "description": " Updates the state of a finding.", + "canonical": true, + "file": "security_center.set_finding_state.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetFindingState", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetFindingState", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "state", + "type": ".google.cloud.securitycenter.v1.Finding.State" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.securitycenter.v1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "SetFindingState", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetFindingState", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_SetMute_async", + "title": "SecurityCenter setMute Sample", + "origin": "API_DEFINITION", + "description": " Updates the mute state of a finding.", + "canonical": true, + "file": "security_center.set_mute.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetMute", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetMute", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "mute", + "type": ".google.cloud.securitycenter.v1.Finding.Mute" + } + ], + "resultType": ".google.cloud.securitycenter.v1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "SetMute", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetMute", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_SetIamPolicy_async", + "title": "SecurityCenter setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the access control policy on the specified Source.", + "canonical": true, + "file": "security_center.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "policy", + "type": ".google.iam.v1.Policy" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetIamPolicy", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_TestIamPermissions_async", + "title": "SecurityCenter testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Returns the permissions that a caller has on the specified source.", + "canonical": true, + "file": "security_center.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.TestIamPermissions", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateExternalSystem_async", + "title": "SecurityCenter updateExternalSystem Sample", + "origin": "API_DEFINITION", + "description": " Updates external system. This is for a given finding.", + "canonical": true, + "file": "security_center.update_external_system.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateExternalSystem", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateExternalSystem", + "async": true, + "parameters": [ + { + "name": "external_system", + "type": ".google.cloud.securitycenter.v1.ExternalSystem" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1.ExternalSystem", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateExternalSystem", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateExternalSystem", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateFinding_async", + "title": "SecurityCenter updateFinding Sample", + "origin": "API_DEFINITION", + "description": " Creates or updates a finding. The corresponding source must exist for a finding creation to succeed.", + "canonical": true, + "file": "security_center.update_finding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFinding", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateFinding", + "async": true, + "parameters": [ + { + "name": "finding", + "type": ".google.cloud.securitycenter.v1.Finding" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateFinding", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateFinding", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateMuteConfig_async", + "title": "SecurityCenter updateMuteConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates a mute config.", + "canonical": true, + "file": "security_center.update_mute_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateMuteConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateMuteConfig", + "async": true, + "parameters": [ + { + "name": "mute_config", + "type": ".google.cloud.securitycenter.v1.MuteConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1.MuteConfig", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateMuteConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateMuteConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateNotificationConfig_async", + "title": "SecurityCenter updateNotificationConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates a notification config. The following update fields are allowed: description, pubsub_topic, streaming_config.filter", + "canonical": true, + "file": "security_center.update_notification_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateNotificationConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateNotificationConfig", + "async": true, + "parameters": [ + { + "name": "notification_config", + "type": ".google.cloud.securitycenter.v1.NotificationConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1.NotificationConfig", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateNotificationConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateNotificationConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateOrganizationSettings_async", + "title": "SecurityCenter updateOrganizationSettings Sample", + "origin": "API_DEFINITION", + "description": " Updates an organization's settings.", + "canonical": true, + "file": "security_center.update_organization_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateOrganizationSettings", + "async": true, + "parameters": [ + { + "name": "organization_settings", + "type": ".google.cloud.securitycenter.v1.OrganizationSettings" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1.OrganizationSettings", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateOrganizationSettings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateSecurityHealthAnalyticsCustomModule_async", + "title": "SecurityCenter updateSecurityHealthAnalyticsCustomModule Sample", + "origin": "API_DEFINITION", + "description": " Updates the SecurityHealthAnalyticsCustomModule under the given name based on the given update mask. Updating the enablement state is supported on both resident and inherited modules (though resident modules cannot have an enablement state of \"inherited\"). Updating the display name and custom config of a module is supported on resident modules only.", + "canonical": true, + "file": "security_center.update_security_health_analytics_custom_module.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSecurityHealthAnalyticsCustomModule", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSecurityHealthAnalyticsCustomModule", + "async": true, + "parameters": [ + { + "name": "security_health_analytics_custom_module", + "type": ".google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateSecurityHealthAnalyticsCustomModule", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSecurityHealthAnalyticsCustomModule", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateSource_async", + "title": "SecurityCenter updateSource Sample", + "origin": "API_DEFINITION", + "description": " Updates a source.", + "canonical": true, + "file": "security_center.update_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSource", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSource", + "async": true, + "parameters": [ + { + "name": "source", + "type": ".google.cloud.securitycenter.v1.Source" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1.Source", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateSource", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSource", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateSecurityMarks_async", + "title": "SecurityCenter updateSecurityMarks Sample", + "origin": "API_DEFINITION", + "description": " Updates security marks.", + "canonical": true, + "file": "security_center.update_security_marks.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSecurityMarks", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSecurityMarks", + "async": true, + "parameters": [ + { + "name": "security_marks", + "type": ".google.cloud.securitycenter.v1.SecurityMarks" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.securitycenter.v1.SecurityMarks", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateSecurityMarks", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSecurityMarks", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_async", + "title": "SecurityCenter createBigQueryExport Sample", + "origin": "API_DEFINITION", + "description": " Creates a BigQuery export.", + "canonical": true, + "file": "security_center.create_big_query_export.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBigQueryExport", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateBigQueryExport", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "big_query_export", + "type": ".google.cloud.securitycenter.v1.BigQueryExport" + }, + { + "name": "big_query_export_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.BigQueryExport", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateBigQueryExport", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateBigQueryExport", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_async", + "title": "SecurityCenter deleteBigQueryExport Sample", + "origin": "API_DEFINITION", + "description": " Deletes an existing BigQuery export.", + "canonical": true, + "file": "security_center.delete_big_query_export.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBigQueryExport", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteBigQueryExport", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "DeleteBigQueryExport", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteBigQueryExport", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_async", + "title": "SecurityCenter updateBigQueryExport Sample", + "origin": "API_DEFINITION", + "description": " Updates a BigQuery export.", + "canonical": true, + "file": "security_center.update_big_query_export.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateBigQueryExport", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateBigQueryExport", + "async": true, + "parameters": [ + { + "name": "big_query_export", + "type": ".google.cloud.securitycenter.v1.BigQueryExport" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1.BigQueryExport", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateBigQueryExport", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateBigQueryExport", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_async", + "title": "SecurityCenter listBigQueryExports Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "security_center.list_big_query_exports.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBigQueryExports", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListBigQueryExports", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.ListBigQueryExportsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "ListBigQueryExports", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListBigQueryExports", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/src/index.ts b/owl-bot-staging/google-cloud-securitycenter/v1/src/index.ts new file mode 100644 index 00000000000..cb56921c366 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; +const SecurityCenterClient = v1.SecurityCenterClient; +type SecurityCenterClient = v1.SecurityCenterClient; +export {v1, SecurityCenterClient}; +export default {v1, SecurityCenterClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..8abf26ce403 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/gapic_metadata.json @@ -0,0 +1,507 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.securitycenter.v1", + "libraryPackage": "@google-cloud/security-center", + "services": { + "SecurityCenter": { + "clients": { + "grpc": { + "libraryClient": "SecurityCenterClient", + "rpcs": { + "CreateSecurityHealthAnalyticsCustomModule": { + "methods": [ + "createSecurityHealthAnalyticsCustomModule" + ] + }, + "CreateSource": { + "methods": [ + "createSource" + ] + }, + "CreateFinding": { + "methods": [ + "createFinding" + ] + }, + "CreateMuteConfig": { + "methods": [ + "createMuteConfig" + ] + }, + "CreateNotificationConfig": { + "methods": [ + "createNotificationConfig" + ] + }, + "DeleteMuteConfig": { + "methods": [ + "deleteMuteConfig" + ] + }, + "DeleteNotificationConfig": { + "methods": [ + "deleteNotificationConfig" + ] + }, + "DeleteSecurityHealthAnalyticsCustomModule": { + "methods": [ + "deleteSecurityHealthAnalyticsCustomModule" + ] + }, + "GetBigQueryExport": { + "methods": [ + "getBigQueryExport" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "GetMuteConfig": { + "methods": [ + "getMuteConfig" + ] + }, + "GetNotificationConfig": { + "methods": [ + "getNotificationConfig" + ] + }, + "GetOrganizationSettings": { + "methods": [ + "getOrganizationSettings" + ] + }, + "GetEffectiveSecurityHealthAnalyticsCustomModule": { + "methods": [ + "getEffectiveSecurityHealthAnalyticsCustomModule" + ] + }, + "GetSecurityHealthAnalyticsCustomModule": { + "methods": [ + "getSecurityHealthAnalyticsCustomModule" + ] + }, + "GetSource": { + "methods": [ + "getSource" + ] + }, + "SetFindingState": { + "methods": [ + "setFindingState" + ] + }, + "SetMute": { + "methods": [ + "setMute" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "UpdateExternalSystem": { + "methods": [ + "updateExternalSystem" + ] + }, + "UpdateFinding": { + "methods": [ + "updateFinding" + ] + }, + "UpdateMuteConfig": { + "methods": [ + "updateMuteConfig" + ] + }, + "UpdateNotificationConfig": { + "methods": [ + "updateNotificationConfig" + ] + }, + "UpdateOrganizationSettings": { + "methods": [ + "updateOrganizationSettings" + ] + }, + "UpdateSecurityHealthAnalyticsCustomModule": { + "methods": [ + "updateSecurityHealthAnalyticsCustomModule" + ] + }, + "UpdateSource": { + "methods": [ + "updateSource" + ] + }, + "UpdateSecurityMarks": { + "methods": [ + "updateSecurityMarks" + ] + }, + "CreateBigQueryExport": { + "methods": [ + "createBigQueryExport" + ] + }, + "DeleteBigQueryExport": { + "methods": [ + "deleteBigQueryExport" + ] + }, + "UpdateBigQueryExport": { + "methods": [ + "updateBigQueryExport" + ] + }, + "BulkMuteFindings": { + "methods": [ + "bulkMuteFindings" + ] + }, + "RunAssetDiscovery": { + "methods": [ + "runAssetDiscovery" + ] + }, + "GroupAssets": { + "methods": [ + "groupAssets", + "groupAssetsStream", + "groupAssetsAsync" + ] + }, + "GroupFindings": { + "methods": [ + "groupFindings", + "groupFindingsStream", + "groupFindingsAsync" + ] + }, + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + }, + "ListDescendantSecurityHealthAnalyticsCustomModules": { + "methods": [ + "listDescendantSecurityHealthAnalyticsCustomModules", + "listDescendantSecurityHealthAnalyticsCustomModulesStream", + "listDescendantSecurityHealthAnalyticsCustomModulesAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + }, + "ListMuteConfigs": { + "methods": [ + "listMuteConfigs", + "listMuteConfigsStream", + "listMuteConfigsAsync" + ] + }, + "ListNotificationConfigs": { + "methods": [ + "listNotificationConfigs", + "listNotificationConfigsStream", + "listNotificationConfigsAsync" + ] + }, + "ListEffectiveSecurityHealthAnalyticsCustomModules": { + "methods": [ + "listEffectiveSecurityHealthAnalyticsCustomModules", + "listEffectiveSecurityHealthAnalyticsCustomModulesStream", + "listEffectiveSecurityHealthAnalyticsCustomModulesAsync" + ] + }, + "ListSecurityHealthAnalyticsCustomModules": { + "methods": [ + "listSecurityHealthAnalyticsCustomModules", + "listSecurityHealthAnalyticsCustomModulesStream", + "listSecurityHealthAnalyticsCustomModulesAsync" + ] + }, + "ListSources": { + "methods": [ + "listSources", + "listSourcesStream", + "listSourcesAsync" + ] + }, + "ListBigQueryExports": { + "methods": [ + "listBigQueryExports", + "listBigQueryExportsStream", + "listBigQueryExportsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SecurityCenterClient", + "rpcs": { + "CreateSecurityHealthAnalyticsCustomModule": { + "methods": [ + "createSecurityHealthAnalyticsCustomModule" + ] + }, + "CreateSource": { + "methods": [ + "createSource" + ] + }, + "CreateFinding": { + "methods": [ + "createFinding" + ] + }, + "CreateMuteConfig": { + "methods": [ + "createMuteConfig" + ] + }, + "CreateNotificationConfig": { + "methods": [ + "createNotificationConfig" + ] + }, + "DeleteMuteConfig": { + "methods": [ + "deleteMuteConfig" + ] + }, + "DeleteNotificationConfig": { + "methods": [ + "deleteNotificationConfig" + ] + }, + "DeleteSecurityHealthAnalyticsCustomModule": { + "methods": [ + "deleteSecurityHealthAnalyticsCustomModule" + ] + }, + "GetBigQueryExport": { + "methods": [ + "getBigQueryExport" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "GetMuteConfig": { + "methods": [ + "getMuteConfig" + ] + }, + "GetNotificationConfig": { + "methods": [ + "getNotificationConfig" + ] + }, + "GetOrganizationSettings": { + "methods": [ + "getOrganizationSettings" + ] + }, + "GetEffectiveSecurityHealthAnalyticsCustomModule": { + "methods": [ + "getEffectiveSecurityHealthAnalyticsCustomModule" + ] + }, + "GetSecurityHealthAnalyticsCustomModule": { + "methods": [ + "getSecurityHealthAnalyticsCustomModule" + ] + }, + "GetSource": { + "methods": [ + "getSource" + ] + }, + "SetFindingState": { + "methods": [ + "setFindingState" + ] + }, + "SetMute": { + "methods": [ + "setMute" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "UpdateExternalSystem": { + "methods": [ + "updateExternalSystem" + ] + }, + "UpdateFinding": { + "methods": [ + "updateFinding" + ] + }, + "UpdateMuteConfig": { + "methods": [ + "updateMuteConfig" + ] + }, + "UpdateNotificationConfig": { + "methods": [ + "updateNotificationConfig" + ] + }, + "UpdateOrganizationSettings": { + "methods": [ + "updateOrganizationSettings" + ] + }, + "UpdateSecurityHealthAnalyticsCustomModule": { + "methods": [ + "updateSecurityHealthAnalyticsCustomModule" + ] + }, + "UpdateSource": { + "methods": [ + "updateSource" + ] + }, + "UpdateSecurityMarks": { + "methods": [ + "updateSecurityMarks" + ] + }, + "CreateBigQueryExport": { + "methods": [ + "createBigQueryExport" + ] + }, + "DeleteBigQueryExport": { + "methods": [ + "deleteBigQueryExport" + ] + }, + "UpdateBigQueryExport": { + "methods": [ + "updateBigQueryExport" + ] + }, + "BulkMuteFindings": { + "methods": [ + "bulkMuteFindings" + ] + }, + "RunAssetDiscovery": { + "methods": [ + "runAssetDiscovery" + ] + }, + "GroupAssets": { + "methods": [ + "groupAssets", + "groupAssetsStream", + "groupAssetsAsync" + ] + }, + "GroupFindings": { + "methods": [ + "groupFindings", + "groupFindingsStream", + "groupFindingsAsync" + ] + }, + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + }, + "ListDescendantSecurityHealthAnalyticsCustomModules": { + "methods": [ + "listDescendantSecurityHealthAnalyticsCustomModules", + "listDescendantSecurityHealthAnalyticsCustomModulesStream", + "listDescendantSecurityHealthAnalyticsCustomModulesAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + }, + "ListMuteConfigs": { + "methods": [ + "listMuteConfigs", + "listMuteConfigsStream", + "listMuteConfigsAsync" + ] + }, + "ListNotificationConfigs": { + "methods": [ + "listNotificationConfigs", + "listNotificationConfigsStream", + "listNotificationConfigsAsync" + ] + }, + "ListEffectiveSecurityHealthAnalyticsCustomModules": { + "methods": [ + "listEffectiveSecurityHealthAnalyticsCustomModules", + "listEffectiveSecurityHealthAnalyticsCustomModulesStream", + "listEffectiveSecurityHealthAnalyticsCustomModulesAsync" + ] + }, + "ListSecurityHealthAnalyticsCustomModules": { + "methods": [ + "listSecurityHealthAnalyticsCustomModules", + "listSecurityHealthAnalyticsCustomModulesStream", + "listSecurityHealthAnalyticsCustomModulesAsync" + ] + }, + "ListSources": { + "methods": [ + "listSources", + "listSourcesStream", + "listSourcesAsync" + ] + }, + "ListBigQueryExports": { + "methods": [ + "listBigQueryExports", + "listBigQueryExportsStream", + "listBigQueryExportsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/index.ts new file mode 100644 index 00000000000..fa3996e6154 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {SecurityCenterClient} from './security_center_client'; diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_client.ts b/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_client.ts new file mode 100644 index 00000000000..75bea92c5c4 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_client.ts @@ -0,0 +1,8207 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/security_center_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './security_center_client_config.json'; +const version = require('../../../package.json').version; + +/** + * V1 APIs for Security Center service. + * @class + * @memberof v1 + */ +export class SecurityCenterClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + securityCenterStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SecurityCenterClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SecurityCenterClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SecurityCenterClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + folderAssetPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/assets/{asset}' + ), + folderAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/assets/{asset}/securityMarks' + ), + folderExportPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/bigQueryExports/{export}' + ), + folderMuteConfigPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/muteConfigs/{mute_config}' + ), + folderNotificationConfigPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/notificationConfigs/{notification_config}' + ), + folderSecurityHealthAnalyticsSettingsCustomModulePathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/securityHealthAnalyticsSettings/customModules/{custom_module}' + ), + folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/securityHealthAnalyticsSettings/effectiveCustomModules/{effective_custom_module}' + ), + folderSourcePathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sources/{source}' + ), + folderSourceFindingPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sources/{source}/findings/{finding}' + ), + folderSourceFindingExternalsystemPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}' + ), + folderSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sources/{source}/findings/{finding}/securityMarks' + ), + organizationPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}' + ), + organizationAssetPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/assets/{asset}' + ), + organizationAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/assets/{asset}/securityMarks' + ), + organizationExportPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/bigQueryExports/{export}' + ), + organizationMuteConfigPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/muteConfigs/{mute_config}' + ), + organizationNotificationConfigPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationConfigs/{notification_config}' + ), + organizationSecurityHealthAnalyticsSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/securityHealthAnalyticsSettings' + ), + organizationSecurityHealthAnalyticsSettingsCustomModulePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/securityHealthAnalyticsSettings/customModules/{custom_module}' + ), + organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/securityHealthAnalyticsSettings/effectiveCustomModules/{effective_custom_module}' + ), + organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/organizationSettings' + ), + organizationSourcePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}' + ), + organizationSourceFindingPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}/findings/{finding}' + ), + organizationSourceFindingExternalsystemPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}' + ), + organizationSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks' + ), + projectAssetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/assets/{asset}' + ), + projectAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/assets/{asset}/securityMarks' + ), + projectExportPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/bigQueryExports/{export}' + ), + projectMuteConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/muteConfigs/{mute_config}' + ), + projectNotificationConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/notificationConfigs/{notification_config}' + ), + projectSecurityHealthAnalyticsSettingsCustomModulePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/securityHealthAnalyticsSettings/customModules/{custom_module}' + ), + projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/securityHealthAnalyticsSettings/effectiveCustomModules/{effective_custom_module}' + ), + projectSourcePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sources/{source}' + ), + projectSourceFindingPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sources/{source}/findings/{finding}' + ), + projectSourceFindingExternalsystemPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}' + ), + projectSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sources/{source}/findings/{finding}/securityMarks' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + groupAssets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), + groupFindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), + listAssets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listAssetsResults'), + listDescendantSecurityHealthAnalyticsCustomModules: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'securityHealthAnalyticsCustomModules'), + listFindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listFindingsResults'), + listMuteConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'muteConfigs'), + listNotificationConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'notificationConfigs'), + listEffectiveSecurityHealthAnalyticsCustomModules: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'effectiveSecurityHealthAnalyticsCustomModules'), + listSecurityHealthAnalyticsCustomModules: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'securityHealthAnalyticsCustomModules'), + listSources: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sources'), + listBigQueryExports: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'bigQueryExports') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=organizations/*/operations/*}:cancel',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=organizations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=organizations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=organizations/*/operations}',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const bulkMuteFindingsResponse = protoFilesRoot.lookup( + '.google.cloud.securitycenter.v1.BulkMuteFindingsResponse') as gax.protobuf.Type; + const bulkMuteFindingsMetadata = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const runAssetDiscoveryResponse = protoFilesRoot.lookup( + '.google.cloud.securitycenter.v1.RunAssetDiscoveryResponse') as gax.protobuf.Type; + const runAssetDiscoveryMetadata = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + + this.descriptors.longrunning = { + bulkMuteFindings: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + bulkMuteFindingsResponse.decode.bind(bulkMuteFindingsResponse), + bulkMuteFindingsMetadata.decode.bind(bulkMuteFindingsMetadata)), + runAssetDiscovery: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + runAssetDiscoveryResponse.decode.bind(runAssetDiscoveryResponse), + runAssetDiscoveryMetadata.decode.bind(runAssetDiscoveryMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.securitycenter.v1.SecurityCenter', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.securityCenterStub) { + return this.securityCenterStub; + } + + // Put together the "service stub" for + // google.cloud.securitycenter.v1.SecurityCenter. + this.securityCenterStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.securitycenter.v1.SecurityCenter') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.securitycenter.v1.SecurityCenter, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const securityCenterStubMethods = + ['bulkMuteFindings', 'createSecurityHealthAnalyticsCustomModule', 'createSource', 'createFinding', 'createMuteConfig', 'createNotificationConfig', 'deleteMuteConfig', 'deleteNotificationConfig', 'deleteSecurityHealthAnalyticsCustomModule', 'getBigQueryExport', 'getIamPolicy', 'getMuteConfig', 'getNotificationConfig', 'getOrganizationSettings', 'getEffectiveSecurityHealthAnalyticsCustomModule', 'getSecurityHealthAnalyticsCustomModule', 'getSource', 'groupAssets', 'groupFindings', 'listAssets', 'listDescendantSecurityHealthAnalyticsCustomModules', 'listFindings', 'listMuteConfigs', 'listNotificationConfigs', 'listEffectiveSecurityHealthAnalyticsCustomModules', 'listSecurityHealthAnalyticsCustomModules', 'listSources', 'runAssetDiscovery', 'setFindingState', 'setMute', 'setIamPolicy', 'testIamPermissions', 'updateExternalSystem', 'updateFinding', 'updateMuteConfig', 'updateNotificationConfig', 'updateOrganizationSettings', 'updateSecurityHealthAnalyticsCustomModule', 'updateSource', 'updateSecurityMarks', 'createBigQueryExport', 'deleteBigQueryExport', 'updateBigQueryExport', 'listBigQueryExports']; + for (const methodName of securityCenterStubMethods) { + const callPromise = this.securityCenterStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.securityCenterStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'securitycenter.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'securitycenter.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Creates a resident SecurityHealthAnalyticsCustomModule at the scope of the + * given CRM parent, and also creates inherited + * SecurityHealthAnalyticsCustomModules for all CRM descendants of the given + * parent. These modules are enabled by default. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new custom module's parent. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings", + * "folders/{folder}/securityHealthAnalyticsSettings", or + * "projects/{project}/securityHealthAnalyticsSettings" + * @param {google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule} request.securityHealthAnalyticsCustomModule + * Required. SecurityHealthAnalytics custom module to create. The provided + * name is ignored and reset with provided parent information and + * server-generated ID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule | SecurityHealthAnalyticsCustomModule}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.create_security_health_analytics_custom_module.js + * region_tag:securitycenter_v1_generated_SecurityCenter_CreateSecurityHealthAnalyticsCustomModule_async + */ + createSecurityHealthAnalyticsCustomModule( + request?: protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined + ]>; + createSecurityHealthAnalyticsCustomModule( + request: protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>): void; + createSecurityHealthAnalyticsCustomModule( + request: protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>): void; + createSecurityHealthAnalyticsCustomModule( + request?: protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createSecurityHealthAnalyticsCustomModule(request, options, callback); + } +/** + * Creates a source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new source's parent. Its format should be + * "organizations/[organization_id]". + * @param {google.cloud.securitycenter.v1.Source} request.source + * Required. The Source being created, only the display_name and description + * will be used. All other fields will be ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.Source | Source}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.create_source.js + * region_tag:securitycenter_v1_generated_SecurityCenter_CreateSource_async + */ + createSource( + request?: protos.google.cloud.securitycenter.v1.ICreateSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.ICreateSourceRequest|undefined, {}|undefined + ]>; + createSource( + request: protos.google.cloud.securitycenter.v1.ICreateSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.ICreateSourceRequest|null|undefined, + {}|null|undefined>): void; + createSource( + request: protos.google.cloud.securitycenter.v1.ICreateSourceRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.ICreateSourceRequest|null|undefined, + {}|null|undefined>): void; + createSource( + request?: protos.google.cloud.securitycenter.v1.ICreateSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.ICreateSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.ICreateSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.ICreateSourceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createSource(request, options, callback); + } +/** + * Creates a finding. The corresponding source must exist for finding creation + * to succeed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new finding's parent. Its format should be + * "organizations/[organization_id]/sources/[source_id]". + * @param {string} request.findingId + * Required. Unique identifier provided by the client within the parent scope. + * It must be alphanumeric and less than or equal to 32 characters and + * greater than 0 characters in length. + * @param {google.cloud.securitycenter.v1.Finding} request.finding + * Required. The Finding being created. The name and security_marks will be + * ignored as they are both output only fields on this resource. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.Finding | Finding}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.create_finding.js + * region_tag:securitycenter_v1_generated_SecurityCenter_CreateFinding_async + */ + createFinding( + request?: protos.google.cloud.securitycenter.v1.ICreateFindingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ICreateFindingRequest|undefined, {}|undefined + ]>; + createFinding( + request: protos.google.cloud.securitycenter.v1.ICreateFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ICreateFindingRequest|null|undefined, + {}|null|undefined>): void; + createFinding( + request: protos.google.cloud.securitycenter.v1.ICreateFindingRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ICreateFindingRequest|null|undefined, + {}|null|undefined>): void; + createFinding( + request?: protos.google.cloud.securitycenter.v1.ICreateFindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ICreateFindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ICreateFindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ICreateFindingRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createFinding(request, options, callback); + } +/** + * Creates a mute config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new mute configs's parent. Its format is + * "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + * @param {google.cloud.securitycenter.v1.MuteConfig} request.muteConfig + * Required. The mute config being created. + * @param {string} request.muteConfigId + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.MuteConfig | MuteConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.create_mute_config.js + * region_tag:securitycenter_v1_generated_SecurityCenter_CreateMuteConfig_async + */ + createMuteConfig( + request?: protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|undefined, {}|undefined + ]>; + createMuteConfig( + request: protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|null|undefined, + {}|null|undefined>): void; + createMuteConfig( + request: protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|null|undefined, + {}|null|undefined>): void; + createMuteConfig( + request?: protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createMuteConfig(request, options, callback); + } +/** + * Creates a notification config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new notification config's parent. Its format + * is "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + * @param {string} request.configId + * Required. + * Unique identifier provided by the client within the parent scope. + * It must be between 1 and 128 characters and contain alphanumeric + * characters, underscores, or hyphens only. + * @param {google.cloud.securitycenter.v1.NotificationConfig} request.notificationConfig + * Required. The notification config being created. The name and the service + * account will be ignored as they are both output only fields on this + * resource. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.NotificationConfig | NotificationConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.create_notification_config.js + * region_tag:securitycenter_v1_generated_SecurityCenter_CreateNotificationConfig_async + */ + createNotificationConfig( + request?: protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|undefined, {}|undefined + ]>; + createNotificationConfig( + request: protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + createNotificationConfig( + request: protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + createNotificationConfig( + request?: protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createNotificationConfig(request, options, callback); + } +/** + * Deletes an existing mute config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the mute config to delete. Its format is + * organizations/{organization}/muteConfigs/{config_id}, + * folders/{folder}/muteConfigs/{config_id}, or + * projects/{project}/muteConfigs/{config_id} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.protobuf.Empty | Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.delete_mute_config.js + * region_tag:securitycenter_v1_generated_SecurityCenter_DeleteMuteConfig_async + */ + deleteMuteConfig( + request?: protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|undefined, {}|undefined + ]>; + deleteMuteConfig( + request: protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteMuteConfig( + request: protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteMuteConfig( + request?: protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteMuteConfig(request, options, callback); + } +/** + * Deletes a notification config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the notification config to delete. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]", + * "folders/[folder_id]/notificationConfigs/[config_id]", + * or "projects/[project_id]/notificationConfigs/[config_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.protobuf.Empty | Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.delete_notification_config.js + * region_tag:securitycenter_v1_generated_SecurityCenter_DeleteNotificationConfig_async + */ + deleteNotificationConfig( + request?: protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|undefined, {}|undefined + ]>; + deleteNotificationConfig( + request: protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteNotificationConfig( + request: protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteNotificationConfig( + request?: protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteNotificationConfig(request, options, callback); + } +/** + * Deletes the specified SecurityHealthAnalyticsCustomModule and all of its + * descendants in the CRM hierarchy. This method is only supported for + * resident custom modules. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the custom module to delete. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings/customModules/{customModule}", + * "folders/{folder}/securityHealthAnalyticsSettings/customModules/{customModule}", + * or + * "projects/{project}/securityHealthAnalyticsSettings/customModules/{customModule}" + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.protobuf.Empty | Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.delete_security_health_analytics_custom_module.js + * region_tag:securitycenter_v1_generated_SecurityCenter_DeleteSecurityHealthAnalyticsCustomModule_async + */ + deleteSecurityHealthAnalyticsCustomModule( + request?: protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined + ]>; + deleteSecurityHealthAnalyticsCustomModule( + request: protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>): void; + deleteSecurityHealthAnalyticsCustomModule( + request: protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>): void; + deleteSecurityHealthAnalyticsCustomModule( + request?: protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule(request, options, callback); + } +/** + * Gets a BigQuery export. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the BigQuery export to retrieve. Its format is + * organizations/{organization}/bigQueryExports/{export_id}, + * folders/{folder}/bigQueryExports/{export_id}, or + * projects/{project}/bigQueryExports/{export_id} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.BigQueryExport | BigQueryExport}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.get_big_query_export.js + * region_tag:securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_async + */ + getBigQueryExport( + request?: protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|undefined, {}|undefined + ]>; + getBigQueryExport( + request: protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|null|undefined, + {}|null|undefined>): void; + getBigQueryExport( + request: protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|null|undefined, + {}|null|undefined>): void; + getBigQueryExport( + request?: protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getBigQueryExport(request, options, callback); + } +/** + * Gets the access control policy on the specified Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.GetPolicyOptions} request.options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.get_iam_policy.js + * region_tag:securitycenter_v1_generated_SecurityCenter_GetIamPolicy_async + */ + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource': request.resource ?? '', + }); + this.initialize(); + return this.innerApiCalls.getIamPolicy(request, options, callback); + } +/** + * Gets a mute config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the mute config to retrieve. Its format is + * organizations/{organization}/muteConfigs/{config_id}, + * folders/{folder}/muteConfigs/{config_id}, or + * projects/{project}/muteConfigs/{config_id} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.MuteConfig | MuteConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.get_mute_config.js + * region_tag:securitycenter_v1_generated_SecurityCenter_GetMuteConfig_async + */ + getMuteConfig( + request?: protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|undefined, {}|undefined + ]>; + getMuteConfig( + request: protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|null|undefined, + {}|null|undefined>): void; + getMuteConfig( + request: protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|null|undefined, + {}|null|undefined>): void; + getMuteConfig( + request?: protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getMuteConfig(request, options, callback); + } +/** + * Gets a notification config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the notification config to get. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]", + * "folders/[folder_id]/notificationConfigs/[config_id]", + * or "projects/[project_id]/notificationConfigs/[config_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.NotificationConfig | NotificationConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.get_notification_config.js + * region_tag:securitycenter_v1_generated_SecurityCenter_GetNotificationConfig_async + */ + getNotificationConfig( + request?: protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|undefined, {}|undefined + ]>; + getNotificationConfig( + request: protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + getNotificationConfig( + request: protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + getNotificationConfig( + request?: protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getNotificationConfig(request, options, callback); + } +/** + * Gets the settings for an organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the organization to get organization settings for. Its + * format is "organizations/[organization_id]/organizationSettings". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.OrganizationSettings | OrganizationSettings}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.get_organization_settings.js + * region_tag:securitycenter_v1_generated_SecurityCenter_GetOrganizationSettings_async + */ + getOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|undefined, {}|undefined + ]>; + getOrganizationSettings( + request: protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + getOrganizationSettings( + request: protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + getOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getOrganizationSettings(request, options, callback); + } +/** + * Retrieves an EffectiveSecurityHealthAnalyticsCustomModule. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the effective custom module to get. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}", + * "folders/{folder}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}", + * or + * "projects/{project}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}" + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule | EffectiveSecurityHealthAnalyticsCustomModule}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.get_effective_security_health_analytics_custom_module.js + * region_tag:securitycenter_v1_generated_SecurityCenter_GetEffectiveSecurityHealthAnalyticsCustomModule_async + */ + getEffectiveSecurityHealthAnalyticsCustomModule( + request?: protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined + ]>; + getEffectiveSecurityHealthAnalyticsCustomModule( + request: protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>): void; + getEffectiveSecurityHealthAnalyticsCustomModule( + request: protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>): void; + getEffectiveSecurityHealthAnalyticsCustomModule( + request?: protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule(request, options, callback); + } +/** + * Retrieves a SecurityHealthAnalyticsCustomModule. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the custom module to get. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings/customModules/{customModule}", + * "folders/{folder}/securityHealthAnalyticsSettings/customModules/{customModule}", + * or + * "projects/{project}/securityHealthAnalyticsSettings/customModules/{customModule}" + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule | SecurityHealthAnalyticsCustomModule}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.get_security_health_analytics_custom_module.js + * region_tag:securitycenter_v1_generated_SecurityCenter_GetSecurityHealthAnalyticsCustomModule_async + */ + getSecurityHealthAnalyticsCustomModule( + request?: protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined + ]>; + getSecurityHealthAnalyticsCustomModule( + request: protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>): void; + getSecurityHealthAnalyticsCustomModule( + request: protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>): void; + getSecurityHealthAnalyticsCustomModule( + request?: protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getSecurityHealthAnalyticsCustomModule(request, options, callback); + } +/** + * Gets a source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Relative resource name of the source. Its format is + * "organizations/[organization_id]/source/[source_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.Source | Source}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.get_source.js + * region_tag:securitycenter_v1_generated_SecurityCenter_GetSource_async + */ + getSource( + request?: protos.google.cloud.securitycenter.v1.IGetSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IGetSourceRequest|undefined, {}|undefined + ]>; + getSource( + request: protos.google.cloud.securitycenter.v1.IGetSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IGetSourceRequest|null|undefined, + {}|null|undefined>): void; + getSource( + request: protos.google.cloud.securitycenter.v1.IGetSourceRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IGetSourceRequest|null|undefined, + {}|null|undefined>): void; + getSource( + request?: protos.google.cloud.securitycenter.v1.IGetSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IGetSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IGetSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IGetSourceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getSource(request, options, callback); + } +/** + * Updates the state of a finding. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The [relative resource + * name](https://cloud.google.com/apis/design/resource_names#relative_resource_name) + * of the finding. Example: + * "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", + * "folders/{folder_id}/sources/{source_id}/findings/{finding_id}", + * "projects/{project_id}/sources/{source_id}/findings/{finding_id}". + * @param {google.cloud.securitycenter.v1.Finding.State} request.state + * Required. The desired State of the finding. + * @param {google.protobuf.Timestamp} request.startTime + * Required. The time at which the updated state takes effect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.Finding | Finding}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.set_finding_state.js + * region_tag:securitycenter_v1_generated_SecurityCenter_SetFindingState_async + */ + setFindingState( + request?: protos.google.cloud.securitycenter.v1.ISetFindingStateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|undefined, {}|undefined + ]>; + setFindingState( + request: protos.google.cloud.securitycenter.v1.ISetFindingStateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>): void; + setFindingState( + request: protos.google.cloud.securitycenter.v1.ISetFindingStateRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>): void; + setFindingState( + request?: protos.google.cloud.securitycenter.v1.ISetFindingStateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.setFindingState(request, options, callback); + } +/** + * Updates the mute state of a finding. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The [relative resource + * name](https://cloud.google.com/apis/design/resource_names#relative_resource_name) + * of the finding. Example: + * "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", + * "folders/{folder_id}/sources/{source_id}/findings/{finding_id}", + * "projects/{project_id}/sources/{source_id}/findings/{finding_id}". + * @param {google.cloud.securitycenter.v1.Finding.Mute} request.mute + * Required. The desired state of the Mute. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.Finding | Finding}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.set_mute.js + * region_tag:securitycenter_v1_generated_SecurityCenter_SetMute_async + */ + setMute( + request?: protos.google.cloud.securitycenter.v1.ISetMuteRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetMuteRequest|undefined, {}|undefined + ]>; + setMute( + request: protos.google.cloud.securitycenter.v1.ISetMuteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetMuteRequest|null|undefined, + {}|null|undefined>): void; + setMute( + request: protos.google.cloud.securitycenter.v1.ISetMuteRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetMuteRequest|null|undefined, + {}|null|undefined>): void; + setMute( + request?: protos.google.cloud.securitycenter.v1.ISetMuteRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetMuteRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetMuteRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetMuteRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.setMute(request, options, callback); + } +/** + * Sets the access control policy on the specified Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.Policy} request.policy + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param {google.protobuf.FieldMask} request.updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.set_iam_policy.js + * region_tag:securitycenter_v1_generated_SecurityCenter_SetIamPolicy_async + */ + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource': request.resource ?? '', + }); + this.initialize(); + return this.innerApiCalls.setIamPolicy(request, options, callback); + } +/** + * Returns the permissions that a caller has on the specified source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.test_iam_permissions.js + * region_tag:securitycenter_v1_generated_SecurityCenter_TestIamPermissions_async + */ + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource': request.resource ?? '', + }); + this.initialize(); + return this.innerApiCalls.testIamPermissions(request, options, callback); + } +/** + * Updates external system. This is for a given finding. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1.ExternalSystem} request.externalSystem + * Required. The external system resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the external system resource. + * + * If empty all mutable fields will be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.ExternalSystem | ExternalSystem}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.update_external_system.js + * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateExternalSystem_async + */ + updateExternalSystem( + request?: protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IExternalSystem, + protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|undefined, {}|undefined + ]>; + updateExternalSystem( + request: protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IExternalSystem, + protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|null|undefined, + {}|null|undefined>): void; + updateExternalSystem( + request: protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IExternalSystem, + protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|null|undefined, + {}|null|undefined>): void; + updateExternalSystem( + request?: protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IExternalSystem, + protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IExternalSystem, + protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IExternalSystem, + protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'external_system.name': request.externalSystem!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateExternalSystem(request, options, callback); + } +/** + * Creates or updates a finding. The corresponding source must exist for a + * finding creation to succeed. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1.Finding} request.finding + * Required. The finding resource to update or create if it does not already + * exist. parent, security_marks, and update_time will be ignored. + * + * In the case of creation, the finding id portion of the name must be + * alphanumeric and less than or equal to 32 characters and greater than 0 + * characters in length. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the finding resource. This field should + * not be specified when creating a finding. + * + * When updating a finding, an empty mask is treated as updating all mutable + * fields and replacing source_properties. Individual source_properties can + * be added/updated by using "source_properties." in the field + * mask. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.Finding | Finding}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.update_finding.js + * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateFinding_async + */ + updateFinding( + request?: protos.google.cloud.securitycenter.v1.IUpdateFindingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|undefined, {}|undefined + ]>; + updateFinding( + request: protos.google.cloud.securitycenter.v1.IUpdateFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>): void; + updateFinding( + request: protos.google.cloud.securitycenter.v1.IUpdateFindingRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>): void; + updateFinding( + request?: protos.google.cloud.securitycenter.v1.IUpdateFindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'finding.name': request.finding!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFinding(request, options, callback); + } +/** + * Updates a mute config. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1.MuteConfig} request.muteConfig + * Required. The mute config being updated. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. + * If empty all mutable fields will be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.MuteConfig | MuteConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.update_mute_config.js + * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateMuteConfig_async + */ + updateMuteConfig( + request?: protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|undefined, {}|undefined + ]>; + updateMuteConfig( + request: protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|null|undefined, + {}|null|undefined>): void; + updateMuteConfig( + request: protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|null|undefined, + {}|null|undefined>): void; + updateMuteConfig( + request?: protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'mute_config.name': request.muteConfig!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateMuteConfig(request, options, callback); + } +/** + * + * Updates a notification config. The following update + * fields are allowed: description, pubsub_topic, streaming_config.filter + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1.NotificationConfig} request.notificationConfig + * Required. The notification config to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the notification config. + * + * If empty all mutable fields will be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.NotificationConfig | NotificationConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.update_notification_config.js + * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateNotificationConfig_async + */ + updateNotificationConfig( + request?: protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|undefined, {}|undefined + ]>; + updateNotificationConfig( + request: protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + updateNotificationConfig( + request: protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + updateNotificationConfig( + request?: protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'notification_config.name': request.notificationConfig!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateNotificationConfig(request, options, callback); + } +/** + * Updates an organization's settings. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1.OrganizationSettings} request.organizationSettings + * Required. The organization settings resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the settings resource. + * + * If empty all mutable fields will be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.OrganizationSettings | OrganizationSettings}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.update_organization_settings.js + * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateOrganizationSettings_async + */ + updateOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|undefined, {}|undefined + ]>; + updateOrganizationSettings( + request: protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateOrganizationSettings( + request: protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'organization_settings.name': request.organizationSettings!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateOrganizationSettings(request, options, callback); + } +/** + * Updates the SecurityHealthAnalyticsCustomModule under the given name based + * on the given update mask. Updating the enablement state is supported on + * both resident and inherited modules (though resident modules cannot have an + * enablement state of "inherited"). Updating the display name and custom + * config of a module is supported on resident modules only. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule} request.securityHealthAnalyticsCustomModule + * Required. The SecurityHealthAnalytics custom module to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to update. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule | SecurityHealthAnalyticsCustomModule}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.update_security_health_analytics_custom_module.js + * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateSecurityHealthAnalyticsCustomModule_async + */ + updateSecurityHealthAnalyticsCustomModule( + request?: protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined + ]>; + updateSecurityHealthAnalyticsCustomModule( + request: protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>): void; + updateSecurityHealthAnalyticsCustomModule( + request: protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>): void; + updateSecurityHealthAnalyticsCustomModule( + request?: protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, + protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'security_health_analytics_custom_module.name': request.securityHealthAnalyticsCustomModule!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSecurityHealthAnalyticsCustomModule(request, options, callback); + } +/** + * Updates a source. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1.Source} request.source + * Required. The source resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the source resource. + * + * If empty all mutable fields will be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.Source | Source}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.update_source.js + * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateSource_async + */ + updateSource( + request?: protos.google.cloud.securitycenter.v1.IUpdateSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|undefined, {}|undefined + ]>; + updateSource( + request: protos.google.cloud.securitycenter.v1.IUpdateSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>): void; + updateSource( + request: protos.google.cloud.securitycenter.v1.IUpdateSourceRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>): void; + updateSource( + request?: protos.google.cloud.securitycenter.v1.IUpdateSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'source.name': request.source!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSource(request, options, callback); + } +/** + * Updates security marks. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1.SecurityMarks} request.securityMarks + * Required. The security marks resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the security marks resource. + * + * The field mask must not contain duplicate fields. + * If empty or set to "marks", all marks will be replaced. Individual + * marks can be updated using "marks.". + * @param {google.protobuf.Timestamp} request.startTime + * The time at which the updated SecurityMarks take effect. + * If not set uses current server time. Updates will be applied to the + * SecurityMarks that are active immediately preceding this time. Must be + * earlier or equal to the server time. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.SecurityMarks | SecurityMarks}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.update_security_marks.js + * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateSecurityMarks_async + */ + updateSecurityMarks( + request?: protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ISecurityMarks, + protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|undefined, {}|undefined + ]>; + updateSecurityMarks( + request: protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISecurityMarks, + protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>): void; + updateSecurityMarks( + request: protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISecurityMarks, + protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>): void; + updateSecurityMarks( + request?: protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.ISecurityMarks, + protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.ISecurityMarks, + protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.ISecurityMarks, + protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'security_marks.name': request.securityMarks!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSecurityMarks(request, options, callback); + } +/** + * Creates a BigQuery export. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent resource of the new BigQuery export. Its + * format is "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + * @param {google.cloud.securitycenter.v1.BigQueryExport} request.bigQueryExport + * Required. The BigQuery export being created. + * @param {string} request.bigQueryExportId + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.BigQueryExport | BigQueryExport}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.create_big_query_export.js + * region_tag:securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_async + */ + createBigQueryExport( + request?: protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|undefined, {}|undefined + ]>; + createBigQueryExport( + request: protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|null|undefined, + {}|null|undefined>): void; + createBigQueryExport( + request: protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|null|undefined, + {}|null|undefined>): void; + createBigQueryExport( + request?: protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createBigQueryExport(request, options, callback); + } +/** + * Deletes an existing BigQuery export. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the BigQuery export to delete. Its format is + * organizations/{organization}/bigQueryExports/{export_id}, + * folders/{folder}/bigQueryExports/{export_id}, or + * projects/{project}/bigQueryExports/{export_id} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.protobuf.Empty | Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.delete_big_query_export.js + * region_tag:securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_async + */ + deleteBigQueryExport( + request?: protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|undefined, {}|undefined + ]>; + deleteBigQueryExport( + request: protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|null|undefined, + {}|null|undefined>): void; + deleteBigQueryExport( + request: protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|null|undefined, + {}|null|undefined>): void; + deleteBigQueryExport( + request?: protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteBigQueryExport(request, options, callback); + } +/** + * Updates a BigQuery export. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1.BigQueryExport} request.bigQueryExport + * Required. The BigQuery export being updated. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. + * If empty all mutable fields will be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.BigQueryExport | BigQueryExport}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.update_big_query_export.js + * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_async + */ + updateBigQueryExport( + request?: protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|undefined, {}|undefined + ]>; + updateBigQueryExport( + request: protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|null|undefined, + {}|null|undefined>): void; + updateBigQueryExport( + request: protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|null|undefined, + {}|null|undefined>): void; + updateBigQueryExport( + request?: protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'big_query_export.name': request.bigQueryExport!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateBigQueryExport(request, options, callback); + } + +/** + * Kicks off an LRO to bulk mute findings for a parent based on a filter. The + * parent can be either an organization, folder or project. The findings + * matched by the filter will be muted after the LRO is done. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, at which bulk action needs to be applied. Its format + * is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + * @param {string} request.filter + * Expression that identifies findings that should be updated. + * 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. + * @param {string} request.muteAnnotation + * This can be a mute configuration name or any identifier for mute/unmute + * of findings based on the filter. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/security_center.bulk_mute_findings.js + * region_tag:securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_async + */ + bulkMuteFindings( + request?: protos.google.cloud.securitycenter.v1.IBulkMuteFindingsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + bulkMuteFindings( + request: protos.google.cloud.securitycenter.v1.IBulkMuteFindingsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + bulkMuteFindings( + request: protos.google.cloud.securitycenter.v1.IBulkMuteFindingsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + bulkMuteFindings( + request?: protos.google.cloud.securitycenter.v1.IBulkMuteFindingsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.bulkMuteFindings(request, options, callback); + } +/** + * Check the status of the long running operation returned by `bulkMuteFindings()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/security_center.bulk_mute_findings.js + * region_tag:securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_async + */ + async checkBulkMuteFindingsProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.bulkMuteFindings, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Runs asset discovery. The discovery is tracked with a long-running + * operation. + * + * This API can only be called with limited frequency for an organization. If + * it is called too frequently the caller will receive a TOO_MANY_REQUESTS + * error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to run asset discovery for. Its format + * is "organizations/[organization_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/security_center.run_asset_discovery.js + * region_tag:securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_async + */ + runAssetDiscovery( + request?: protos.google.cloud.securitycenter.v1.IRunAssetDiscoveryRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + runAssetDiscovery( + request: protos.google.cloud.securitycenter.v1.IRunAssetDiscoveryRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runAssetDiscovery( + request: protos.google.cloud.securitycenter.v1.IRunAssetDiscoveryRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runAssetDiscovery( + request?: protos.google.cloud.securitycenter.v1.IRunAssetDiscoveryRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.runAssetDiscovery(request, options, callback); + } +/** + * Check the status of the long running operation returned by `runAssetDiscovery()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/security_center.run_asset_discovery.js + * region_tag:securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_async + */ + async checkRunAssetDiscoveryProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runAssetDiscovery, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Filters an organization's assets and groups them by their specified + * properties. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent to group the assets by. Its format is + * "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * 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 Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping. + * The string value should follow SQL syntax: comma separated list of fields. + * For example: + * "security_center_properties.resource_project,security_center_properties.project". + * + * The following fields are supported when compare_duration is not set: + * + * * security_center_properties.resource_project + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * * security_center_properties.resource_parent_display_name + * + * The following fields are supported when compare_duration is set: + * + * * security_center_properties.resource_type + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_parent_display_name + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" property is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1.GroupResult | GroupResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `groupAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + groupAssets( + request?: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IGroupResult[], + protos.google.cloud.securitycenter.v1.IGroupAssetsRequest|null, + protos.google.cloud.securitycenter.v1.IGroupAssetsResponse + ]>; + groupAssets( + request: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IGroupResult>): void; + groupAssets( + request: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IGroupResult>): void; + groupAssets( + request?: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IGroupResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IGroupResult>): + Promise<[ + protos.google.cloud.securitycenter.v1.IGroupResult[], + protos.google.cloud.securitycenter.v1.IGroupAssetsRequest|null, + protos.google.cloud.securitycenter.v1.IGroupAssetsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.groupAssets(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent to group the assets by. Its format is + * "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * 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 Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping. + * The string value should follow SQL syntax: comma separated list of fields. + * For example: + * "security_center_properties.resource_project,security_center_properties.project". + * + * The following fields are supported when compare_duration is not set: + * + * * security_center_properties.resource_project + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * * security_center_properties.resource_parent_display_name + * + * The following fields are supported when compare_duration is set: + * + * * security_center_properties.resource_type + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_parent_display_name + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" property is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.GroupResult | GroupResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `groupAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + groupAssetsStream( + request?: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['groupAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupAssets.createStream( + this.innerApiCalls.groupAssets as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `groupAssets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent to group the assets by. Its format is + * "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * 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 Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping. + * The string value should follow SQL syntax: comma separated list of fields. + * For example: + * "security_center_properties.resource_project,security_center_properties.project". + * + * The following fields are supported when compare_duration is not set: + * + * * security_center_properties.resource_project + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * * security_center_properties.resource_parent_display_name + * + * The following fields are supported when compare_duration is set: + * + * * security_center_properties.resource_type + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_parent_display_name + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" property is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1.GroupResult | GroupResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/security_center.group_assets.js + * region_tag:securitycenter_v1_generated_SecurityCenter_GroupAssets_async + */ + groupAssetsAsync( + request?: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['groupAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupAssets.asyncIterate( + this.innerApiCalls['groupAssets'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Filters an organization or source's findings and groups them by their + * specified properties. + * + * To group across all sources provide a `-` as the source id. + * Example: /v1/organizations/{organization_id}/sources/-/findings, + * /v1/folders/{folder_id}/sources/-/findings, + * /v1/projects/{project_id}/sources/-/findings + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]", + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]. To groupBy across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + * or projects/{project_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one 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. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * * severity: `=`, `:` + * * workflow_state: `=`, `:` + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * + * * resource: + * * resource.name: `=`, `:` + * * resource.parent_name: `=`, `:` + * * resource.parent_display_name: `=`, `:` + * * resource.project_name: `=`, `:` + * * resource.project_display_name: `=`, `:` + * * resource.type: `=`, `:` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping + * (including `state_change`). The string value should follow SQL syntax: + * comma separated list of fields. For example: "parent,resource_name". + * + * The following fields are supported: + * + * * resource_name + * * category + * * state + * * parent + * * severity + * + * The following fields are supported when compare_duration is set: + * + * * state_change + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" attribute is + * updated to indicate whether the finding had its state changed, the + * finding's state remained unchanged, or if the finding was added during the + * compare_duration period of time that precedes the read_time. This is the + * time between (read_time - compare_duration) and read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present + * at read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {string} request.pageToken + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1.GroupResult | GroupResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `groupFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + groupFindings( + request?: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IGroupResult[], + protos.google.cloud.securitycenter.v1.IGroupFindingsRequest|null, + protos.google.cloud.securitycenter.v1.IGroupFindingsResponse + ]>; + groupFindings( + request: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IGroupResult>): void; + groupFindings( + request: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IGroupResult>): void; + groupFindings( + request?: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IGroupResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IGroupResult>): + Promise<[ + protos.google.cloud.securitycenter.v1.IGroupResult[], + protos.google.cloud.securitycenter.v1.IGroupFindingsRequest|null, + protos.google.cloud.securitycenter.v1.IGroupFindingsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.groupFindings(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]", + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]. To groupBy across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + * or projects/{project_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one 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. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * * severity: `=`, `:` + * * workflow_state: `=`, `:` + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * + * * resource: + * * resource.name: `=`, `:` + * * resource.parent_name: `=`, `:` + * * resource.parent_display_name: `=`, `:` + * * resource.project_name: `=`, `:` + * * resource.project_display_name: `=`, `:` + * * resource.type: `=`, `:` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping + * (including `state_change`). The string value should follow SQL syntax: + * comma separated list of fields. For example: "parent,resource_name". + * + * The following fields are supported: + * + * * resource_name + * * category + * * state + * * parent + * * severity + * + * The following fields are supported when compare_duration is set: + * + * * state_change + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" attribute is + * updated to indicate whether the finding had its state changed, the + * finding's state remained unchanged, or if the finding was added during the + * compare_duration period of time that precedes the read_time. This is the + * time between (read_time - compare_duration) and read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present + * at read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {string} request.pageToken + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.GroupResult | GroupResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `groupFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + groupFindingsStream( + request?: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['groupFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupFindings.createStream( + this.innerApiCalls.groupFindings as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `groupFindings`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]", + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]. To groupBy across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + * or projects/{project_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one 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. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * * severity: `=`, `:` + * * workflow_state: `=`, `:` + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * + * * resource: + * * resource.name: `=`, `:` + * * resource.parent_name: `=`, `:` + * * resource.parent_display_name: `=`, `:` + * * resource.project_name: `=`, `:` + * * resource.project_display_name: `=`, `:` + * * resource.type: `=`, `:` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping + * (including `state_change`). The string value should follow SQL syntax: + * comma separated list of fields. For example: "parent,resource_name". + * + * The following fields are supported: + * + * * resource_name + * * category + * * state + * * parent + * * severity + * + * The following fields are supported when compare_duration is set: + * + * * state_change + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" attribute is + * updated to indicate whether the finding had its state changed, the + * finding's state remained unchanged, or if the finding was added during the + * compare_duration period of time that precedes the read_time. This is the + * time between (read_time - compare_duration) and read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present + * at read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {string} request.pageToken + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1.GroupResult | GroupResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/security_center.group_findings.js + * region_tag:securitycenter_v1_generated_SecurityCenter_GroupFindings_async + */ + groupFindingsAsync( + request?: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['groupFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupFindings.asyncIterate( + this.innerApiCalls['groupFindings'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists an organization's assets. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent resource that contains the assets. The + * value that you can specify on parent depends on the method in which you + * specify parent. You can specify one of the following values: + * "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * 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 Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following are the allowed field and operator combinations: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * update_time + * resource_properties + * security_marks.marks + * security_center_properties.resource_name + * security_center_properties.resource_display_name + * security_center_properties.resource_parent + * security_center_properties.resource_parent_display_name + * security_center_properties.resource_project + * security_center_properties.resource_project_display_name + * security_center_properties.resource_type + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListAssetsResult's "state_change" + * attribute is updated to indicate whether the asset was added, removed, or + * remained present during the compare_duration period of time that precedes + * the read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult | ListAssetsResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAssets( + request?: protos.google.cloud.securitycenter.v1.IListAssetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[], + protos.google.cloud.securitycenter.v1.IListAssetsRequest|null, + protos.google.cloud.securitycenter.v1.IListAssetsResponse + ]>; + listAssets( + request: protos.google.cloud.securitycenter.v1.IListAssetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult>): void; + listAssets( + request: protos.google.cloud.securitycenter.v1.IListAssetsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult>): void; + listAssets( + request?: protos.google.cloud.securitycenter.v1.IListAssetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult>): + Promise<[ + protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[], + protos.google.cloud.securitycenter.v1.IListAssetsRequest|null, + protos.google.cloud.securitycenter.v1.IListAssetsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listAssets(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent resource that contains the assets. The + * value that you can specify on parent depends on the method in which you + * specify parent. You can specify one of the following values: + * "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * 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 Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following are the allowed field and operator combinations: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * update_time + * resource_properties + * security_marks.marks + * security_center_properties.resource_name + * security_center_properties.resource_display_name + * security_center_properties.resource_parent + * security_center_properties.resource_parent_display_name + * security_center_properties.resource_project + * security_center_properties.resource_project_display_name + * security_center_properties.resource_type + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListAssetsResult's "state_change" + * attribute is updated to indicate whether the asset was added, removed, or + * remained present during the compare_duration period of time that precedes + * the read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult | ListAssetsResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAssetsStream( + request?: protos.google.cloud.securitycenter.v1.IListAssetsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssets.createStream( + this.innerApiCalls.listAssets as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAssets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent resource that contains the assets. The + * value that you can specify on parent depends on the method in which you + * specify parent. You can specify one of the following values: + * "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * 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 Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following are the allowed field and operator combinations: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * update_time + * resource_properties + * security_marks.marks + * security_center_properties.resource_name + * security_center_properties.resource_display_name + * security_center_properties.resource_parent + * security_center_properties.resource_parent_display_name + * security_center_properties.resource_project + * security_center_properties.resource_project_display_name + * security_center_properties.resource_type + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListAssetsResult's "state_change" + * attribute is updated to indicate whether the asset was added, removed, or + * remained present during the compare_duration period of time that precedes + * the read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult | ListAssetsResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/security_center.list_assets.js + * region_tag:securitycenter_v1_generated_SecurityCenter_ListAssets_async + */ + listAssetsAsync( + request?: protos.google.cloud.securitycenter.v1.IListAssetsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssets.asyncIterate( + this.innerApiCalls['listAssets'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns a list of all resident SecurityHealthAnalyticsCustomModules under + * the given CRM parent and all of the parent’s CRM descendants. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of parent to list descendant custom modules. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings", + * "folders/{folder}/securityHealthAnalyticsSettings", or + * "projects/{project}/securityHealthAnalyticsSettings" + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {string} request.pageToken + * The value returned by the last call indicating a continuation + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule | SecurityHealthAnalyticsCustomModule}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listDescendantSecurityHealthAnalyticsCustomModulesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listDescendantSecurityHealthAnalyticsCustomModules( + request?: protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[], + protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest|null, + protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesResponse + ]>; + listDescendantSecurityHealthAnalyticsCustomModules( + request: protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, + protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule>): void; + listDescendantSecurityHealthAnalyticsCustomModules( + request: protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, + protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule>): void; + listDescendantSecurityHealthAnalyticsCustomModules( + request?: protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, + protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, + protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule>): + Promise<[ + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[], + protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest|null, + protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of parent to list descendant custom modules. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings", + * "folders/{folder}/securityHealthAnalyticsSettings", or + * "projects/{project}/securityHealthAnalyticsSettings" + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {string} request.pageToken + * The value returned by the last call indicating a continuation + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule | SecurityHealthAnalyticsCustomModule} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listDescendantSecurityHealthAnalyticsCustomModulesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listDescendantSecurityHealthAnalyticsCustomModulesStream( + request?: protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listDescendantSecurityHealthAnalyticsCustomModules']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.createStream( + this.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listDescendantSecurityHealthAnalyticsCustomModules`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of parent to list descendant custom modules. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings", + * "folders/{folder}/securityHealthAnalyticsSettings", or + * "projects/{project}/securityHealthAnalyticsSettings" + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {string} request.pageToken + * The value returned by the last call indicating a continuation + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule | SecurityHealthAnalyticsCustomModule}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/security_center.list_descendant_security_health_analytics_custom_modules.js + * region_tag:securitycenter_v1_generated_SecurityCenter_ListDescendantSecurityHealthAnalyticsCustomModules_async + */ + listDescendantSecurityHealthAnalyticsCustomModulesAsync( + request?: protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listDescendantSecurityHealthAnalyticsCustomModules']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.asyncIterate( + this.innerApiCalls['listDescendantSecurityHealthAnalyticsCustomModules'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists an organization or source's findings. + * + * To list across all sources provide a `-` as the source id. + * Example: /v1/organizations/{organization_id}/sources/-/findings + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id], + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]". To list across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + * projects/{projects_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one 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. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * * severity: `=`, `:` + * * workflow_state: `=`, `:` + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * + * * resource: + * * resource.name: `=`, `:` + * * resource.parent_name: `=`, `:` + * * resource.parent_display_name: `=`, `:` + * * resource.project_name: `=`, `:` + * * resource.project_display_name: `=`, `:` + * * resource.type: `=`, `:` + * * resource.folders.resource_folder: `=`, `:` + * * resource.display_name: `=`, `:` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * parent + * state + * category + * resource_name + * event_time + * source_properties + * security_marks.marks + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListFindingsResult's "state_change" + * attribute is updated to indicate whether the finding had its state changed, + * the finding's state remained unchanged, or if the finding was added in any + * state during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult | ListFindingsResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFindings( + request?: protos.google.cloud.securitycenter.v1.IListFindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult[], + protos.google.cloud.securitycenter.v1.IListFindingsRequest|null, + protos.google.cloud.securitycenter.v1.IListFindingsResponse + ]>; + listFindings( + request: protos.google.cloud.securitycenter.v1.IListFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult>): void; + listFindings( + request: protos.google.cloud.securitycenter.v1.IListFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult>): void; + listFindings( + request?: protos.google.cloud.securitycenter.v1.IListFindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult>): + Promise<[ + protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult[], + protos.google.cloud.securitycenter.v1.IListFindingsRequest|null, + protos.google.cloud.securitycenter.v1.IListFindingsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listFindings(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id], + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]". To list across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + * projects/{projects_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one 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. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * * severity: `=`, `:` + * * workflow_state: `=`, `:` + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * + * * resource: + * * resource.name: `=`, `:` + * * resource.parent_name: `=`, `:` + * * resource.parent_display_name: `=`, `:` + * * resource.project_name: `=`, `:` + * * resource.project_display_name: `=`, `:` + * * resource.type: `=`, `:` + * * resource.folders.resource_folder: `=`, `:` + * * resource.display_name: `=`, `:` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * parent + * state + * category + * resource_name + * event_time + * source_properties + * security_marks.marks + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListFindingsResult's "state_change" + * attribute is updated to indicate whether the finding had its state changed, + * the finding's state remained unchanged, or if the finding was added in any + * state during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult | ListFindingsResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFindingsStream( + request?: protos.google.cloud.securitycenter.v1.IListFindingsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFindings.createStream( + this.innerApiCalls.listFindings as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFindings`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id], + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]". To list across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + * projects/{projects_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one 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. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * * severity: `=`, `:` + * * workflow_state: `=`, `:` + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * + * * resource: + * * resource.name: `=`, `:` + * * resource.parent_name: `=`, `:` + * * resource.parent_display_name: `=`, `:` + * * resource.project_name: `=`, `:` + * * resource.project_display_name: `=`, `:` + * * resource.type: `=`, `:` + * * resource.folders.resource_folder: `=`, `:` + * * resource.display_name: `=`, `:` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * parent + * state + * category + * resource_name + * event_time + * source_properties + * security_marks.marks + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListFindingsResult's "state_change" + * attribute is updated to indicate whether the finding had its state changed, + * the finding's state remained unchanged, or if the finding was added in any + * state during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult | ListFindingsResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/security_center.list_findings.js + * region_tag:securitycenter_v1_generated_SecurityCenter_ListFindings_async + */ + listFindingsAsync( + request?: protos.google.cloud.securitycenter.v1.IListFindingsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFindings.asyncIterate( + this.innerApiCalls['listFindings'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists mute configs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns the collection of mute configs. Its format + * is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + * @param {number} request.pageSize + * 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. + * @param {string} request.pageToken + * A page token, received from a previous `ListMuteConfigs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListMuteConfigs` must + * match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1.MuteConfig | MuteConfig}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listMuteConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listMuteConfigs( + request?: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IMuteConfig[], + protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest|null, + protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse + ]>; + listMuteConfigs( + request: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IMuteConfig>): void; + listMuteConfigs( + request: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IMuteConfig>): void; + listMuteConfigs( + request?: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IMuteConfig>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IMuteConfig>): + Promise<[ + protos.google.cloud.securitycenter.v1.IMuteConfig[], + protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest|null, + protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listMuteConfigs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns the collection of mute configs. Its format + * is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + * @param {number} request.pageSize + * 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. + * @param {string} request.pageToken + * A page token, received from a previous `ListMuteConfigs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListMuteConfigs` must + * match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.MuteConfig | MuteConfig} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listMuteConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listMuteConfigsStream( + request?: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMuteConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMuteConfigs.createStream( + this.innerApiCalls.listMuteConfigs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMuteConfigs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns the collection of mute configs. Its format + * is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + * @param {number} request.pageSize + * 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. + * @param {string} request.pageToken + * A page token, received from a previous `ListMuteConfigs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListMuteConfigs` must + * match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1.MuteConfig | MuteConfig}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/security_center.list_mute_configs.js + * region_tag:securitycenter_v1_generated_SecurityCenter_ListMuteConfigs_async + */ + listMuteConfigsAsync( + request?: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMuteConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMuteConfigs.asyncIterate( + this.innerApiCalls['listMuteConfigs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists notification configs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent in which to list the notification + * configurations. Its format is "organizations/[organization_id]", + * "folders/[folder_id]", or "projects/[project_id]". + * @param {string} request.pageToken + * The value returned by the last `ListNotificationConfigsResponse`; indicates + * that this is a continuation of a prior `ListNotificationConfigs` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1.NotificationConfig | NotificationConfig}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listNotificationConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listNotificationConfigs( + request?: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.INotificationConfig[], + protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest|null, + protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse + ]>; + listNotificationConfigs( + request: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.INotificationConfig>): void; + listNotificationConfigs( + request: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.INotificationConfig>): void; + listNotificationConfigs( + request?: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.INotificationConfig>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.INotificationConfig>): + Promise<[ + protos.google.cloud.securitycenter.v1.INotificationConfig[], + protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest|null, + protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listNotificationConfigs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent in which to list the notification + * configurations. Its format is "organizations/[organization_id]", + * "folders/[folder_id]", or "projects/[project_id]". + * @param {string} request.pageToken + * The value returned by the last `ListNotificationConfigsResponse`; indicates + * that this is a continuation of a prior `ListNotificationConfigs` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.NotificationConfig | NotificationConfig} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listNotificationConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listNotificationConfigsStream( + request?: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listNotificationConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNotificationConfigs.createStream( + this.innerApiCalls.listNotificationConfigs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listNotificationConfigs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent in which to list the notification + * configurations. Its format is "organizations/[organization_id]", + * "folders/[folder_id]", or "projects/[project_id]". + * @param {string} request.pageToken + * The value returned by the last `ListNotificationConfigsResponse`; indicates + * that this is a continuation of a prior `ListNotificationConfigs` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1.NotificationConfig | NotificationConfig}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/security_center.list_notification_configs.js + * region_tag:securitycenter_v1_generated_SecurityCenter_ListNotificationConfigs_async + */ + listNotificationConfigsAsync( + request?: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listNotificationConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNotificationConfigs.asyncIterate( + this.innerApiCalls['listNotificationConfigs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns a list of all EffectiveSecurityHealthAnalyticsCustomModules for the + * given parent. This includes resident modules defined at the scope of the + * parent, and inherited modules, inherited from CRM ancestors. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of parent to list effective custom modules. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings", + * "folders/{folder}/securityHealthAnalyticsSettings", or + * "projects/{project}/securityHealthAnalyticsSettings" + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {string} request.pageToken + * The value returned by the last call indicating a continuation + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule | EffectiveSecurityHealthAnalyticsCustomModule}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listEffectiveSecurityHealthAnalyticsCustomModulesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listEffectiveSecurityHealthAnalyticsCustomModules( + request?: protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule[], + protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest|null, + protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesResponse + ]>; + listEffectiveSecurityHealthAnalyticsCustomModules( + request: protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, + protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule>): void; + listEffectiveSecurityHealthAnalyticsCustomModules( + request: protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, + protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule>): void; + listEffectiveSecurityHealthAnalyticsCustomModules( + request?: protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, + protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, + protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule>): + Promise<[ + protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule[], + protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest|null, + protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of parent to list effective custom modules. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings", + * "folders/{folder}/securityHealthAnalyticsSettings", or + * "projects/{project}/securityHealthAnalyticsSettings" + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {string} request.pageToken + * The value returned by the last call indicating a continuation + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule | EffectiveSecurityHealthAnalyticsCustomModule} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listEffectiveSecurityHealthAnalyticsCustomModulesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listEffectiveSecurityHealthAnalyticsCustomModulesStream( + request?: protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listEffectiveSecurityHealthAnalyticsCustomModules']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.createStream( + this.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listEffectiveSecurityHealthAnalyticsCustomModules`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of parent to list effective custom modules. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings", + * "folders/{folder}/securityHealthAnalyticsSettings", or + * "projects/{project}/securityHealthAnalyticsSettings" + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {string} request.pageToken + * The value returned by the last call indicating a continuation + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule | EffectiveSecurityHealthAnalyticsCustomModule}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/security_center.list_effective_security_health_analytics_custom_modules.js + * region_tag:securitycenter_v1_generated_SecurityCenter_ListEffectiveSecurityHealthAnalyticsCustomModules_async + */ + listEffectiveSecurityHealthAnalyticsCustomModulesAsync( + request?: protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listEffectiveSecurityHealthAnalyticsCustomModules']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.asyncIterate( + this.innerApiCalls['listEffectiveSecurityHealthAnalyticsCustomModules'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns a list of all SecurityHealthAnalyticsCustomModules for the given + * parent. This includes resident modules defined at the scope of the parent, + * and inherited modules, inherited from CRM ancestors. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of parent to list custom modules. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings", + * "folders/{folder}/securityHealthAnalyticsSettings", or + * "projects/{project}/securityHealthAnalyticsSettings" + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {string} request.pageToken + * The value returned by the last call indicating a continuation + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule | SecurityHealthAnalyticsCustomModule}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSecurityHealthAnalyticsCustomModulesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listSecurityHealthAnalyticsCustomModules( + request?: protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[], + protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest|null, + protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesResponse + ]>; + listSecurityHealthAnalyticsCustomModules( + request: protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, + protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule>): void; + listSecurityHealthAnalyticsCustomModules( + request: protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, + protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule>): void; + listSecurityHealthAnalyticsCustomModules( + request?: protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, + protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, + protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule>): + Promise<[ + protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[], + protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest|null, + protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listSecurityHealthAnalyticsCustomModules(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of parent to list custom modules. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings", + * "folders/{folder}/securityHealthAnalyticsSettings", or + * "projects/{project}/securityHealthAnalyticsSettings" + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {string} request.pageToken + * The value returned by the last call indicating a continuation + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule | SecurityHealthAnalyticsCustomModule} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSecurityHealthAnalyticsCustomModulesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listSecurityHealthAnalyticsCustomModulesStream( + request?: protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSecurityHealthAnalyticsCustomModules']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSecurityHealthAnalyticsCustomModules.createStream( + this.innerApiCalls.listSecurityHealthAnalyticsCustomModules as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSecurityHealthAnalyticsCustomModules`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of parent to list custom modules. Its format is + * "organizations/{organization}/securityHealthAnalyticsSettings", + * "folders/{folder}/securityHealthAnalyticsSettings", or + * "projects/{project}/securityHealthAnalyticsSettings" + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {string} request.pageToken + * The value returned by the last call indicating a continuation + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule | SecurityHealthAnalyticsCustomModule}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/security_center.list_security_health_analytics_custom_modules.js + * region_tag:securitycenter_v1_generated_SecurityCenter_ListSecurityHealthAnalyticsCustomModules_async + */ + listSecurityHealthAnalyticsCustomModulesAsync( + request?: protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSecurityHealthAnalyticsCustomModules']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSecurityHealthAnalyticsCustomModules.asyncIterate( + this.innerApiCalls['listSecurityHealthAnalyticsCustomModules'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all sources belonging to an organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent of sources to list. Its format should + * be "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + * @param {string} request.pageToken + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1.Source | Source}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSourcesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listSources( + request?: protos.google.cloud.securitycenter.v1.IListSourcesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ISource[], + protos.google.cloud.securitycenter.v1.IListSourcesRequest|null, + protos.google.cloud.securitycenter.v1.IListSourcesResponse + ]>; + listSources( + request: protos.google.cloud.securitycenter.v1.IListSourcesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ISource>): void; + listSources( + request: protos.google.cloud.securitycenter.v1.IListSourcesRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ISource>): void; + listSources( + request?: protos.google.cloud.securitycenter.v1.IListSourcesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ISource>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ISource>): + Promise<[ + protos.google.cloud.securitycenter.v1.ISource[], + protos.google.cloud.securitycenter.v1.IListSourcesRequest|null, + protos.google.cloud.securitycenter.v1.IListSourcesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listSources(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent of sources to list. Its format should + * be "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + * @param {string} request.pageToken + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.Source | Source} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSourcesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listSourcesStream( + request?: protos.google.cloud.securitycenter.v1.IListSourcesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSources.createStream( + this.innerApiCalls.listSources as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSources`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent of sources to list. Its format should + * be "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + * @param {string} request.pageToken + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1.Source | Source}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/security_center.list_sources.js + * region_tag:securitycenter_v1_generated_SecurityCenter_ListSources_async + */ + listSourcesAsync( + request?: protos.google.cloud.securitycenter.v1.IListSourcesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSources.asyncIterate( + this.innerApiCalls['listSources'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * 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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns the collection of BigQuery exports. Its + * format is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + * @param {number} request.pageSize + * 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. + * @param {string} request.pageToken + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1.BigQueryExport | BigQueryExport}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listBigQueryExportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listBigQueryExports( + request?: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IBigQueryExport[], + protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest|null, + protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse + ]>; + listBigQueryExports( + request: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IBigQueryExport>): void; + listBigQueryExports( + request: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IBigQueryExport>): void; + listBigQueryExports( + request?: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IBigQueryExport>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IBigQueryExport>): + Promise<[ + protos.google.cloud.securitycenter.v1.IBigQueryExport[], + protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest|null, + protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listBigQueryExports(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns the collection of BigQuery exports. Its + * format is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + * @param {number} request.pageSize + * 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. + * @param {string} request.pageToken + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.BigQueryExport | BigQueryExport} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listBigQueryExportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listBigQueryExportsStream( + request?: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBigQueryExports']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBigQueryExports.createStream( + this.innerApiCalls.listBigQueryExports as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBigQueryExports`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns the collection of BigQuery exports. Its + * format is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + * @param {number} request.pageSize + * 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. + * @param {string} request.pageToken + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1.BigQueryExport | BigQueryExport}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/security_center.list_big_query_exports.js + * region_tag:securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_async + */ + listBigQueryExportsAsync( + request?: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBigQueryExports']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBigQueryExports.asyncIterate( + this.innerApiCalls['listBigQueryExports'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified folderAsset resource name string. + * + * @param {string} folder + * @param {string} asset + * @returns {string} Resource name string. + */ + folderAssetPath(folder:string,asset:string) { + return this.pathTemplates.folderAssetPathTemplate.render({ + folder: folder, + asset: asset, + }); + } + + /** + * Parse the folder from FolderAsset resource. + * + * @param {string} folderAssetName + * A fully-qualified path representing folder_asset resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAssetName(folderAssetName: string) { + return this.pathTemplates.folderAssetPathTemplate.match(folderAssetName).folder; + } + + /** + * Parse the asset from FolderAsset resource. + * + * @param {string} folderAssetName + * A fully-qualified path representing folder_asset resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromFolderAssetName(folderAssetName: string) { + return this.pathTemplates.folderAssetPathTemplate.match(folderAssetName).asset; + } + + /** + * Return a fully-qualified folderAssetSecurityMarks resource name string. + * + * @param {string} folder + * @param {string} asset + * @returns {string} Resource name string. + */ + folderAssetSecurityMarksPath(folder:string,asset:string) { + return this.pathTemplates.folderAssetSecurityMarksPathTemplate.render({ + folder: folder, + asset: asset, + }); + } + + /** + * Parse the folder from FolderAssetSecurityMarks resource. + * + * @param {string} folderAssetSecurityMarksName + * A fully-qualified path representing folder_asset_securityMarks resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAssetSecurityMarksName(folderAssetSecurityMarksName: string) { + return this.pathTemplates.folderAssetSecurityMarksPathTemplate.match(folderAssetSecurityMarksName).folder; + } + + /** + * Parse the asset from FolderAssetSecurityMarks resource. + * + * @param {string} folderAssetSecurityMarksName + * A fully-qualified path representing folder_asset_securityMarks resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromFolderAssetSecurityMarksName(folderAssetSecurityMarksName: string) { + return this.pathTemplates.folderAssetSecurityMarksPathTemplate.match(folderAssetSecurityMarksName).asset; + } + + /** + * Return a fully-qualified folderExport resource name string. + * + * @param {string} folder + * @param {string} exportParam + * @returns {string} Resource name string. + */ + folderExportPath(folder:string,exportParam:string) { + return this.pathTemplates.folderExportPathTemplate.render({ + folder: folder, + export: exportParam, + }); + } + + /** + * Parse the folder from FolderExport resource. + * + * @param {string} folderExportName + * A fully-qualified path representing folder_export resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderExportName(folderExportName: string) { + return this.pathTemplates.folderExportPathTemplate.match(folderExportName).folder; + } + + /** + * Parse the export from FolderExport resource. + * + * @param {string} folderExportName + * A fully-qualified path representing folder_export resource. + * @returns {string} A string representing the export. + */ + matchExportFromFolderExportName(folderExportName: string) { + return this.pathTemplates.folderExportPathTemplate.match(folderExportName).export; + } + + /** + * Return a fully-qualified folderMuteConfig resource name string. + * + * @param {string} folder + * @param {string} mute_config + * @returns {string} Resource name string. + */ + folderMuteConfigPath(folder:string,muteConfig:string) { + return this.pathTemplates.folderMuteConfigPathTemplate.render({ + folder: folder, + mute_config: muteConfig, + }); + } + + /** + * Parse the folder from FolderMuteConfig resource. + * + * @param {string} folderMuteConfigName + * A fully-qualified path representing folder_mute_config resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderMuteConfigName(folderMuteConfigName: string) { + return this.pathTemplates.folderMuteConfigPathTemplate.match(folderMuteConfigName).folder; + } + + /** + * Parse the mute_config from FolderMuteConfig resource. + * + * @param {string} folderMuteConfigName + * A fully-qualified path representing folder_mute_config resource. + * @returns {string} A string representing the mute_config. + */ + matchMuteConfigFromFolderMuteConfigName(folderMuteConfigName: string) { + return this.pathTemplates.folderMuteConfigPathTemplate.match(folderMuteConfigName).mute_config; + } + + /** + * Return a fully-qualified folderNotificationConfig resource name string. + * + * @param {string} folder + * @param {string} notification_config + * @returns {string} Resource name string. + */ + folderNotificationConfigPath(folder:string,notificationConfig:string) { + return this.pathTemplates.folderNotificationConfigPathTemplate.render({ + folder: folder, + notification_config: notificationConfig, + }); + } + + /** + * Parse the folder from FolderNotificationConfig resource. + * + * @param {string} folderNotificationConfigName + * A fully-qualified path representing folder_notification_config resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderNotificationConfigName(folderNotificationConfigName: string) { + return this.pathTemplates.folderNotificationConfigPathTemplate.match(folderNotificationConfigName).folder; + } + + /** + * Parse the notification_config from FolderNotificationConfig resource. + * + * @param {string} folderNotificationConfigName + * A fully-qualified path representing folder_notification_config resource. + * @returns {string} A string representing the notification_config. + */ + matchNotificationConfigFromFolderNotificationConfigName(folderNotificationConfigName: string) { + return this.pathTemplates.folderNotificationConfigPathTemplate.match(folderNotificationConfigName).notification_config; + } + + /** + * Return a fully-qualified folderSecurityHealthAnalyticsSettingsCustomModule resource name string. + * + * @param {string} folder + * @param {string} custom_module + * @returns {string} Resource name string. + */ + folderSecurityHealthAnalyticsSettingsCustomModulePath(folder:string,customModule:string) { + return this.pathTemplates.folderSecurityHealthAnalyticsSettingsCustomModulePathTemplate.render({ + folder: folder, + custom_module: customModule, + }); + } + + /** + * Parse the folder from FolderSecurityHealthAnalyticsSettingsCustomModule resource. + * + * @param {string} folderSecurityHealthAnalyticsSettingsCustomModuleName + * A fully-qualified path representing folder_securityHealthAnalyticsSettings_custom_module resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSecurityHealthAnalyticsSettingsCustomModuleName(folderSecurityHealthAnalyticsSettingsCustomModuleName: string) { + return this.pathTemplates.folderSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match(folderSecurityHealthAnalyticsSettingsCustomModuleName).folder; + } + + /** + * Parse the custom_module from FolderSecurityHealthAnalyticsSettingsCustomModule resource. + * + * @param {string} folderSecurityHealthAnalyticsSettingsCustomModuleName + * A fully-qualified path representing folder_securityHealthAnalyticsSettings_custom_module resource. + * @returns {string} A string representing the custom_module. + */ + matchCustomModuleFromFolderSecurityHealthAnalyticsSettingsCustomModuleName(folderSecurityHealthAnalyticsSettingsCustomModuleName: string) { + return this.pathTemplates.folderSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match(folderSecurityHealthAnalyticsSettingsCustomModuleName).custom_module; + } + + /** + * Return a fully-qualified folderSecurityHealthAnalyticsSettingsEffectiveCustomModule resource name string. + * + * @param {string} folder + * @param {string} effective_custom_module + * @returns {string} Resource name string. + */ + folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePath(folder:string,effectiveCustomModule:string) { + return this.pathTemplates.folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.render({ + folder: folder, + effective_custom_module: effectiveCustomModule, + }); + } + + /** + * Parse the folder from FolderSecurityHealthAnalyticsSettingsEffectiveCustomModule resource. + * + * @param {string} folderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName + * A fully-qualified path representing folder_securityHealthAnalyticsSettings_effective_custom_module resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(folderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName: string) { + return this.pathTemplates.folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match(folderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName).folder; + } + + /** + * Parse the effective_custom_module from FolderSecurityHealthAnalyticsSettingsEffectiveCustomModule resource. + * + * @param {string} folderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName + * A fully-qualified path representing folder_securityHealthAnalyticsSettings_effective_custom_module resource. + * @returns {string} A string representing the effective_custom_module. + */ + matchEffectiveCustomModuleFromFolderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(folderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName: string) { + return this.pathTemplates.folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match(folderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName).effective_custom_module; + } + + /** + * Return a fully-qualified folderSource resource name string. + * + * @param {string} folder + * @param {string} source + * @returns {string} Resource name string. + */ + folderSourcePath(folder:string,source:string) { + return this.pathTemplates.folderSourcePathTemplate.render({ + folder: folder, + source: source, + }); + } + + /** + * Parse the folder from FolderSource resource. + * + * @param {string} folderSourceName + * A fully-qualified path representing folder_source resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSourceName(folderSourceName: string) { + return this.pathTemplates.folderSourcePathTemplate.match(folderSourceName).folder; + } + + /** + * Parse the source from FolderSource resource. + * + * @param {string} folderSourceName + * A fully-qualified path representing folder_source resource. + * @returns {string} A string representing the source. + */ + matchSourceFromFolderSourceName(folderSourceName: string) { + return this.pathTemplates.folderSourcePathTemplate.match(folderSourceName).source; + } + + /** + * Return a fully-qualified folderSourceFinding resource name string. + * + * @param {string} folder + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + folderSourceFindingPath(folder:string,source:string,finding:string) { + return this.pathTemplates.folderSourceFindingPathTemplate.render({ + folder: folder, + source: source, + finding: finding, + }); + } + + /** + * Parse the folder from FolderSourceFinding resource. + * + * @param {string} folderSourceFindingName + * A fully-qualified path representing folder_source_finding resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSourceFindingName(folderSourceFindingName: string) { + return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).folder; + } + + /** + * Parse the source from FolderSourceFinding resource. + * + * @param {string} folderSourceFindingName + * A fully-qualified path representing folder_source_finding resource. + * @returns {string} A string representing the source. + */ + matchSourceFromFolderSourceFindingName(folderSourceFindingName: string) { + return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).source; + } + + /** + * Parse the finding from FolderSourceFinding resource. + * + * @param {string} folderSourceFindingName + * A fully-qualified path representing folder_source_finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromFolderSourceFindingName(folderSourceFindingName: string) { + return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).finding; + } + + /** + * Return a fully-qualified folderSourceFindingExternalsystem resource name string. + * + * @param {string} folder + * @param {string} source + * @param {string} finding + * @param {string} externalsystem + * @returns {string} Resource name string. + */ + folderSourceFindingExternalsystemPath(folder:string,source:string,finding:string,externalsystem:string) { + return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.render({ + folder: folder, + source: source, + finding: finding, + externalsystem: externalsystem, + }); + } + + /** + * Parse the folder from FolderSourceFindingExternalsystem resource. + * + * @param {string} folderSourceFindingExternalsystemName + * A fully-qualified path representing folder_source_finding_externalsystem resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSourceFindingExternalsystemName(folderSourceFindingExternalsystemName: string) { + return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match(folderSourceFindingExternalsystemName).folder; + } + + /** + * Parse the source from FolderSourceFindingExternalsystem resource. + * + * @param {string} folderSourceFindingExternalsystemName + * A fully-qualified path representing folder_source_finding_externalsystem resource. + * @returns {string} A string representing the source. + */ + matchSourceFromFolderSourceFindingExternalsystemName(folderSourceFindingExternalsystemName: string) { + return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match(folderSourceFindingExternalsystemName).source; + } + + /** + * Parse the finding from FolderSourceFindingExternalsystem resource. + * + * @param {string} folderSourceFindingExternalsystemName + * A fully-qualified path representing folder_source_finding_externalsystem resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromFolderSourceFindingExternalsystemName(folderSourceFindingExternalsystemName: string) { + return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match(folderSourceFindingExternalsystemName).finding; + } + + /** + * Parse the externalsystem from FolderSourceFindingExternalsystem resource. + * + * @param {string} folderSourceFindingExternalsystemName + * A fully-qualified path representing folder_source_finding_externalsystem resource. + * @returns {string} A string representing the externalsystem. + */ + matchExternalsystemFromFolderSourceFindingExternalsystemName(folderSourceFindingExternalsystemName: string) { + return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match(folderSourceFindingExternalsystemName).externalsystem; + } + + /** + * Return a fully-qualified folderSourceFindingSecurityMarks resource name string. + * + * @param {string} folder + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + folderSourceFindingSecurityMarksPath(folder:string,source:string,finding:string) { + return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render({ + folder: folder, + source: source, + finding: finding, + }); + } + + /** + * Parse the folder from FolderSourceFindingSecurityMarks resource. + * + * @param {string} folderSourceFindingSecurityMarksName + * A fully-qualified path representing folder_source_finding_securityMarks resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { + return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).folder; + } + + /** + * Parse the source from FolderSourceFindingSecurityMarks resource. + * + * @param {string} folderSourceFindingSecurityMarksName + * A fully-qualified path representing folder_source_finding_securityMarks resource. + * @returns {string} A string representing the source. + */ + matchSourceFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { + return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).source; + } + + /** + * Parse the finding from FolderSourceFindingSecurityMarks resource. + * + * @param {string} folderSourceFindingSecurityMarksName + * A fully-qualified path representing folder_source_finding_securityMarks resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { + return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).finding; + } + + /** + * Return a fully-qualified organization resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationPath(organization:string) { + return this.pathTemplates.organizationPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from Organization resource. + * + * @param {string} organizationName + * A fully-qualified path representing Organization resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationName(organizationName: string) { + return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; + } + + /** + * Return a fully-qualified organizationAsset resource name string. + * + * @param {string} organization + * @param {string} asset + * @returns {string} Resource name string. + */ + organizationAssetPath(organization:string,asset:string) { + return this.pathTemplates.organizationAssetPathTemplate.render({ + organization: organization, + asset: asset, + }); + } + + /** + * Parse the organization from OrganizationAsset resource. + * + * @param {string} organizationAssetName + * A fully-qualified path representing organization_asset resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAssetName(organizationAssetName: string) { + return this.pathTemplates.organizationAssetPathTemplate.match(organizationAssetName).organization; + } + + /** + * Parse the asset from OrganizationAsset resource. + * + * @param {string} organizationAssetName + * A fully-qualified path representing organization_asset resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromOrganizationAssetName(organizationAssetName: string) { + return this.pathTemplates.organizationAssetPathTemplate.match(organizationAssetName).asset; + } + + /** + * Return a fully-qualified organizationAssetSecurityMarks resource name string. + * + * @param {string} organization + * @param {string} asset + * @returns {string} Resource name string. + */ + organizationAssetSecurityMarksPath(organization:string,asset:string) { + return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.render({ + organization: organization, + asset: asset, + }); + } + + /** + * Parse the organization from OrganizationAssetSecurityMarks resource. + * + * @param {string} organizationAssetSecurityMarksName + * A fully-qualified path representing organization_asset_securityMarks resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { + return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).organization; + } + + /** + * Parse the asset from OrganizationAssetSecurityMarks resource. + * + * @param {string} organizationAssetSecurityMarksName + * A fully-qualified path representing organization_asset_securityMarks resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { + return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).asset; + } + + /** + * Return a fully-qualified organizationExport resource name string. + * + * @param {string} organization + * @param {string} exportParam + * @returns {string} Resource name string. + */ + organizationExportPath(organization:string,exportParam:string) { + return this.pathTemplates.organizationExportPathTemplate.render({ + organization: organization, + export: exportParam, + }); + } + + /** + * Parse the organization from OrganizationExport resource. + * + * @param {string} organizationExportName + * A fully-qualified path representing organization_export resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationExportName(organizationExportName: string) { + return this.pathTemplates.organizationExportPathTemplate.match(organizationExportName).organization; + } + + /** + * Parse the export from OrganizationExport resource. + * + * @param {string} organizationExportName + * A fully-qualified path representing organization_export resource. + * @returns {string} A string representing the export. + */ + matchExportFromOrganizationExportName(organizationExportName: string) { + return this.pathTemplates.organizationExportPathTemplate.match(organizationExportName).export; + } + + /** + * Return a fully-qualified organizationMuteConfig resource name string. + * + * @param {string} organization + * @param {string} mute_config + * @returns {string} Resource name string. + */ + organizationMuteConfigPath(organization:string,muteConfig:string) { + return this.pathTemplates.organizationMuteConfigPathTemplate.render({ + organization: organization, + mute_config: muteConfig, + }); + } + + /** + * Parse the organization from OrganizationMuteConfig resource. + * + * @param {string} organizationMuteConfigName + * A fully-qualified path representing organization_mute_config resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationMuteConfigName(organizationMuteConfigName: string) { + return this.pathTemplates.organizationMuteConfigPathTemplate.match(organizationMuteConfigName).organization; + } + + /** + * Parse the mute_config from OrganizationMuteConfig resource. + * + * @param {string} organizationMuteConfigName + * A fully-qualified path representing organization_mute_config resource. + * @returns {string} A string representing the mute_config. + */ + matchMuteConfigFromOrganizationMuteConfigName(organizationMuteConfigName: string) { + return this.pathTemplates.organizationMuteConfigPathTemplate.match(organizationMuteConfigName).mute_config; + } + + /** + * Return a fully-qualified organizationNotificationConfig resource name string. + * + * @param {string} organization + * @param {string} notification_config + * @returns {string} Resource name string. + */ + organizationNotificationConfigPath(organization:string,notificationConfig:string) { + return this.pathTemplates.organizationNotificationConfigPathTemplate.render({ + organization: organization, + notification_config: notificationConfig, + }); + } + + /** + * Parse the organization from OrganizationNotificationConfig resource. + * + * @param {string} organizationNotificationConfigName + * A fully-qualified path representing organization_notification_config resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationNotificationConfigName(organizationNotificationConfigName: string) { + return this.pathTemplates.organizationNotificationConfigPathTemplate.match(organizationNotificationConfigName).organization; + } + + /** + * Parse the notification_config from OrganizationNotificationConfig resource. + * + * @param {string} organizationNotificationConfigName + * A fully-qualified path representing organization_notification_config resource. + * @returns {string} A string representing the notification_config. + */ + matchNotificationConfigFromOrganizationNotificationConfigName(organizationNotificationConfigName: string) { + return this.pathTemplates.organizationNotificationConfigPathTemplate.match(organizationNotificationConfigName).notification_config; + } + + /** + * Return a fully-qualified organizationSecurityHealthAnalyticsSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationSecurityHealthAnalyticsSettingsPath(organization:string) { + return this.pathTemplates.organizationSecurityHealthAnalyticsSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationSecurityHealthAnalyticsSettings resource. + * + * @param {string} organizationSecurityHealthAnalyticsSettingsName + * A fully-qualified path representing organization_securityHealthAnalyticsSettings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSecurityHealthAnalyticsSettingsName(organizationSecurityHealthAnalyticsSettingsName: string) { + return this.pathTemplates.organizationSecurityHealthAnalyticsSettingsPathTemplate.match(organizationSecurityHealthAnalyticsSettingsName).organization; + } + + /** + * Return a fully-qualified organizationSecurityHealthAnalyticsSettingsCustomModule resource name string. + * + * @param {string} organization + * @param {string} custom_module + * @returns {string} Resource name string. + */ + organizationSecurityHealthAnalyticsSettingsCustomModulePath(organization:string,customModule:string) { + return this.pathTemplates.organizationSecurityHealthAnalyticsSettingsCustomModulePathTemplate.render({ + organization: organization, + custom_module: customModule, + }); + } + + /** + * Parse the organization from OrganizationSecurityHealthAnalyticsSettingsCustomModule resource. + * + * @param {string} organizationSecurityHealthAnalyticsSettingsCustomModuleName + * A fully-qualified path representing organization_securityHealthAnalyticsSettings_custom_module resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSecurityHealthAnalyticsSettingsCustomModuleName(organizationSecurityHealthAnalyticsSettingsCustomModuleName: string) { + return this.pathTemplates.organizationSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match(organizationSecurityHealthAnalyticsSettingsCustomModuleName).organization; + } + + /** + * Parse the custom_module from OrganizationSecurityHealthAnalyticsSettingsCustomModule resource. + * + * @param {string} organizationSecurityHealthAnalyticsSettingsCustomModuleName + * A fully-qualified path representing organization_securityHealthAnalyticsSettings_custom_module resource. + * @returns {string} A string representing the custom_module. + */ + matchCustomModuleFromOrganizationSecurityHealthAnalyticsSettingsCustomModuleName(organizationSecurityHealthAnalyticsSettingsCustomModuleName: string) { + return this.pathTemplates.organizationSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match(organizationSecurityHealthAnalyticsSettingsCustomModuleName).custom_module; + } + + /** + * Return a fully-qualified organizationSecurityHealthAnalyticsSettingsEffectiveCustomModule resource name string. + * + * @param {string} organization + * @param {string} effective_custom_module + * @returns {string} Resource name string. + */ + organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePath(organization:string,effectiveCustomModule:string) { + return this.pathTemplates.organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.render({ + organization: organization, + effective_custom_module: effectiveCustomModule, + }); + } + + /** + * Parse the organization from OrganizationSecurityHealthAnalyticsSettingsEffectiveCustomModule resource. + * + * @param {string} organizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName + * A fully-qualified path representing organization_securityHealthAnalyticsSettings_effective_custom_module resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(organizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName: string) { + return this.pathTemplates.organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match(organizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName).organization; + } + + /** + * Parse the effective_custom_module from OrganizationSecurityHealthAnalyticsSettingsEffectiveCustomModule resource. + * + * @param {string} organizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName + * A fully-qualified path representing organization_securityHealthAnalyticsSettings_effective_custom_module resource. + * @returns {string} A string representing the effective_custom_module. + */ + matchEffectiveCustomModuleFromOrganizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(organizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName: string) { + return this.pathTemplates.organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match(organizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName).effective_custom_module; + } + + /** + * Return a fully-qualified organizationSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationSettingsPath(organization:string) { + return this.pathTemplates.organizationSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationSettings resource. + * + * @param {string} organizationSettingsName + * A fully-qualified path representing OrganizationSettings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { + return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; + } + + /** + * Return a fully-qualified organizationSource resource name string. + * + * @param {string} organization + * @param {string} source + * @returns {string} Resource name string. + */ + organizationSourcePath(organization:string,source:string) { + return this.pathTemplates.organizationSourcePathTemplate.render({ + organization: organization, + source: source, + }); + } + + /** + * Parse the organization from OrganizationSource resource. + * + * @param {string} organizationSourceName + * A fully-qualified path representing organization_source resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSourceName(organizationSourceName: string) { + return this.pathTemplates.organizationSourcePathTemplate.match(organizationSourceName).organization; + } + + /** + * Parse the source from OrganizationSource resource. + * + * @param {string} organizationSourceName + * A fully-qualified path representing organization_source resource. + * @returns {string} A string representing the source. + */ + matchSourceFromOrganizationSourceName(organizationSourceName: string) { + return this.pathTemplates.organizationSourcePathTemplate.match(organizationSourceName).source; + } + + /** + * Return a fully-qualified organizationSourceFinding resource name string. + * + * @param {string} organization + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + organizationSourceFindingPath(organization:string,source:string,finding:string) { + return this.pathTemplates.organizationSourceFindingPathTemplate.render({ + organization: organization, + source: source, + finding: finding, + }); + } + + /** + * Parse the organization from OrganizationSourceFinding resource. + * + * @param {string} organizationSourceFindingName + * A fully-qualified path representing organization_source_finding resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSourceFindingName(organizationSourceFindingName: string) { + return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).organization; + } + + /** + * Parse the source from OrganizationSourceFinding resource. + * + * @param {string} organizationSourceFindingName + * A fully-qualified path representing organization_source_finding resource. + * @returns {string} A string representing the source. + */ + matchSourceFromOrganizationSourceFindingName(organizationSourceFindingName: string) { + return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).source; + } + + /** + * Parse the finding from OrganizationSourceFinding resource. + * + * @param {string} organizationSourceFindingName + * A fully-qualified path representing organization_source_finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromOrganizationSourceFindingName(organizationSourceFindingName: string) { + return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).finding; + } + + /** + * Return a fully-qualified organizationSourceFindingExternalsystem resource name string. + * + * @param {string} organization + * @param {string} source + * @param {string} finding + * @param {string} externalsystem + * @returns {string} Resource name string. + */ + organizationSourceFindingExternalsystemPath(organization:string,source:string,finding:string,externalsystem:string) { + return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.render({ + organization: organization, + source: source, + finding: finding, + externalsystem: externalsystem, + }); + } + + /** + * Parse the organization from OrganizationSourceFindingExternalsystem resource. + * + * @param {string} organizationSourceFindingExternalsystemName + * A fully-qualified path representing organization_source_finding_externalsystem resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSourceFindingExternalsystemName(organizationSourceFindingExternalsystemName: string) { + return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match(organizationSourceFindingExternalsystemName).organization; + } + + /** + * Parse the source from OrganizationSourceFindingExternalsystem resource. + * + * @param {string} organizationSourceFindingExternalsystemName + * A fully-qualified path representing organization_source_finding_externalsystem resource. + * @returns {string} A string representing the source. + */ + matchSourceFromOrganizationSourceFindingExternalsystemName(organizationSourceFindingExternalsystemName: string) { + return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match(organizationSourceFindingExternalsystemName).source; + } + + /** + * Parse the finding from OrganizationSourceFindingExternalsystem resource. + * + * @param {string} organizationSourceFindingExternalsystemName + * A fully-qualified path representing organization_source_finding_externalsystem resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromOrganizationSourceFindingExternalsystemName(organizationSourceFindingExternalsystemName: string) { + return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match(organizationSourceFindingExternalsystemName).finding; + } + + /** + * Parse the externalsystem from OrganizationSourceFindingExternalsystem resource. + * + * @param {string} organizationSourceFindingExternalsystemName + * A fully-qualified path representing organization_source_finding_externalsystem resource. + * @returns {string} A string representing the externalsystem. + */ + matchExternalsystemFromOrganizationSourceFindingExternalsystemName(organizationSourceFindingExternalsystemName: string) { + return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match(organizationSourceFindingExternalsystemName).externalsystem; + } + + /** + * Return a fully-qualified organizationSourceFindingSecurityMarks resource name string. + * + * @param {string} organization + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + organizationSourceFindingSecurityMarksPath(organization:string,source:string,finding:string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render({ + organization: organization, + source: source, + finding: finding, + }); + } + + /** + * Parse the organization from OrganizationSourceFindingSecurityMarks resource. + * + * @param {string} organizationSourceFindingSecurityMarksName + * A fully-qualified path representing organization_source_finding_securityMarks resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).organization; + } + + /** + * Parse the source from OrganizationSourceFindingSecurityMarks resource. + * + * @param {string} organizationSourceFindingSecurityMarksName + * A fully-qualified path representing organization_source_finding_securityMarks resource. + * @returns {string} A string representing the source. + */ + matchSourceFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).source; + } + + /** + * Parse the finding from OrganizationSourceFindingSecurityMarks resource. + * + * @param {string} organizationSourceFindingSecurityMarksName + * A fully-qualified path representing organization_source_finding_securityMarks resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).finding; + } + + /** + * Return a fully-qualified projectAsset resource name string. + * + * @param {string} project + * @param {string} asset + * @returns {string} Resource name string. + */ + projectAssetPath(project:string,asset:string) { + return this.pathTemplates.projectAssetPathTemplate.render({ + project: project, + asset: asset, + }); + } + + /** + * Parse the project from ProjectAsset resource. + * + * @param {string} projectAssetName + * A fully-qualified path representing project_asset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAssetName(projectAssetName: string) { + return this.pathTemplates.projectAssetPathTemplate.match(projectAssetName).project; + } + + /** + * Parse the asset from ProjectAsset resource. + * + * @param {string} projectAssetName + * A fully-qualified path representing project_asset resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromProjectAssetName(projectAssetName: string) { + return this.pathTemplates.projectAssetPathTemplate.match(projectAssetName).asset; + } + + /** + * Return a fully-qualified projectAssetSecurityMarks resource name string. + * + * @param {string} project + * @param {string} asset + * @returns {string} Resource name string. + */ + projectAssetSecurityMarksPath(project:string,asset:string) { + return this.pathTemplates.projectAssetSecurityMarksPathTemplate.render({ + project: project, + asset: asset, + }); + } + + /** + * Parse the project from ProjectAssetSecurityMarks resource. + * + * @param {string} projectAssetSecurityMarksName + * A fully-qualified path representing project_asset_securityMarks resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAssetSecurityMarksName(projectAssetSecurityMarksName: string) { + return this.pathTemplates.projectAssetSecurityMarksPathTemplate.match(projectAssetSecurityMarksName).project; + } + + /** + * Parse the asset from ProjectAssetSecurityMarks resource. + * + * @param {string} projectAssetSecurityMarksName + * A fully-qualified path representing project_asset_securityMarks resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromProjectAssetSecurityMarksName(projectAssetSecurityMarksName: string) { + return this.pathTemplates.projectAssetSecurityMarksPathTemplate.match(projectAssetSecurityMarksName).asset; + } + + /** + * Return a fully-qualified projectExport resource name string. + * + * @param {string} project + * @param {string} exportParam + * @returns {string} Resource name string. + */ + projectExportPath(project:string,exportParam:string) { + return this.pathTemplates.projectExportPathTemplate.render({ + project: project, + export: exportParam, + }); + } + + /** + * Parse the project from ProjectExport resource. + * + * @param {string} projectExportName + * A fully-qualified path representing project_export resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectExportName(projectExportName: string) { + return this.pathTemplates.projectExportPathTemplate.match(projectExportName).project; + } + + /** + * Parse the export from ProjectExport resource. + * + * @param {string} projectExportName + * A fully-qualified path representing project_export resource. + * @returns {string} A string representing the export. + */ + matchExportFromProjectExportName(projectExportName: string) { + return this.pathTemplates.projectExportPathTemplate.match(projectExportName).export; + } + + /** + * Return a fully-qualified projectMuteConfig resource name string. + * + * @param {string} project + * @param {string} mute_config + * @returns {string} Resource name string. + */ + projectMuteConfigPath(project:string,muteConfig:string) { + return this.pathTemplates.projectMuteConfigPathTemplate.render({ + project: project, + mute_config: muteConfig, + }); + } + + /** + * Parse the project from ProjectMuteConfig resource. + * + * @param {string} projectMuteConfigName + * A fully-qualified path representing project_mute_config resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectMuteConfigName(projectMuteConfigName: string) { + return this.pathTemplates.projectMuteConfigPathTemplate.match(projectMuteConfigName).project; + } + + /** + * Parse the mute_config from ProjectMuteConfig resource. + * + * @param {string} projectMuteConfigName + * A fully-qualified path representing project_mute_config resource. + * @returns {string} A string representing the mute_config. + */ + matchMuteConfigFromProjectMuteConfigName(projectMuteConfigName: string) { + return this.pathTemplates.projectMuteConfigPathTemplate.match(projectMuteConfigName).mute_config; + } + + /** + * Return a fully-qualified projectNotificationConfig resource name string. + * + * @param {string} project + * @param {string} notification_config + * @returns {string} Resource name string. + */ + projectNotificationConfigPath(project:string,notificationConfig:string) { + return this.pathTemplates.projectNotificationConfigPathTemplate.render({ + project: project, + notification_config: notificationConfig, + }); + } + + /** + * Parse the project from ProjectNotificationConfig resource. + * + * @param {string} projectNotificationConfigName + * A fully-qualified path representing project_notification_config resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectNotificationConfigName(projectNotificationConfigName: string) { + return this.pathTemplates.projectNotificationConfigPathTemplate.match(projectNotificationConfigName).project; + } + + /** + * Parse the notification_config from ProjectNotificationConfig resource. + * + * @param {string} projectNotificationConfigName + * A fully-qualified path representing project_notification_config resource. + * @returns {string} A string representing the notification_config. + */ + matchNotificationConfigFromProjectNotificationConfigName(projectNotificationConfigName: string) { + return this.pathTemplates.projectNotificationConfigPathTemplate.match(projectNotificationConfigName).notification_config; + } + + /** + * Return a fully-qualified projectSecurityHealthAnalyticsSettingsCustomModule resource name string. + * + * @param {string} project + * @param {string} custom_module + * @returns {string} Resource name string. + */ + projectSecurityHealthAnalyticsSettingsCustomModulePath(project:string,customModule:string) { + return this.pathTemplates.projectSecurityHealthAnalyticsSettingsCustomModulePathTemplate.render({ + project: project, + custom_module: customModule, + }); + } + + /** + * Parse the project from ProjectSecurityHealthAnalyticsSettingsCustomModule resource. + * + * @param {string} projectSecurityHealthAnalyticsSettingsCustomModuleName + * A fully-qualified path representing project_securityHealthAnalyticsSettings_custom_module resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSecurityHealthAnalyticsSettingsCustomModuleName(projectSecurityHealthAnalyticsSettingsCustomModuleName: string) { + return this.pathTemplates.projectSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match(projectSecurityHealthAnalyticsSettingsCustomModuleName).project; + } + + /** + * Parse the custom_module from ProjectSecurityHealthAnalyticsSettingsCustomModule resource. + * + * @param {string} projectSecurityHealthAnalyticsSettingsCustomModuleName + * A fully-qualified path representing project_securityHealthAnalyticsSettings_custom_module resource. + * @returns {string} A string representing the custom_module. + */ + matchCustomModuleFromProjectSecurityHealthAnalyticsSettingsCustomModuleName(projectSecurityHealthAnalyticsSettingsCustomModuleName: string) { + return this.pathTemplates.projectSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match(projectSecurityHealthAnalyticsSettingsCustomModuleName).custom_module; + } + + /** + * Return a fully-qualified projectSecurityHealthAnalyticsSettingsEffectiveCustomModule resource name string. + * + * @param {string} project + * @param {string} effective_custom_module + * @returns {string} Resource name string. + */ + projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePath(project:string,effectiveCustomModule:string) { + return this.pathTemplates.projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.render({ + project: project, + effective_custom_module: effectiveCustomModule, + }); + } + + /** + * Parse the project from ProjectSecurityHealthAnalyticsSettingsEffectiveCustomModule resource. + * + * @param {string} projectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName + * A fully-qualified path representing project_securityHealthAnalyticsSettings_effective_custom_module resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(projectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName: string) { + return this.pathTemplates.projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match(projectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName).project; + } + + /** + * Parse the effective_custom_module from ProjectSecurityHealthAnalyticsSettingsEffectiveCustomModule resource. + * + * @param {string} projectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName + * A fully-qualified path representing project_securityHealthAnalyticsSettings_effective_custom_module resource. + * @returns {string} A string representing the effective_custom_module. + */ + matchEffectiveCustomModuleFromProjectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(projectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName: string) { + return this.pathTemplates.projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match(projectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName).effective_custom_module; + } + + /** + * Return a fully-qualified projectSource resource name string. + * + * @param {string} project + * @param {string} source + * @returns {string} Resource name string. + */ + projectSourcePath(project:string,source:string) { + return this.pathTemplates.projectSourcePathTemplate.render({ + project: project, + source: source, + }); + } + + /** + * Parse the project from ProjectSource resource. + * + * @param {string} projectSourceName + * A fully-qualified path representing project_source resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSourceName(projectSourceName: string) { + return this.pathTemplates.projectSourcePathTemplate.match(projectSourceName).project; + } + + /** + * Parse the source from ProjectSource resource. + * + * @param {string} projectSourceName + * A fully-qualified path representing project_source resource. + * @returns {string} A string representing the source. + */ + matchSourceFromProjectSourceName(projectSourceName: string) { + return this.pathTemplates.projectSourcePathTemplate.match(projectSourceName).source; + } + + /** + * Return a fully-qualified projectSourceFinding resource name string. + * + * @param {string} project + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + projectSourceFindingPath(project:string,source:string,finding:string) { + return this.pathTemplates.projectSourceFindingPathTemplate.render({ + project: project, + source: source, + finding: finding, + }); + } + + /** + * Parse the project from ProjectSourceFinding resource. + * + * @param {string} projectSourceFindingName + * A fully-qualified path representing project_source_finding resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSourceFindingName(projectSourceFindingName: string) { + return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).project; + } + + /** + * Parse the source from ProjectSourceFinding resource. + * + * @param {string} projectSourceFindingName + * A fully-qualified path representing project_source_finding resource. + * @returns {string} A string representing the source. + */ + matchSourceFromProjectSourceFindingName(projectSourceFindingName: string) { + return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).source; + } + + /** + * Parse the finding from ProjectSourceFinding resource. + * + * @param {string} projectSourceFindingName + * A fully-qualified path representing project_source_finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromProjectSourceFindingName(projectSourceFindingName: string) { + return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).finding; + } + + /** + * Return a fully-qualified projectSourceFindingExternalsystem resource name string. + * + * @param {string} project + * @param {string} source + * @param {string} finding + * @param {string} externalsystem + * @returns {string} Resource name string. + */ + projectSourceFindingExternalsystemPath(project:string,source:string,finding:string,externalsystem:string) { + return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.render({ + project: project, + source: source, + finding: finding, + externalsystem: externalsystem, + }); + } + + /** + * Parse the project from ProjectSourceFindingExternalsystem resource. + * + * @param {string} projectSourceFindingExternalsystemName + * A fully-qualified path representing project_source_finding_externalsystem resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSourceFindingExternalsystemName(projectSourceFindingExternalsystemName: string) { + return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match(projectSourceFindingExternalsystemName).project; + } + + /** + * Parse the source from ProjectSourceFindingExternalsystem resource. + * + * @param {string} projectSourceFindingExternalsystemName + * A fully-qualified path representing project_source_finding_externalsystem resource. + * @returns {string} A string representing the source. + */ + matchSourceFromProjectSourceFindingExternalsystemName(projectSourceFindingExternalsystemName: string) { + return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match(projectSourceFindingExternalsystemName).source; + } + + /** + * Parse the finding from ProjectSourceFindingExternalsystem resource. + * + * @param {string} projectSourceFindingExternalsystemName + * A fully-qualified path representing project_source_finding_externalsystem resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromProjectSourceFindingExternalsystemName(projectSourceFindingExternalsystemName: string) { + return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match(projectSourceFindingExternalsystemName).finding; + } + + /** + * Parse the externalsystem from ProjectSourceFindingExternalsystem resource. + * + * @param {string} projectSourceFindingExternalsystemName + * A fully-qualified path representing project_source_finding_externalsystem resource. + * @returns {string} A string representing the externalsystem. + */ + matchExternalsystemFromProjectSourceFindingExternalsystemName(projectSourceFindingExternalsystemName: string) { + return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match(projectSourceFindingExternalsystemName).externalsystem; + } + + /** + * Return a fully-qualified projectSourceFindingSecurityMarks resource name string. + * + * @param {string} project + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + projectSourceFindingSecurityMarksPath(project:string,source:string,finding:string) { + return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render({ + project: project, + source: source, + finding: finding, + }); + } + + /** + * Parse the project from ProjectSourceFindingSecurityMarks resource. + * + * @param {string} projectSourceFindingSecurityMarksName + * A fully-qualified path representing project_source_finding_securityMarks resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { + return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).project; + } + + /** + * Parse the source from ProjectSourceFindingSecurityMarks resource. + * + * @param {string} projectSourceFindingSecurityMarksName + * A fully-qualified path representing project_source_finding_securityMarks resource. + * @returns {string} A string representing the source. + */ + matchSourceFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { + return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).source; + } + + /** + * Parse the finding from ProjectSourceFindingSecurityMarks resource. + * + * @param {string} projectSourceFindingSecurityMarksName + * A fully-qualified path representing project_source_finding_securityMarks resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { + return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).finding; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.securityCenterStub && !this._terminated) { + return this.securityCenterStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_client_config.json b/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_client_config.json new file mode 100644 index 00000000000..e87538464a8 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_client_config.json @@ -0,0 +1,233 @@ +{ + "interfaces": { + "google.cloud.securitycenter.v1.SecurityCenter": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "BulkMuteFindings": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateSecurityHealthAnalyticsCustomModule": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateSource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFinding": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateMuteConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateNotificationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteMuteConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteNotificationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteSecurityHealthAnalyticsCustomModule": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetBigQueryExport": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetMuteConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetNotificationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetOrganizationSettings": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetEffectiveSecurityHealthAnalyticsCustomModule": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetSecurityHealthAnalyticsCustomModule": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetSource": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GroupAssets": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GroupFindings": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListAssets": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListDescendantSecurityHealthAnalyticsCustomModules": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindings": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListMuteConfigs": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListNotificationConfigs": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListEffectiveSecurityHealthAnalyticsCustomModules": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListSecurityHealthAnalyticsCustomModules": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListSources": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RunAssetDiscovery": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetFindingState": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetMute": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateExternalSystem": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateFinding": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateMuteConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateNotificationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateOrganizationSettings": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSecurityHealthAnalyticsCustomModule": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSecurityMarks": { + "timeout_millis": 480000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateBigQueryExport": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBigQueryExport": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateBigQueryExport": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListBigQueryExports": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_proto_list.json b/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_proto_list.json new file mode 100644 index 00000000000..445bd4476f4 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_proto_list.json @@ -0,0 +1,37 @@ +[ + "../../protos/google/cloud/securitycenter/v1/access.proto", + "../../protos/google/cloud/securitycenter/v1/asset.proto", + "../../protos/google/cloud/securitycenter/v1/bigquery_export.proto", + "../../protos/google/cloud/securitycenter/v1/cloud_dlp_data_profile.proto", + "../../protos/google/cloud/securitycenter/v1/cloud_dlp_inspection.proto", + "../../protos/google/cloud/securitycenter/v1/compliance.proto", + "../../protos/google/cloud/securitycenter/v1/connection.proto", + "../../protos/google/cloud/securitycenter/v1/contact_details.proto", + "../../protos/google/cloud/securitycenter/v1/container.proto", + "../../protos/google/cloud/securitycenter/v1/database.proto", + "../../protos/google/cloud/securitycenter/v1/effective_security_health_analytics_custom_module.proto", + "../../protos/google/cloud/securitycenter/v1/exfiltration.proto", + "../../protos/google/cloud/securitycenter/v1/external_system.proto", + "../../protos/google/cloud/securitycenter/v1/file.proto", + "../../protos/google/cloud/securitycenter/v1/finding.proto", + "../../protos/google/cloud/securitycenter/v1/folder.proto", + "../../protos/google/cloud/securitycenter/v1/iam_binding.proto", + "../../protos/google/cloud/securitycenter/v1/indicator.proto", + "../../protos/google/cloud/securitycenter/v1/kernel_rootkit.proto", + "../../protos/google/cloud/securitycenter/v1/kubernetes.proto", + "../../protos/google/cloud/securitycenter/v1/label.proto", + "../../protos/google/cloud/securitycenter/v1/mitre_attack.proto", + "../../protos/google/cloud/securitycenter/v1/mute_config.proto", + "../../protos/google/cloud/securitycenter/v1/notification_config.proto", + "../../protos/google/cloud/securitycenter/v1/notification_message.proto", + "../../protos/google/cloud/securitycenter/v1/organization_settings.proto", + "../../protos/google/cloud/securitycenter/v1/process.proto", + "../../protos/google/cloud/securitycenter/v1/resource.proto", + "../../protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto", + "../../protos/google/cloud/securitycenter/v1/security_health_analytics_custom_config.proto", + "../../protos/google/cloud/securitycenter/v1/security_health_analytics_custom_module.proto", + "../../protos/google/cloud/securitycenter/v1/security_marks.proto", + "../../protos/google/cloud/securitycenter/v1/securitycenter_service.proto", + "../../protos/google/cloud/securitycenter/v1/source.proto", + "../../protos/google/cloud/securitycenter/v1/vulnerability.proto" +] diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-securitycenter/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..ca4c3d3425f --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const securitycenter = require('@google-cloud/security-center'); + +function main() { + const securityCenterClient = new securitycenter.SecurityCenterClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-securitycenter/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..323502f7e2f --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {SecurityCenterClient} from '@google-cloud/security-center'; + +// check that the client class type name can be used +function doStuffWithSecurityCenterClient(client: SecurityCenterClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const securityCenterClient = new SecurityCenterClient(); + doStuffWithSecurityCenterClient(securityCenterClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/system-test/install.ts b/owl-bot-staging/google-cloud-securitycenter/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/test/gapic_security_center_v1.ts b/owl-bot-staging/google-cloud-securitycenter/v1/test/gapic_security_center_v1.ts new file mode 100644 index 00000000000..75ca6ea3649 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/test/gapic_security_center_v1.ts @@ -0,0 +1,8298 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as securitycenterModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.SecurityCenterClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = securitycenterModule.v1.SecurityCenterClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = securitycenterModule.v1.SecurityCenterClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = securitycenterModule.v1.SecurityCenterClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new securitycenterModule.v1.SecurityCenterClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.securityCenterStub, undefined); + await client.initialize(); + assert(client.securityCenterStub); + }); + + it('has close method for the initialized client', done => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.securityCenterStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.securityCenterStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('createSecurityHealthAnalyticsCustomModule', () => { + it('invokes createSecurityHealthAnalyticsCustomModule without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateSecurityHealthAnalyticsCustomModuleRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateSecurityHealthAnalyticsCustomModuleRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule() + ); + client.innerApiCalls.createSecurityHealthAnalyticsCustomModule = stubSimpleCall(expectedResponse); + const [response] = await client.createSecurityHealthAnalyticsCustomModule(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSecurityHealthAnalyticsCustomModule without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateSecurityHealthAnalyticsCustomModuleRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateSecurityHealthAnalyticsCustomModuleRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule() + ); + client.innerApiCalls.createSecurityHealthAnalyticsCustomModule = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSecurityHealthAnalyticsCustomModule( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSecurityHealthAnalyticsCustomModule with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateSecurityHealthAnalyticsCustomModuleRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateSecurityHealthAnalyticsCustomModuleRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSecurityHealthAnalyticsCustomModule = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSecurityHealthAnalyticsCustomModule(request), expectedError); + const actualRequest = (client.innerApiCalls.createSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSecurityHealthAnalyticsCustomModule with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateSecurityHealthAnalyticsCustomModuleRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateSecurityHealthAnalyticsCustomModuleRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSecurityHealthAnalyticsCustomModule(request), expectedError); + }); + }); + + describe('createSource', () => { + it('invokes createSource without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateSourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.Source() + ); + client.innerApiCalls.createSource = stubSimpleCall(expectedResponse); + const [response] = await client.createSource(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSource without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateSourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.Source() + ); + client.innerApiCalls.createSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSource( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSource with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateSourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSource(request), expectedError); + const actualRequest = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSource with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateSourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSource(request), expectedError); + }); + }); + + describe('createFinding', () => { + it('invokes createFinding without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateFindingRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.Finding() + ); + client.innerApiCalls.createFinding = stubSimpleCall(expectedResponse); + const [response] = await client.createFinding(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFinding without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateFindingRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.Finding() + ); + client.innerApiCalls.createFinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFinding( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFinding with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateFindingRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createFinding(request), expectedError); + const actualRequest = (client.innerApiCalls.createFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFinding with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateFindingRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createFinding(request), expectedError); + }); + }); + + describe('createMuteConfig', () => { + it('invokes createMuteConfig without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateMuteConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateMuteConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.MuteConfig() + ); + client.innerApiCalls.createMuteConfig = stubSimpleCall(expectedResponse); + const [response] = await client.createMuteConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMuteConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMuteConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMuteConfig without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateMuteConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateMuteConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.MuteConfig() + ); + client.innerApiCalls.createMuteConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMuteConfig( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IMuteConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMuteConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMuteConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMuteConfig with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateMuteConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateMuteConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMuteConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createMuteConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.createMuteConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMuteConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMuteConfig with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateMuteConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateMuteConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createMuteConfig(request), expectedError); + }); + }); + + describe('createNotificationConfig', () => { + it('invokes createNotificationConfig without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateNotificationConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.NotificationConfig() + ); + client.innerApiCalls.createNotificationConfig = stubSimpleCall(expectedResponse); + const [response] = await client.createNotificationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNotificationConfig without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateNotificationConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.NotificationConfig() + ); + client.innerApiCalls.createNotificationConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNotificationConfig( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.INotificationConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNotificationConfig with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateNotificationConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNotificationConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createNotificationConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.createNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNotificationConfig with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateNotificationConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createNotificationConfig(request), expectedError); + }); + }); + + describe('deleteMuteConfig', () => { + it('invokes deleteMuteConfig without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.DeleteMuteConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteMuteConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteMuteConfig = stubSimpleCall(expectedResponse); + const [response] = await client.deleteMuteConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteMuteConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteMuteConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteMuteConfig without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.DeleteMuteConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteMuteConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteMuteConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteMuteConfig( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteMuteConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteMuteConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteMuteConfig with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.DeleteMuteConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteMuteConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMuteConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteMuteConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteMuteConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteMuteConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteMuteConfig with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.DeleteMuteConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteMuteConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteMuteConfig(request), expectedError); + }); + }); + + describe('deleteNotificationConfig', () => { + it('invokes deleteNotificationConfig without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteNotificationConfig = stubSimpleCall(expectedResponse); + const [response] = await client.deleteNotificationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNotificationConfig without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteNotificationConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteNotificationConfig( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNotificationConfig with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNotificationConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteNotificationConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNotificationConfig with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteNotificationConfig(request), expectedError); + }); + }); + + describe('deleteSecurityHealthAnalyticsCustomModule', () => { + it('invokes deleteSecurityHealthAnalyticsCustomModule without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.DeleteSecurityHealthAnalyticsCustomModuleRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteSecurityHealthAnalyticsCustomModuleRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule = stubSimpleCall(expectedResponse); + const [response] = await client.deleteSecurityHealthAnalyticsCustomModule(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSecurityHealthAnalyticsCustomModule without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.DeleteSecurityHealthAnalyticsCustomModuleRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteSecurityHealthAnalyticsCustomModuleRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSecurityHealthAnalyticsCustomModule( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSecurityHealthAnalyticsCustomModule with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.DeleteSecurityHealthAnalyticsCustomModuleRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteSecurityHealthAnalyticsCustomModuleRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteSecurityHealthAnalyticsCustomModule(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSecurityHealthAnalyticsCustomModule with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.DeleteSecurityHealthAnalyticsCustomModuleRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteSecurityHealthAnalyticsCustomModuleRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteSecurityHealthAnalyticsCustomModule(request), expectedError); + }); + }); + + describe('getBigQueryExport', () => { + it('invokes getBigQueryExport without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetBigQueryExportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetBigQueryExportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.BigQueryExport() + ); + client.innerApiCalls.getBigQueryExport = stubSimpleCall(expectedResponse); + const [response] = await client.getBigQueryExport(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBigQueryExport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBigQueryExport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBigQueryExport without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetBigQueryExportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetBigQueryExportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.BigQueryExport() + ); + client.innerApiCalls.getBigQueryExport = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBigQueryExport( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IBigQueryExport|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBigQueryExport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBigQueryExport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBigQueryExport with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetBigQueryExportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetBigQueryExportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBigQueryExport = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBigQueryExport(request), expectedError); + const actualRequest = (client.innerApiCalls.getBigQueryExport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBigQueryExport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBigQueryExport with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetBigQueryExportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetBigQueryExportRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBigQueryExport(request), expectedError); + }); + }); + + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIamPolicy without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIamPolicy with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIamPolicy with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIamPolicy(request), expectedError); + }); + }); + + describe('getMuteConfig', () => { + it('invokes getMuteConfig without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetMuteConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetMuteConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.MuteConfig() + ); + client.innerApiCalls.getMuteConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getMuteConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMuteConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMuteConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMuteConfig without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetMuteConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetMuteConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.MuteConfig() + ); + client.innerApiCalls.getMuteConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMuteConfig( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IMuteConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMuteConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMuteConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMuteConfig with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetMuteConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetMuteConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMuteConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getMuteConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.getMuteConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMuteConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMuteConfig with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetMuteConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetMuteConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getMuteConfig(request), expectedError); + }); + }); + + describe('getNotificationConfig', () => { + it('invokes getNotificationConfig without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetNotificationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.NotificationConfig() + ); + client.innerApiCalls.getNotificationConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getNotificationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNotificationConfig without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetNotificationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.NotificationConfig() + ); + client.innerApiCalls.getNotificationConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNotificationConfig( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.INotificationConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNotificationConfig with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetNotificationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNotificationConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getNotificationConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.getNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNotificationConfig with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetNotificationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getNotificationConfig(request), expectedError); + }); + }); + + describe('getOrganizationSettings', () => { + it('invokes getOrganizationSettings without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.OrganizationSettings() + ); + client.innerApiCalls.getOrganizationSettings = stubSimpleCall(expectedResponse); + const [response] = await client.getOrganizationSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOrganizationSettings without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.OrganizationSettings() + ); + client.innerApiCalls.getOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getOrganizationSettings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IOrganizationSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOrganizationSettings with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getOrganizationSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getOrganizationSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOrganizationSettings with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getOrganizationSettings(request), expectedError); + }); + }); + + describe('getEffectiveSecurityHealthAnalyticsCustomModule', () => { + it('invokes getEffectiveSecurityHealthAnalyticsCustomModule without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule() + ); + client.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule = stubSimpleCall(expectedResponse); + const [response] = await client.getEffectiveSecurityHealthAnalyticsCustomModule(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEffectiveSecurityHealthAnalyticsCustomModule without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule() + ); + client.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEffectiveSecurityHealthAnalyticsCustomModule( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEffectiveSecurityHealthAnalyticsCustomModule with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEffectiveSecurityHealthAnalyticsCustomModule(request), expectedError); + const actualRequest = (client.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEffectiveSecurityHealthAnalyticsCustomModule with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getEffectiveSecurityHealthAnalyticsCustomModule(request), expectedError); + }); + }); + + describe('getSecurityHealthAnalyticsCustomModule', () => { + it('invokes getSecurityHealthAnalyticsCustomModule without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetSecurityHealthAnalyticsCustomModuleRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetSecurityHealthAnalyticsCustomModuleRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule() + ); + client.innerApiCalls.getSecurityHealthAnalyticsCustomModule = stubSimpleCall(expectedResponse); + const [response] = await client.getSecurityHealthAnalyticsCustomModule(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSecurityHealthAnalyticsCustomModule without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetSecurityHealthAnalyticsCustomModuleRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetSecurityHealthAnalyticsCustomModuleRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule() + ); + client.innerApiCalls.getSecurityHealthAnalyticsCustomModule = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSecurityHealthAnalyticsCustomModule( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSecurityHealthAnalyticsCustomModule with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetSecurityHealthAnalyticsCustomModuleRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetSecurityHealthAnalyticsCustomModuleRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSecurityHealthAnalyticsCustomModule = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSecurityHealthAnalyticsCustomModule(request), expectedError); + const actualRequest = (client.innerApiCalls.getSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSecurityHealthAnalyticsCustomModule with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetSecurityHealthAnalyticsCustomModuleRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetSecurityHealthAnalyticsCustomModuleRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSecurityHealthAnalyticsCustomModule(request), expectedError); + }); + }); + + describe('getSource', () => { + it('invokes getSource without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetSourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.Source() + ); + client.innerApiCalls.getSource = stubSimpleCall(expectedResponse); + const [response] = await client.getSource(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSource without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetSourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.Source() + ); + client.innerApiCalls.getSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSource( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSource with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetSourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSource(request), expectedError); + const actualRequest = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSource with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GetSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GetSourceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSource(request), expectedError); + }); + }); + + describe('setFindingState', () => { + it('invokes setFindingState without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.SetFindingStateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.SetFindingStateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.Finding() + ); + client.innerApiCalls.setFindingState = stubSimpleCall(expectedResponse); + const [response] = await client.setFindingState(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setFindingState without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.SetFindingStateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.SetFindingStateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.Finding() + ); + client.innerApiCalls.setFindingState = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setFindingState( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setFindingState with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.SetFindingStateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.SetFindingStateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setFindingState = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setFindingState(request), expectedError); + const actualRequest = (client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setFindingState with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.SetFindingStateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.SetFindingStateRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setFindingState(request), expectedError); + }); + }); + + describe('setMute', () => { + it('invokes setMute without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.SetMuteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.SetMuteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.Finding() + ); + client.innerApiCalls.setMute = stubSimpleCall(expectedResponse); + const [response] = await client.setMute(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setMute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMute without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.SetMuteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.SetMuteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.Finding() + ); + client.innerApiCalls.setMute = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setMute( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setMute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMute with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.SetMuteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.SetMuteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setMute = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setMute(request), expectedError); + const actualRequest = (client.innerApiCalls.setMute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setMute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setMute with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.SetMuteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.SetMuteRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setMute(request), expectedError); + }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setIamPolicy without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setIamPolicy with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setIamPolicy with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setIamPolicy(request), expectedError); + }); + }); + + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsResponse() + ); + client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes testIamPermissions without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsResponse() + ); + client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes testIamPermissions with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request), expectedError); + const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes testIamPermissions with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.testIamPermissions(request), expectedError); + }); + }); + + describe('updateExternalSystem', () => { + it('invokes updateExternalSystem without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateExternalSystemRequest() + ); + request.externalSystem ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateExternalSystemRequest', ['externalSystem', 'name']); + request.externalSystem.name = defaultValue1; + const expectedHeaderRequestParams = `external_system.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ExternalSystem() + ); + client.innerApiCalls.updateExternalSystem = stubSimpleCall(expectedResponse); + const [response] = await client.updateExternalSystem(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateExternalSystem as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateExternalSystem as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateExternalSystem without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateExternalSystemRequest() + ); + request.externalSystem ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateExternalSystemRequest', ['externalSystem', 'name']); + request.externalSystem.name = defaultValue1; + const expectedHeaderRequestParams = `external_system.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ExternalSystem() + ); + client.innerApiCalls.updateExternalSystem = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateExternalSystem( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IExternalSystem|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateExternalSystem as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateExternalSystem as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateExternalSystem with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateExternalSystemRequest() + ); + request.externalSystem ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateExternalSystemRequest', ['externalSystem', 'name']); + request.externalSystem.name = defaultValue1; + const expectedHeaderRequestParams = `external_system.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateExternalSystem = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateExternalSystem(request), expectedError); + const actualRequest = (client.innerApiCalls.updateExternalSystem as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateExternalSystem as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateExternalSystem with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateExternalSystemRequest() + ); + request.externalSystem ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateExternalSystemRequest', ['externalSystem', 'name']); + request.externalSystem.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateExternalSystem(request), expectedError); + }); + }); + + describe('updateFinding', () => { + it('invokes updateFinding without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateFindingRequest() + ); + request.finding ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateFindingRequest', ['finding', 'name']); + request.finding.name = defaultValue1; + const expectedHeaderRequestParams = `finding.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.Finding() + ); + client.innerApiCalls.updateFinding = stubSimpleCall(expectedResponse); + const [response] = await client.updateFinding(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFinding without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateFindingRequest() + ); + request.finding ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateFindingRequest', ['finding', 'name']); + request.finding.name = defaultValue1; + const expectedHeaderRequestParams = `finding.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.Finding() + ); + client.innerApiCalls.updateFinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFinding( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFinding with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateFindingRequest() + ); + request.finding ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateFindingRequest', ['finding', 'name']); + request.finding.name = defaultValue1; + const expectedHeaderRequestParams = `finding.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateFinding(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFinding with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateFindingRequest() + ); + request.finding ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateFindingRequest', ['finding', 'name']); + request.finding.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateFinding(request), expectedError); + }); + }); + + describe('updateMuteConfig', () => { + it('invokes updateMuteConfig without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateMuteConfigRequest() + ); + request.muteConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateMuteConfigRequest', ['muteConfig', 'name']); + request.muteConfig.name = defaultValue1; + const expectedHeaderRequestParams = `mute_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.MuteConfig() + ); + client.innerApiCalls.updateMuteConfig = stubSimpleCall(expectedResponse); + const [response] = await client.updateMuteConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMuteConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMuteConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMuteConfig without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateMuteConfigRequest() + ); + request.muteConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateMuteConfigRequest', ['muteConfig', 'name']); + request.muteConfig.name = defaultValue1; + const expectedHeaderRequestParams = `mute_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.MuteConfig() + ); + client.innerApiCalls.updateMuteConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMuteConfig( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IMuteConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMuteConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMuteConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMuteConfig with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateMuteConfigRequest() + ); + request.muteConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateMuteConfigRequest', ['muteConfig', 'name']); + request.muteConfig.name = defaultValue1; + const expectedHeaderRequestParams = `mute_config.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMuteConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateMuteConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.updateMuteConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMuteConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMuteConfig with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateMuteConfigRequest() + ); + request.muteConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateMuteConfigRequest', ['muteConfig', 'name']); + request.muteConfig.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateMuteConfig(request), expectedError); + }); + }); + + describe('updateNotificationConfig', () => { + it('invokes updateNotificationConfig without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest() + ); + request.notificationConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest', ['notificationConfig', 'name']); + request.notificationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `notification_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.NotificationConfig() + ); + client.innerApiCalls.updateNotificationConfig = stubSimpleCall(expectedResponse); + const [response] = await client.updateNotificationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNotificationConfig without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest() + ); + request.notificationConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest', ['notificationConfig', 'name']); + request.notificationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `notification_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.NotificationConfig() + ); + client.innerApiCalls.updateNotificationConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateNotificationConfig( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.INotificationConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNotificationConfig with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest() + ); + request.notificationConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest', ['notificationConfig', 'name']); + request.notificationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `notification_config.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNotificationConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateNotificationConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.updateNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNotificationConfig with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest() + ); + request.notificationConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest', ['notificationConfig', 'name']); + request.notificationConfig.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateNotificationConfig(request), expectedError); + }); + }); + + describe('updateOrganizationSettings', () => { + it('invokes updateOrganizationSettings without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest() + ); + request.organizationSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); + request.organizationSettings.name = defaultValue1; + const expectedHeaderRequestParams = `organization_settings.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.OrganizationSettings() + ); + client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(expectedResponse); + const [response] = await client.updateOrganizationSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateOrganizationSettings without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest() + ); + request.organizationSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); + request.organizationSettings.name = defaultValue1; + const expectedHeaderRequestParams = `organization_settings.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.OrganizationSettings() + ); + client.innerApiCalls.updateOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateOrganizationSettings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IOrganizationSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateOrganizationSettings with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest() + ); + request.organizationSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); + request.organizationSettings.name = defaultValue1; + const expectedHeaderRequestParams = `organization_settings.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateOrganizationSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateOrganizationSettings with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest() + ); + request.organizationSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); + request.organizationSettings.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateOrganizationSettings(request), expectedError); + }); + }); + + describe('updateSecurityHealthAnalyticsCustomModule', () => { + it('invokes updateSecurityHealthAnalyticsCustomModule without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateSecurityHealthAnalyticsCustomModuleRequest() + ); + request.securityHealthAnalyticsCustomModule ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSecurityHealthAnalyticsCustomModuleRequest', ['securityHealthAnalyticsCustomModule', 'name']); + request.securityHealthAnalyticsCustomModule.name = defaultValue1; + const expectedHeaderRequestParams = `security_health_analytics_custom_module.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule() + ); + client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule = stubSimpleCall(expectedResponse); + const [response] = await client.updateSecurityHealthAnalyticsCustomModule(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSecurityHealthAnalyticsCustomModule without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateSecurityHealthAnalyticsCustomModuleRequest() + ); + request.securityHealthAnalyticsCustomModule ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSecurityHealthAnalyticsCustomModuleRequest', ['securityHealthAnalyticsCustomModule', 'name']); + request.securityHealthAnalyticsCustomModule.name = defaultValue1; + const expectedHeaderRequestParams = `security_health_analytics_custom_module.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule() + ); + client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSecurityHealthAnalyticsCustomModule( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSecurityHealthAnalyticsCustomModule with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateSecurityHealthAnalyticsCustomModuleRequest() + ); + request.securityHealthAnalyticsCustomModule ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSecurityHealthAnalyticsCustomModuleRequest', ['securityHealthAnalyticsCustomModule', 'name']); + request.securityHealthAnalyticsCustomModule.name = defaultValue1; + const expectedHeaderRequestParams = `security_health_analytics_custom_module.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSecurityHealthAnalyticsCustomModule(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSecurityHealthAnalyticsCustomModule with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateSecurityHealthAnalyticsCustomModuleRequest() + ); + request.securityHealthAnalyticsCustomModule ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSecurityHealthAnalyticsCustomModuleRequest', ['securityHealthAnalyticsCustomModule', 'name']); + request.securityHealthAnalyticsCustomModule.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSecurityHealthAnalyticsCustomModule(request), expectedError); + }); + }); + + describe('updateSource', () => { + it('invokes updateSource without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateSourceRequest() + ); + request.source ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSourceRequest', ['source', 'name']); + request.source.name = defaultValue1; + const expectedHeaderRequestParams = `source.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.Source() + ); + client.innerApiCalls.updateSource = stubSimpleCall(expectedResponse); + const [response] = await client.updateSource(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSource without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateSourceRequest() + ); + request.source ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSourceRequest', ['source', 'name']); + request.source.name = defaultValue1; + const expectedHeaderRequestParams = `source.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.Source() + ); + client.innerApiCalls.updateSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSource( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSource with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateSourceRequest() + ); + request.source ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSourceRequest', ['source', 'name']); + request.source.name = defaultValue1; + const expectedHeaderRequestParams = `source.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSource(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSource with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateSourceRequest() + ); + request.source ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSourceRequest', ['source', 'name']); + request.source.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSource(request), expectedError); + }); + }); + + describe('updateSecurityMarks', () => { + it('invokes updateSecurityMarks without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest() + ); + request.securityMarks ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); + request.securityMarks.name = defaultValue1; + const expectedHeaderRequestParams = `security_marks.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.SecurityMarks() + ); + client.innerApiCalls.updateSecurityMarks = stubSimpleCall(expectedResponse); + const [response] = await client.updateSecurityMarks(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSecurityMarks without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest() + ); + request.securityMarks ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); + request.securityMarks.name = defaultValue1; + const expectedHeaderRequestParams = `security_marks.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.SecurityMarks() + ); + client.innerApiCalls.updateSecurityMarks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSecurityMarks( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISecurityMarks|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSecurityMarks with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest() + ); + request.securityMarks ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); + request.securityMarks.name = defaultValue1; + const expectedHeaderRequestParams = `security_marks.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityMarks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSecurityMarks(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSecurityMarks with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest() + ); + request.securityMarks ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); + request.securityMarks.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSecurityMarks(request), expectedError); + }); + }); + + describe('createBigQueryExport', () => { + it('invokes createBigQueryExport without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateBigQueryExportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateBigQueryExportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.BigQueryExport() + ); + client.innerApiCalls.createBigQueryExport = stubSimpleCall(expectedResponse); + const [response] = await client.createBigQueryExport(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBigQueryExport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBigQueryExport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBigQueryExport without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateBigQueryExportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateBigQueryExportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.BigQueryExport() + ); + client.innerApiCalls.createBigQueryExport = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBigQueryExport( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IBigQueryExport|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBigQueryExport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBigQueryExport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBigQueryExport with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateBigQueryExportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateBigQueryExportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBigQueryExport = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createBigQueryExport(request), expectedError); + const actualRequest = (client.innerApiCalls.createBigQueryExport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBigQueryExport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBigQueryExport with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.CreateBigQueryExportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateBigQueryExportRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createBigQueryExport(request), expectedError); + }); + }); + + describe('deleteBigQueryExport', () => { + it('invokes deleteBigQueryExport without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.DeleteBigQueryExportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteBigQueryExportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteBigQueryExport = stubSimpleCall(expectedResponse); + const [response] = await client.deleteBigQueryExport(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBigQueryExport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBigQueryExport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBigQueryExport without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.DeleteBigQueryExportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteBigQueryExportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteBigQueryExport = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBigQueryExport( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBigQueryExport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBigQueryExport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBigQueryExport with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.DeleteBigQueryExportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteBigQueryExportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBigQueryExport = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteBigQueryExport(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteBigQueryExport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBigQueryExport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBigQueryExport with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.DeleteBigQueryExportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteBigQueryExportRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteBigQueryExport(request), expectedError); + }); + }); + + describe('updateBigQueryExport', () => { + it('invokes updateBigQueryExport without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest() + ); + request.bigQueryExport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest', ['bigQueryExport', 'name']); + request.bigQueryExport.name = defaultValue1; + const expectedHeaderRequestParams = `big_query_export.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.BigQueryExport() + ); + client.innerApiCalls.updateBigQueryExport = stubSimpleCall(expectedResponse); + const [response] = await client.updateBigQueryExport(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateBigQueryExport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBigQueryExport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBigQueryExport without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest() + ); + request.bigQueryExport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest', ['bigQueryExport', 'name']); + request.bigQueryExport.name = defaultValue1; + const expectedHeaderRequestParams = `big_query_export.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.BigQueryExport() + ); + client.innerApiCalls.updateBigQueryExport = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBigQueryExport( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IBigQueryExport|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateBigQueryExport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBigQueryExport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBigQueryExport with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest() + ); + request.bigQueryExport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest', ['bigQueryExport', 'name']); + request.bigQueryExport.name = defaultValue1; + const expectedHeaderRequestParams = `big_query_export.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBigQueryExport = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateBigQueryExport(request), expectedError); + const actualRequest = (client.innerApiCalls.updateBigQueryExport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBigQueryExport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBigQueryExport with closed client', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest() + ); + request.bigQueryExport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest', ['bigQueryExport', 'name']); + request.bigQueryExport.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateBigQueryExport(request), expectedError); + }); + }); + + describe('bulkMuteFindings', () => { + it('invokes bulkMuteFindings without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.BulkMuteFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.BulkMuteFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.bulkMuteFindings = stubLongRunningCall(expectedResponse); + const [operation] = await client.bulkMuteFindings(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.bulkMuteFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.bulkMuteFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes bulkMuteFindings without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.BulkMuteFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.BulkMuteFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.bulkMuteFindings = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.bulkMuteFindings( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.bulkMuteFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.bulkMuteFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes bulkMuteFindings with call error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.BulkMuteFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.BulkMuteFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.bulkMuteFindings = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.bulkMuteFindings(request), expectedError); + const actualRequest = (client.innerApiCalls.bulkMuteFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.bulkMuteFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes bulkMuteFindings with LRO error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.BulkMuteFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.BulkMuteFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.bulkMuteFindings = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.bulkMuteFindings(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.bulkMuteFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.bulkMuteFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBulkMuteFindingsProgress without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBulkMuteFindingsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBulkMuteFindingsProgress with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBulkMuteFindingsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('runAssetDiscovery', () => { + it('invokes runAssetDiscovery without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(expectedResponse); + const [operation] = await client.runAssetDiscovery(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runAssetDiscovery without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.runAssetDiscovery( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runAssetDiscovery with call error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.runAssetDiscovery(request), expectedError); + const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runAssetDiscovery with LRO error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.runAssetDiscovery(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRunAssetDiscoveryProgress without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRunAssetDiscoveryProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRunAssetDiscoveryProgress with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRunAssetDiscoveryProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('groupAssets', () => { + it('invokes groupAssets without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + ]; + client.innerApiCalls.groupAssets = stubSimpleCall(expectedResponse); + const [response] = await client.groupAssets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes groupAssets without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + ]; + client.innerApiCalls.groupAssets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.groupAssets( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IGroupResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes groupAssets with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.groupAssets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.groupAssets(request), expectedError); + const actualRequest = (client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes groupAssetsStream without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + ]; + client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.groupAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.GroupResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); + assert( + (client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes groupAssetsStream with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.groupAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.GroupResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); + assert( + (client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with groupAssets without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + ]; + client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.IGroupResult[] = []; + const iterable = client.groupAssetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with groupAssets with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.groupAssetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1.IGroupResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('groupFindings', () => { + it('invokes groupFindings without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + ]; + client.innerApiCalls.groupFindings = stubSimpleCall(expectedResponse); + const [response] = await client.groupFindings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes groupFindings without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + ]; + client.innerApiCalls.groupFindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.groupFindings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IGroupResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes groupFindings with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.groupFindings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.groupFindings(request), expectedError); + const actualRequest = (client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes groupFindingsStream without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + ]; + client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.groupFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.GroupResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); + assert( + (client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes groupFindingsStream with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.groupFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.GroupResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); + assert( + (client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with groupFindings without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + ]; + client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.IGroupResult[] = []; + const iterable = client.groupFindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with groupFindings with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.groupFindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1.IGroupResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listAssets', () => { + it('invokes listAssets without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + ]; + client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); + const [response] = await client.listAssets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssets without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + ]; + client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAssets( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssets with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAssets(request), expectedError); + const actualRequest = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssetsStream without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + ]; + client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); + assert( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAssetsStream with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); + assert( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAssets without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + ]; + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[] = []; + const iterable = client.listAssetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAssets with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAssetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listDescendantSecurityHealthAnalyticsCustomModules', () => { + it('invokes listDescendantSecurityHealthAnalyticsCustomModules without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + ]; + client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules = stubSimpleCall(expectedResponse); + const [response] = await client.listDescendantSecurityHealthAnalyticsCustomModules(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDescendantSecurityHealthAnalyticsCustomModules without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + ]; + client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDescendantSecurityHealthAnalyticsCustomModules( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDescendantSecurityHealthAnalyticsCustomModules with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDescendantSecurityHealthAnalyticsCustomModules(request), expectedError); + const actualRequest = (client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDescendantSecurityHealthAnalyticsCustomModulesStream without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + ]; + client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listDescendantSecurityHealthAnalyticsCustomModulesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules, request)); + assert( + (client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listDescendantSecurityHealthAnalyticsCustomModulesStream with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listDescendantSecurityHealthAnalyticsCustomModulesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules, request)); + assert( + (client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDescendantSecurityHealthAnalyticsCustomModules without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + ]; + client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[] = []; + const iterable = client.listDescendantSecurityHealthAnalyticsCustomModulesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDescendantSecurityHealthAnalyticsCustomModules with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDescendantSecurityHealthAnalyticsCustomModulesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listFindings', () => { + it('invokes listFindings without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + ]; + client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); + const [response] = await client.listFindings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindings without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + ]; + client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindings with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFindings(request), expectedError); + const actualRequest = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingsStream without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + ]; + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFindingsStream with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFindings without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + ]; + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult[] = []; + const iterable = client.listFindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFindings with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listMuteConfigs', () => { + it('invokes listMuteConfigs without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListMuteConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListMuteConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + ]; + client.innerApiCalls.listMuteConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listMuteConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMuteConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMuteConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMuteConfigs without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListMuteConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListMuteConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + ]; + client.innerApiCalls.listMuteConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMuteConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IMuteConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMuteConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMuteConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMuteConfigs with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListMuteConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListMuteConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMuteConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMuteConfigs(request), expectedError); + const actualRequest = (client.innerApiCalls.listMuteConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMuteConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMuteConfigsStream without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListMuteConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListMuteConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + ]; + client.descriptors.page.listMuteConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMuteConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.MuteConfig[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.MuteConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listMuteConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMuteConfigs, request)); + assert( + (client.descriptors.page.listMuteConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listMuteConfigsStream with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListMuteConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListMuteConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMuteConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMuteConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.MuteConfig[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.MuteConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMuteConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMuteConfigs, request)); + assert( + (client.descriptors.page.listMuteConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMuteConfigs without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListMuteConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListMuteConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + ]; + client.descriptors.page.listMuteConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.IMuteConfig[] = []; + const iterable = client.listMuteConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMuteConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMuteConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMuteConfigs with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListMuteConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListMuteConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMuteConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMuteConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1.IMuteConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMuteConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMuteConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listNotificationConfigs', () => { + it('invokes listNotificationConfigs without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListNotificationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + ]; + client.innerApiCalls.listNotificationConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listNotificationConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNotificationConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNotificationConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNotificationConfigs without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListNotificationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + ]; + client.innerApiCalls.listNotificationConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNotificationConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.INotificationConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNotificationConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNotificationConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNotificationConfigs with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListNotificationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNotificationConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNotificationConfigs(request), expectedError); + const actualRequest = (client.innerApiCalls.listNotificationConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNotificationConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNotificationConfigsStream without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListNotificationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + ]; + client.descriptors.page.listNotificationConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listNotificationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.NotificationConfig[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.NotificationConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listNotificationConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNotificationConfigs, request)); + assert( + (client.descriptors.page.listNotificationConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listNotificationConfigsStream with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListNotificationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNotificationConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listNotificationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.NotificationConfig[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.NotificationConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listNotificationConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNotificationConfigs, request)); + assert( + (client.descriptors.page.listNotificationConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNotificationConfigs without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListNotificationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + ]; + client.descriptors.page.listNotificationConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.INotificationConfig[] = []; + const iterable = client.listNotificationConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNotificationConfigs with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListNotificationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNotificationConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNotificationConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1.INotificationConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listEffectiveSecurityHealthAnalyticsCustomModules', () => { + it('invokes listEffectiveSecurityHealthAnalyticsCustomModules without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), + ]; + client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules = stubSimpleCall(expectedResponse); + const [response] = await client.listEffectiveSecurityHealthAnalyticsCustomModules(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEffectiveSecurityHealthAnalyticsCustomModules without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), + ]; + client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEffectiveSecurityHealthAnalyticsCustomModules( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEffectiveSecurityHealthAnalyticsCustomModules with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listEffectiveSecurityHealthAnalyticsCustomModules(request), expectedError); + const actualRequest = (client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEffectiveSecurityHealthAnalyticsCustomModulesStream without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), + ]; + client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listEffectiveSecurityHealthAnalyticsCustomModulesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules, request)); + assert( + (client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listEffectiveSecurityHealthAnalyticsCustomModulesStream with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listEffectiveSecurityHealthAnalyticsCustomModulesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules, request)); + assert( + (client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listEffectiveSecurityHealthAnalyticsCustomModules without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), + ]; + client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule[] = []; + const iterable = client.listEffectiveSecurityHealthAnalyticsCustomModulesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listEffectiveSecurityHealthAnalyticsCustomModules with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listEffectiveSecurityHealthAnalyticsCustomModulesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listSecurityHealthAnalyticsCustomModules', () => { + it('invokes listSecurityHealthAnalyticsCustomModules without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + ]; + client.innerApiCalls.listSecurityHealthAnalyticsCustomModules = stubSimpleCall(expectedResponse); + const [response] = await client.listSecurityHealthAnalyticsCustomModules(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSecurityHealthAnalyticsCustomModules as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSecurityHealthAnalyticsCustomModules as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSecurityHealthAnalyticsCustomModules without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + ]; + client.innerApiCalls.listSecurityHealthAnalyticsCustomModules = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSecurityHealthAnalyticsCustomModules( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSecurityHealthAnalyticsCustomModules as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSecurityHealthAnalyticsCustomModules as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSecurityHealthAnalyticsCustomModules with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSecurityHealthAnalyticsCustomModules = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSecurityHealthAnalyticsCustomModules(request), expectedError); + const actualRequest = (client.innerApiCalls.listSecurityHealthAnalyticsCustomModules as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSecurityHealthAnalyticsCustomModules as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSecurityHealthAnalyticsCustomModulesStream without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + ]; + client.descriptors.page.listSecurityHealthAnalyticsCustomModules.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSecurityHealthAnalyticsCustomModulesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listSecurityHealthAnalyticsCustomModules.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSecurityHealthAnalyticsCustomModules, request)); + assert( + (client.descriptors.page.listSecurityHealthAnalyticsCustomModules.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listSecurityHealthAnalyticsCustomModulesStream with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSecurityHealthAnalyticsCustomModules.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSecurityHealthAnalyticsCustomModulesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSecurityHealthAnalyticsCustomModules.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSecurityHealthAnalyticsCustomModules, request)); + assert( + (client.descriptors.page.listSecurityHealthAnalyticsCustomModules.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSecurityHealthAnalyticsCustomModules without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), + ]; + client.descriptors.page.listSecurityHealthAnalyticsCustomModules.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[] = []; + const iterable = client.listSecurityHealthAnalyticsCustomModulesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSecurityHealthAnalyticsCustomModules with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSecurityHealthAnalyticsCustomModules.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSecurityHealthAnalyticsCustomModulesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listSources', () => { + it('invokes listSources without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + ]; + client.innerApiCalls.listSources = stubSimpleCall(expectedResponse); + const [response] = await client.listSources(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSources without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + ]; + client.innerApiCalls.listSources = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSources( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISource[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSources with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSources = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSources(request), expectedError); + const actualRequest = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSourcesStream without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + ]; + client.descriptors.page.listSources.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.Source[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.Source) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSources, request)); + assert( + (client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listSourcesStream with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSources.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.Source[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.Source) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSources, request)); + assert( + (client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSources without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + ]; + client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.ISource[] = []; + const iterable = client.listSourcesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSources with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSourcesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1.ISource[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listBigQueryExports', () => { + it('invokes listBigQueryExports without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListBigQueryExportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListBigQueryExportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + ]; + client.innerApiCalls.listBigQueryExports = stubSimpleCall(expectedResponse); + const [response] = await client.listBigQueryExports(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBigQueryExports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBigQueryExports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBigQueryExports without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListBigQueryExportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListBigQueryExportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + ]; + client.innerApiCalls.listBigQueryExports = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBigQueryExports( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IBigQueryExport[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBigQueryExports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBigQueryExports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBigQueryExports with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListBigQueryExportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListBigQueryExportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBigQueryExports = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBigQueryExports(request), expectedError); + const actualRequest = (client.innerApiCalls.listBigQueryExports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBigQueryExports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBigQueryExportsStream without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListBigQueryExportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListBigQueryExportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + ]; + client.descriptors.page.listBigQueryExports.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBigQueryExportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.BigQueryExport[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.BigQueryExport) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listBigQueryExports.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBigQueryExports, request)); + assert( + (client.descriptors.page.listBigQueryExports.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listBigQueryExportsStream with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListBigQueryExportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListBigQueryExportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBigQueryExports.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBigQueryExportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.BigQueryExport[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.BigQueryExport) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBigQueryExports.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBigQueryExports, request)); + assert( + (client.descriptors.page.listBigQueryExports.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBigQueryExports without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListBigQueryExportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListBigQueryExportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + ]; + client.descriptors.page.listBigQueryExports.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.IBigQueryExport[] = []; + const iterable = client.listBigQueryExportsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBigQueryExports.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBigQueryExports.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBigQueryExports with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1.ListBigQueryExportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1.ListBigQueryExportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBigQueryExports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBigQueryExportsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1.IBigQueryExport[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBigQueryExports.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBigQueryExports.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('folderAsset', () => { + const fakePath = "/rendered/path/folderAsset"; + const expectedParameters = { + folder: "folderValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAssetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderAssetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderAssetPath', () => { + const result = client.folderAssetPath("folderValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderAssetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderAssetName', () => { + const result = client.matchFolderFromFolderAssetName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromFolderAssetName', () => { + const result = client.matchAssetFromFolderAssetName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.folderAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderAssetSecurityMarks', () => { + const fakePath = "/rendered/path/folderAssetSecurityMarks"; + const expectedParameters = { + folder: "folderValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAssetSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderAssetSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderAssetSecurityMarksPath', () => { + const result = client.folderAssetSecurityMarksPath("folderValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderAssetSecurityMarksName', () => { + const result = client.matchFolderFromFolderAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromFolderAssetSecurityMarksName', () => { + const result = client.matchAssetFromFolderAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderExport', () => { + const fakePath = "/rendered/path/folderExport"; + const expectedParameters = { + folder: "folderValue", + export: "exportValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderExportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderExportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderExportPath', () => { + const result = client.folderExportPath("folderValue", "exportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderExportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderExportName', () => { + const result = client.matchFolderFromFolderExportName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderExportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExportFromFolderExportName', () => { + const result = client.matchExportFromFolderExportName(fakePath); + assert.strictEqual(result, "exportValue"); + assert((client.pathTemplates.folderExportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderMuteConfig', () => { + const fakePath = "/rendered/path/folderMuteConfig"; + const expectedParameters = { + folder: "folderValue", + mute_config: "muteConfigValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderMuteConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderMuteConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderMuteConfigPath', () => { + const result = client.folderMuteConfigPath("folderValue", "muteConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderMuteConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderMuteConfigName', () => { + const result = client.matchFolderFromFolderMuteConfigName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderMuteConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMuteConfigFromFolderMuteConfigName', () => { + const result = client.matchMuteConfigFromFolderMuteConfigName(fakePath); + assert.strictEqual(result, "muteConfigValue"); + assert((client.pathTemplates.folderMuteConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderNotificationConfig', () => { + const fakePath = "/rendered/path/folderNotificationConfig"; + const expectedParameters = { + folder: "folderValue", + notification_config: "notificationConfigValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderNotificationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderNotificationConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderNotificationConfigPath', () => { + const result = client.folderNotificationConfigPath("folderValue", "notificationConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderNotificationConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderNotificationConfigName', () => { + const result = client.matchFolderFromFolderNotificationConfigName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderNotificationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNotificationConfigFromFolderNotificationConfigName', () => { + const result = client.matchNotificationConfigFromFolderNotificationConfigName(fakePath); + assert.strictEqual(result, "notificationConfigValue"); + assert((client.pathTemplates.folderNotificationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSecurityHealthAnalyticsSettingsCustomModule', () => { + const fakePath = "/rendered/path/folderSecurityHealthAnalyticsSettingsCustomModule"; + const expectedParameters = { + folder: "folderValue", + custom_module: "customModuleValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSecurityHealthAnalyticsSettingsCustomModulePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSecurityHealthAnalyticsSettingsCustomModulePath', () => { + const result = client.folderSecurityHealthAnalyticsSettingsCustomModulePath("folderValue", "customModuleValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSecurityHealthAnalyticsSettingsCustomModulePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSecurityHealthAnalyticsSettingsCustomModuleName', () => { + const result = client.matchFolderFromFolderSecurityHealthAnalyticsSettingsCustomModuleName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCustomModuleFromFolderSecurityHealthAnalyticsSettingsCustomModuleName', () => { + const result = client.matchCustomModuleFromFolderSecurityHealthAnalyticsSettingsCustomModuleName(fakePath); + assert.strictEqual(result, "customModuleValue"); + assert((client.pathTemplates.folderSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSecurityHealthAnalyticsSettingsEffectiveCustomModule', () => { + const fakePath = "/rendered/path/folderSecurityHealthAnalyticsSettingsEffectiveCustomModule"; + const expectedParameters = { + folder: "folderValue", + effective_custom_module: "effectiveCustomModuleValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePath', () => { + const result = client.folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePath("folderValue", "effectiveCustomModuleValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName', () => { + const result = client.matchFolderFromFolderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEffectiveCustomModuleFromFolderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName', () => { + const result = client.matchEffectiveCustomModuleFromFolderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(fakePath); + assert.strictEqual(result, "effectiveCustomModuleValue"); + assert((client.pathTemplates.folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSource', () => { + const fakePath = "/rendered/path/folderSource"; + const expectedParameters = { + folder: "folderValue", + source: "sourceValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSourcePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSourcePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSourcePath', () => { + const result = client.folderSourcePath("folderValue", "sourceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSourcePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSourceName', () => { + const result = client.matchFolderFromFolderSourceName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromFolderSourceName', () => { + const result = client.matchSourceFromFolderSourceName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.folderSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSourceFinding', () => { + const fakePath = "/rendered/path/folderSourceFinding"; + const expectedParameters = { + folder: "folderValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSourceFindingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSourceFindingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSourceFindingPath', () => { + const result = client.folderSourceFindingPath("folderValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSourceFindingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSourceFindingName', () => { + const result = client.matchFolderFromFolderSourceFindingName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromFolderSourceFindingName', () => { + const result = client.matchSourceFromFolderSourceFindingName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromFolderSourceFindingName', () => { + const result = client.matchFindingFromFolderSourceFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSourceFindingExternalsystem', () => { + const fakePath = "/rendered/path/folderSourceFindingExternalsystem"; + const expectedParameters = { + folder: "folderValue", + source: "sourceValue", + finding: "findingValue", + externalsystem: "externalsystemValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSourceFindingExternalsystemPath', () => { + const result = client.folderSourceFindingExternalsystemPath("folderValue", "sourceValue", "findingValue", "externalsystemValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSourceFindingExternalsystemName', () => { + const result = client.matchFolderFromFolderSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromFolderSourceFindingExternalsystemName', () => { + const result = client.matchSourceFromFolderSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromFolderSourceFindingExternalsystemName', () => { + const result = client.matchFindingFromFolderSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExternalsystemFromFolderSourceFindingExternalsystemName', () => { + const result = client.matchExternalsystemFromFolderSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "externalsystemValue"); + assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSourceFindingSecurityMarks', () => { + const fakePath = "/rendered/path/folderSourceFindingSecurityMarks"; + const expectedParameters = { + folder: "folderValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSourceFindingSecurityMarksPath', () => { + const result = client.folderSourceFindingSecurityMarksPath("folderValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSourceFindingSecurityMarksName', () => { + const result = client.matchFolderFromFolderSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromFolderSourceFindingSecurityMarksName', () => { + const result = client.matchSourceFromFolderSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromFolderSourceFindingSecurityMarksName', () => { + const result = client.matchFindingFromFolderSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organization', () => { + const fakePath = "/rendered/path/organization"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationPath', () => { + const result = client.organizationPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationName', () => { + const result = client.matchOrganizationFromOrganizationName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationAsset', () => { + const fakePath = "/rendered/path/organizationAsset"; + const expectedParameters = { + organization: "organizationValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAssetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAssetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAssetPath', () => { + const result = client.organizationAssetPath("organizationValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationAssetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationAssetName', () => { + const result = client.matchOrganizationFromOrganizationAssetName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromOrganizationAssetName', () => { + const result = client.matchAssetFromOrganizationAssetName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.organizationAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationAssetSecurityMarks', () => { + const fakePath = "/rendered/path/organizationAssetSecurityMarks"; + const expectedParameters = { + organization: "organizationValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAssetSecurityMarksPath', () => { + const result = client.organizationAssetSecurityMarksPath("organizationValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationAssetSecurityMarksName', () => { + const result = client.matchOrganizationFromOrganizationAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromOrganizationAssetSecurityMarksName', () => { + const result = client.matchAssetFromOrganizationAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationExport', () => { + const fakePath = "/rendered/path/organizationExport"; + const expectedParameters = { + organization: "organizationValue", + export: "exportValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationExportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationExportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationExportPath', () => { + const result = client.organizationExportPath("organizationValue", "exportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationExportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationExportName', () => { + const result = client.matchOrganizationFromOrganizationExportName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationExportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExportFromOrganizationExportName', () => { + const result = client.matchExportFromOrganizationExportName(fakePath); + assert.strictEqual(result, "exportValue"); + assert((client.pathTemplates.organizationExportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationMuteConfig', () => { + const fakePath = "/rendered/path/organizationMuteConfig"; + const expectedParameters = { + organization: "organizationValue", + mute_config: "muteConfigValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationMuteConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationMuteConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationMuteConfigPath', () => { + const result = client.organizationMuteConfigPath("organizationValue", "muteConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationMuteConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationMuteConfigName', () => { + const result = client.matchOrganizationFromOrganizationMuteConfigName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationMuteConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMuteConfigFromOrganizationMuteConfigName', () => { + const result = client.matchMuteConfigFromOrganizationMuteConfigName(fakePath); + assert.strictEqual(result, "muteConfigValue"); + assert((client.pathTemplates.organizationMuteConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationNotificationConfig', () => { + const fakePath = "/rendered/path/organizationNotificationConfig"; + const expectedParameters = { + organization: "organizationValue", + notification_config: "notificationConfigValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationNotificationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationNotificationConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationNotificationConfigPath', () => { + const result = client.organizationNotificationConfigPath("organizationValue", "notificationConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationNotificationConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationNotificationConfigName', () => { + const result = client.matchOrganizationFromOrganizationNotificationConfigName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationNotificationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNotificationConfigFromOrganizationNotificationConfigName', () => { + const result = client.matchNotificationConfigFromOrganizationNotificationConfigName(fakePath); + assert.strictEqual(result, "notificationConfigValue"); + assert((client.pathTemplates.organizationNotificationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSecurityHealthAnalyticsSettings', () => { + const fakePath = "/rendered/path/organizationSecurityHealthAnalyticsSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSecurityHealthAnalyticsSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSecurityHealthAnalyticsSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSecurityHealthAnalyticsSettingsPath', () => { + const result = client.organizationSecurityHealthAnalyticsSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSecurityHealthAnalyticsSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSecurityHealthAnalyticsSettingsName', () => { + const result = client.matchOrganizationFromOrganizationSecurityHealthAnalyticsSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSecurityHealthAnalyticsSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSecurityHealthAnalyticsSettingsCustomModule', () => { + const fakePath = "/rendered/path/organizationSecurityHealthAnalyticsSettingsCustomModule"; + const expectedParameters = { + organization: "organizationValue", + custom_module: "customModuleValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSecurityHealthAnalyticsSettingsCustomModulePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSecurityHealthAnalyticsSettingsCustomModulePath', () => { + const result = client.organizationSecurityHealthAnalyticsSettingsCustomModulePath("organizationValue", "customModuleValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSecurityHealthAnalyticsSettingsCustomModulePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSecurityHealthAnalyticsSettingsCustomModuleName', () => { + const result = client.matchOrganizationFromOrganizationSecurityHealthAnalyticsSettingsCustomModuleName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCustomModuleFromOrganizationSecurityHealthAnalyticsSettingsCustomModuleName', () => { + const result = client.matchCustomModuleFromOrganizationSecurityHealthAnalyticsSettingsCustomModuleName(fakePath); + assert.strictEqual(result, "customModuleValue"); + assert((client.pathTemplates.organizationSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSecurityHealthAnalyticsSettingsEffectiveCustomModule', () => { + const fakePath = "/rendered/path/organizationSecurityHealthAnalyticsSettingsEffectiveCustomModule"; + const expectedParameters = { + organization: "organizationValue", + effective_custom_module: "effectiveCustomModuleValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePath', () => { + const result = client.organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePath("organizationValue", "effectiveCustomModuleValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName', () => { + const result = client.matchOrganizationFromOrganizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEffectiveCustomModuleFromOrganizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName', () => { + const result = client.matchEffectiveCustomModuleFromOrganizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(fakePath); + assert.strictEqual(result, "effectiveCustomModuleValue"); + assert((client.pathTemplates.organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSettings', () => { + const fakePath = "/rendered/path/organizationSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSettingsPath', () => { + const result = client.organizationSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSettingsName', () => { + const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSource', () => { + const fakePath = "/rendered/path/organizationSource"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSourcePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSourcePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSourcePath', () => { + const result = client.organizationSourcePath("organizationValue", "sourceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSourcePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSourceName', () => { + const result = client.matchOrganizationFromOrganizationSourceName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromOrganizationSourceName', () => { + const result = client.matchSourceFromOrganizationSourceName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.organizationSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSourceFinding', () => { + const fakePath = "/rendered/path/organizationSourceFinding"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSourceFindingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSourceFindingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSourceFindingPath', () => { + const result = client.organizationSourceFindingPath("organizationValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSourceFindingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSourceFindingName', () => { + const result = client.matchOrganizationFromOrganizationSourceFindingName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromOrganizationSourceFindingName', () => { + const result = client.matchSourceFromOrganizationSourceFindingName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromOrganizationSourceFindingName', () => { + const result = client.matchFindingFromOrganizationSourceFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSourceFindingExternalsystem', () => { + const fakePath = "/rendered/path/organizationSourceFindingExternalsystem"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + finding: "findingValue", + externalsystem: "externalsystemValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSourceFindingExternalsystemPath', () => { + const result = client.organizationSourceFindingExternalsystemPath("organizationValue", "sourceValue", "findingValue", "externalsystemValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSourceFindingExternalsystemName', () => { + const result = client.matchOrganizationFromOrganizationSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromOrganizationSourceFindingExternalsystemName', () => { + const result = client.matchSourceFromOrganizationSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromOrganizationSourceFindingExternalsystemName', () => { + const result = client.matchFindingFromOrganizationSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExternalsystemFromOrganizationSourceFindingExternalsystemName', () => { + const result = client.matchExternalsystemFromOrganizationSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "externalsystemValue"); + assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSourceFindingSecurityMarks', () => { + const fakePath = "/rendered/path/organizationSourceFindingSecurityMarks"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSourceFindingSecurityMarksPath', () => { + const result = client.organizationSourceFindingSecurityMarksPath("organizationValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSourceFindingSecurityMarksName', () => { + const result = client.matchOrganizationFromOrganizationSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromOrganizationSourceFindingSecurityMarksName', () => { + const result = client.matchSourceFromOrganizationSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromOrganizationSourceFindingSecurityMarksName', () => { + const result = client.matchFindingFromOrganizationSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAsset', () => { + const fakePath = "/rendered/path/projectAsset"; + const expectedParameters = { + project: "projectValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAssetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAssetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAssetPath', () => { + const result = client.projectAssetPath("projectValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAssetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAssetName', () => { + const result = client.matchProjectFromProjectAssetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromProjectAssetName', () => { + const result = client.matchAssetFromProjectAssetName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.projectAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAssetSecurityMarks', () => { + const fakePath = "/rendered/path/projectAssetSecurityMarks"; + const expectedParameters = { + project: "projectValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAssetSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAssetSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAssetSecurityMarksPath', () => { + const result = client.projectAssetSecurityMarksPath("projectValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAssetSecurityMarksName', () => { + const result = client.matchProjectFromProjectAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromProjectAssetSecurityMarksName', () => { + const result = client.matchAssetFromProjectAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectExport', () => { + const fakePath = "/rendered/path/projectExport"; + const expectedParameters = { + project: "projectValue", + export: "exportValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectExportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectExportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectExportPath', () => { + const result = client.projectExportPath("projectValue", "exportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectExportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectExportName', () => { + const result = client.matchProjectFromProjectExportName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectExportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExportFromProjectExportName', () => { + const result = client.matchExportFromProjectExportName(fakePath); + assert.strictEqual(result, "exportValue"); + assert((client.pathTemplates.projectExportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectMuteConfig', () => { + const fakePath = "/rendered/path/projectMuteConfig"; + const expectedParameters = { + project: "projectValue", + mute_config: "muteConfigValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectMuteConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectMuteConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectMuteConfigPath', () => { + const result = client.projectMuteConfigPath("projectValue", "muteConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectMuteConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectMuteConfigName', () => { + const result = client.matchProjectFromProjectMuteConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectMuteConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMuteConfigFromProjectMuteConfigName', () => { + const result = client.matchMuteConfigFromProjectMuteConfigName(fakePath); + assert.strictEqual(result, "muteConfigValue"); + assert((client.pathTemplates.projectMuteConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectNotificationConfig', () => { + const fakePath = "/rendered/path/projectNotificationConfig"; + const expectedParameters = { + project: "projectValue", + notification_config: "notificationConfigValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectNotificationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectNotificationConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectNotificationConfigPath', () => { + const result = client.projectNotificationConfigPath("projectValue", "notificationConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectNotificationConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectNotificationConfigName', () => { + const result = client.matchProjectFromProjectNotificationConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectNotificationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNotificationConfigFromProjectNotificationConfigName', () => { + const result = client.matchNotificationConfigFromProjectNotificationConfigName(fakePath); + assert.strictEqual(result, "notificationConfigValue"); + assert((client.pathTemplates.projectNotificationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSecurityHealthAnalyticsSettingsCustomModule', () => { + const fakePath = "/rendered/path/projectSecurityHealthAnalyticsSettingsCustomModule"; + const expectedParameters = { + project: "projectValue", + custom_module: "customModuleValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSecurityHealthAnalyticsSettingsCustomModulePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSecurityHealthAnalyticsSettingsCustomModulePath', () => { + const result = client.projectSecurityHealthAnalyticsSettingsCustomModulePath("projectValue", "customModuleValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSecurityHealthAnalyticsSettingsCustomModulePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSecurityHealthAnalyticsSettingsCustomModuleName', () => { + const result = client.matchProjectFromProjectSecurityHealthAnalyticsSettingsCustomModuleName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCustomModuleFromProjectSecurityHealthAnalyticsSettingsCustomModuleName', () => { + const result = client.matchCustomModuleFromProjectSecurityHealthAnalyticsSettingsCustomModuleName(fakePath); + assert.strictEqual(result, "customModuleValue"); + assert((client.pathTemplates.projectSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSecurityHealthAnalyticsSettingsEffectiveCustomModule', () => { + const fakePath = "/rendered/path/projectSecurityHealthAnalyticsSettingsEffectiveCustomModule"; + const expectedParameters = { + project: "projectValue", + effective_custom_module: "effectiveCustomModuleValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePath', () => { + const result = client.projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePath("projectValue", "effectiveCustomModuleValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName', () => { + const result = client.matchProjectFromProjectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEffectiveCustomModuleFromProjectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName', () => { + const result = client.matchEffectiveCustomModuleFromProjectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(fakePath); + assert.strictEqual(result, "effectiveCustomModuleValue"); + assert((client.pathTemplates.projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSource', () => { + const fakePath = "/rendered/path/projectSource"; + const expectedParameters = { + project: "projectValue", + source: "sourceValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSourcePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSourcePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSourcePath', () => { + const result = client.projectSourcePath("projectValue", "sourceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSourcePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSourceName', () => { + const result = client.matchProjectFromProjectSourceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromProjectSourceName', () => { + const result = client.matchSourceFromProjectSourceName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.projectSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSourceFinding', () => { + const fakePath = "/rendered/path/projectSourceFinding"; + const expectedParameters = { + project: "projectValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSourceFindingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSourceFindingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSourceFindingPath', () => { + const result = client.projectSourceFindingPath("projectValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSourceFindingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSourceFindingName', () => { + const result = client.matchProjectFromProjectSourceFindingName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromProjectSourceFindingName', () => { + const result = client.matchSourceFromProjectSourceFindingName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromProjectSourceFindingName', () => { + const result = client.matchFindingFromProjectSourceFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSourceFindingExternalsystem', () => { + const fakePath = "/rendered/path/projectSourceFindingExternalsystem"; + const expectedParameters = { + project: "projectValue", + source: "sourceValue", + finding: "findingValue", + externalsystem: "externalsystemValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSourceFindingExternalsystemPath', () => { + const result = client.projectSourceFindingExternalsystemPath("projectValue", "sourceValue", "findingValue", "externalsystemValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSourceFindingExternalsystemName', () => { + const result = client.matchProjectFromProjectSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromProjectSourceFindingExternalsystemName', () => { + const result = client.matchSourceFromProjectSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromProjectSourceFindingExternalsystemName', () => { + const result = client.matchFindingFromProjectSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExternalsystemFromProjectSourceFindingExternalsystemName', () => { + const result = client.matchExternalsystemFromProjectSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "externalsystemValue"); + assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSourceFindingSecurityMarks', () => { + const fakePath = "/rendered/path/projectSourceFindingSecurityMarks"; + const expectedParameters = { + project: "projectValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSourceFindingSecurityMarksPath', () => { + const result = client.projectSourceFindingSecurityMarksPath("projectValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSourceFindingSecurityMarksName', () => { + const result = client.matchProjectFromProjectSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromProjectSourceFindingSecurityMarksName', () => { + const result = client.matchSourceFromProjectSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromProjectSourceFindingSecurityMarksName', () => { + const result = client.matchFindingFromProjectSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/tsconfig.json b/owl-bot-staging/google-cloud-securitycenter/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/webpack.config.js b/owl-bot-staging/google-cloud-securitycenter/v1/webpack.config.js new file mode 100644 index 00000000000..4aeca8bf63a --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 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 +// +// https://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. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'SecurityCenter', + filename: './security-center.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/.eslintignore b/owl-bot-staging/google-cloud-securitycenter/v1beta1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-securitycenter/v1beta1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/.gitignore b/owl-bot-staging/google-cloud-securitycenter/v1beta1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +/.coverage +/coverage +/.nyc_output +/docs/ +/out/ +/build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/.jsdoc.js new file mode 100644 index 00000000000..4d5ad9781e7 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2023 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/security-center', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/.mocharc.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/README.md b/owl-bot-staging/google-cloud-securitycenter/v1beta1/README.md new file mode 100644 index 00000000000..73f34764a12 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/README.md @@ -0,0 +1 @@ +Securitycenter: Nodejs Client diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/linkinator.config.json b/owl-bot-staging/google-cloud-securitycenter/v1beta1/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/package.json b/owl-bot-staging/google-cloud-securitycenter/v1beta1/package.json new file mode 100644 index 00000000000..efcfeb4e7ad --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/security-center", + "version": "0.1.0", + "description": "Securitycenter client for Node.js", + "repository": "googleapis/nodejs-securitycenter", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google securitycenter", + "securitycenter", + "security center" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.5.7" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^4.0.0", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.1.2", + "mocha": "^10.2.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.0.1", + "ts-loader": "^8.4.0", + "typescript": "^4.8.4", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/asset.proto b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/asset.proto new file mode 100644 index 00000000000..89792501700 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/asset.proto @@ -0,0 +1,92 @@ +// Copyright 2020 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1beta1/security_marks.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/securitycenter/apiv1beta1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1beta1"; + +// Security Command Center representation of a Google Cloud +// resource. +// +// The Asset is a Security Command Center resource that captures information +// about a single Google Cloud resource. All modifications to an Asset are only +// within the context of Security Command Center and don't affect the referenced +// Google Cloud resource. +message Asset { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/Asset" + pattern: "organizations/{organization}/assets/{asset}" + }; + + // Security Command Center managed properties. These properties are managed by + // Security Command Center and cannot be modified by the user. + message SecurityCenterProperties { + // Immutable. The full resource name of the Google Cloud resource this asset + // represents. This field is immutable after create time. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // The type of the Google Cloud resource. Examples include: APPLICATION, + // PROJECT, and ORGANIZATION. This is a case insensitive field defined by + // Security Command Center and/or the producer of the resource and is + // immutable after create time. + string resource_type = 2; + + // The full resource name of the immediate parent of the resource. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_parent = 3; + + // The full resource name of the project the resource belongs to. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_project = 4; + + // Owners of the Google Cloud resource. + repeated string resource_owners = 5; + } + + // The relative resource name of this asset. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/assets/{asset_id}". + string name = 1; + + // Security Command Center managed properties. These properties are managed by + // Security Command Center and cannot be modified by the user. + SecurityCenterProperties security_center_properties = 2; + + // Resource managed properties. These properties are managed and defined by + // the Google Cloud resource and cannot be modified by the user. + map resource_properties = 7; + + // User specified security marks. These marks are entirely managed by the user + // and come from the SecurityMarks resource that belongs to the asset. + SecurityMarks security_marks = 8; + + // The time at which the asset was created in Security Command Center. + google.protobuf.Timestamp create_time = 9; + + // The time at which the asset was last updated, added, or deleted in Security + // Command Center. + google.protobuf.Timestamp update_time = 10; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/finding.proto b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/finding.proto new file mode 100644 index 00000000000..66609f3f27d --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/finding.proto @@ -0,0 +1,109 @@ +// Copyright 2020 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1beta1/security_marks.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/securitycenter/apiv1beta1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1beta1"; + +// Security Command Center finding. +// +// A finding is a record of assessment data (security, risk, health or privacy) +// ingested into Security Command Center for presentation, notification, +// analysis, policy testing, and enforcement. For example, an XSS vulnerability +// in an App Engine application is a finding. +message Finding { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/Finding" + pattern: "organizations/{organization}/sources/{source}/findings/{finding}" + }; + + // The state of the finding. + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // The finding requires attention and has not been addressed yet. + ACTIVE = 1; + + // The finding has been fixed, triaged as a non-issue or otherwise addressed + // and is no longer active. + INACTIVE = 2; + } + + // The relative resource name of this finding. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}" + string name = 1; + + // Immutable. The relative resource name of the source the finding belongs to. + // See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // This field is immutable after creation time. + // For example: + // "organizations/{organization_id}/sources/{source_id}" + string parent = 2 [(google.api.field_behavior) = IMMUTABLE]; + + // For findings on Google Cloud resources, the full resource + // name of the Google Cloud resource this finding is for. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + // When the finding is for a non-Google Cloud resource, the resourceName can + // be a customer or partner defined string. This field is immutable after + // creation time. + string resource_name = 3; + + // The state of the finding. + State state = 4; + + // The additional taxonomy group within findings from a given source. + // This field is immutable after creation time. + // Example: "XSS_FLASH_INJECTION" + string category = 5; + + // The URI that, if available, points to a web page outside of Security + // Command Center where additional information about the finding can be found. + // This field is guaranteed to be either empty or a well formed URL. + string external_uri = 6; + + // Source specific properties. These properties are managed by the source + // that writes the finding. The key names in the source_properties map must be + // between 1 and 255 characters, and must start with a letter and contain + // alphanumeric characters or underscores only. + map source_properties = 7; + + // Output only. User specified security marks. These marks are entirely + // managed by the user and come from the SecurityMarks resource that belongs + // to the finding. + SecurityMarks security_marks = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The time at which the event took place, or when an update to the finding + // occurred. For example, if the finding represents an open firewall it would + // capture the time the detector believes the firewall became open. The + // accuracy is determined by the detector. If the finding were to be resolved + // afterward, this time would reflect when the finding was resolved. + google.protobuf.Timestamp event_time = 9; + + // The time at which the finding was created in Security Command Center. + google.protobuf.Timestamp create_time = 10; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/organization_settings.proto b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/organization_settings.proto new file mode 100644 index 00000000000..3c9509ba962 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/organization_settings.proto @@ -0,0 +1,78 @@ +// Copyright 2020 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1beta1; + +import "google/api/resource.proto"; + +option go_package = "cloud.google.com/go/securitycenter/apiv1beta1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1beta1"; + +// User specified settings that are attached to the Security Command +// Center organization. +message OrganizationSettings { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/OrganizationSettings" + pattern: "organizations/{organization}/organizationSettings" + }; + + // The configuration used for Asset Discovery runs. + message AssetDiscoveryConfig { + // The mode of inclusion when running Asset Discovery. + // Asset discovery can be limited by explicitly identifying projects to be + // included or excluded. If INCLUDE_ONLY is set, then only those projects + // within the organization and their children are discovered during asset + // discovery. If EXCLUDE is set, then projects that don't match those + // projects are discovered during asset discovery. If neither are set, then + // all projects within the organization are discovered during asset + // discovery. + enum InclusionMode { + // Unspecified. Setting the mode with this value will disable + // inclusion/exclusion filtering for Asset Discovery. + INCLUSION_MODE_UNSPECIFIED = 0; + + // Asset Discovery will capture only the resources within the projects + // specified. All other resources will be ignored. + INCLUDE_ONLY = 1; + + // Asset Discovery will ignore all resources under the projects specified. + // All other resources will be retrieved. + EXCLUDE = 2; + } + + // The project ids to use for filtering asset discovery. + repeated string project_ids = 1; + + // The mode to use for filtering asset discovery. + InclusionMode inclusion_mode = 2; + } + + // The relative resource name of the settings. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/organizationSettings". + string name = 1; + + // A flag that indicates if Asset Discovery should be enabled. If the flag is + // set to `true`, then discovery of assets will occur. If it is set to `false, + // all historical assets will remain, but discovery of future assets will not + // occur. + bool enable_asset_discovery = 2; + + // The configuration used for Asset Discovery runs. + AssetDiscoveryConfig asset_discovery_config = 3; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto new file mode 100644 index 00000000000..dfda29a29aa --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto @@ -0,0 +1,48 @@ +// Copyright 2020 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1beta1; + +import "google/protobuf/duration.proto"; + +option go_package = "cloud.google.com/go/securitycenter/apiv1beta1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1beta1"; + +// Response of asset discovery run +message RunAssetDiscoveryResponse { + // The state of an asset discovery run. + enum State { + // Asset discovery run state was unspecified. + STATE_UNSPECIFIED = 0; + + // Asset discovery run completed successfully. + COMPLETED = 1; + + // Asset discovery run was cancelled with tasks still pending, as another + // run for the same organization was started with a higher priority. + SUPERSEDED = 2; + + // Asset discovery run was killed and terminated. + TERMINATED = 3; + } + + // The state of an asset discovery run. + State state = 1; + + // The duration between asset discovery run start and end + google.protobuf.Duration duration = 2; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/security_marks.proto b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/security_marks.proto new file mode 100644 index 00000000000..5bae35479a6 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/security_marks.proto @@ -0,0 +1,52 @@ +// Copyright 2020 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1beta1; + +import "google/api/resource.proto"; + +option go_package = "cloud.google.com/go/securitycenter/apiv1beta1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1beta1"; + +// User specified security marks that are attached to the parent Security +// Command Center resource. Security marks are scoped within a Security Command +// Center organization -- they can be modified and viewed by all users who have +// proper permissions on the organization. +message SecurityMarks { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/SecurityMarks" + pattern: "organizations/{organization}/assets/{asset}/securityMarks" + pattern: "organizations/{organization}/sources/{source}/findings/{finding}/securityMarks" + }; + + // The relative resource name of the SecurityMarks. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Examples: + // "organizations/{organization_id}/assets/{asset_id}/securityMarks" + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks". + string name = 1; + + // Mutable user specified security marks belonging to the parent resource. + // Constraints are as follows: + // + // * Keys and values are treated as case insensitive + // * Keys must be between 1 - 256 characters (inclusive) + // * Keys must be letters, numbers, underscores, or dashes + // * Values have leading and trailing whitespace trimmed, remaining + // characters must be between 1 - 4096 characters (inclusive) + map marks = 2; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto new file mode 100644 index 00000000000..e45ac6df448 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto @@ -0,0 +1,823 @@ +// Copyright 2020 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1beta1/asset.proto"; +import "google/cloud/securitycenter/v1beta1/finding.proto"; +import "google/cloud/securitycenter/v1beta1/organization_settings.proto"; +import "google/cloud/securitycenter/v1beta1/security_marks.proto"; +import "google/cloud/securitycenter/v1beta1/source.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/securitycenter/apiv1beta1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1beta1"; + +// V1 Beta APIs for Security Center service. +service SecurityCenter { + option (google.api.default_host) = "securitycenter.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a source. + rpc CreateSource(CreateSourceRequest) returns (Source) { + option (google.api.http) = { + post: "/v1beta1/{parent=organizations/*}/sources" + body: "source" + }; + option (google.api.method_signature) = "parent,source"; + } + + // Creates a finding. The corresponding source must exist for finding creation + // to succeed. + rpc CreateFinding(CreateFindingRequest) returns (Finding) { + option (google.api.http) = { + post: "/v1beta1/{parent=organizations/*/sources/*}/findings" + body: "finding" + }; + option (google.api.method_signature) = "parent,finding_id,finding"; + } + + // Gets the access control policy on the specified Source. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1beta1/{resource=organizations/*/sources/*}:getIamPolicy" + body: "*" + }; + option (google.api.method_signature) = "resource"; + } + + // Gets the settings for an organization. + rpc GetOrganizationSettings(GetOrganizationSettingsRequest) returns (OrganizationSettings) { + option (google.api.http) = { + get: "/v1beta1/{name=organizations/*/organizationSettings}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a source. + rpc GetSource(GetSourceRequest) returns (Source) { + option (google.api.http) = { + get: "/v1beta1/{name=organizations/*/sources/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Filters an organization's assets and groups them by their specified + // properties. + rpc GroupAssets(GroupAssetsRequest) returns (GroupAssetsResponse) { + option (google.api.http) = { + post: "/v1beta1/{parent=organizations/*}/assets:group" + body: "*" + }; + } + + // Filters an organization or source's findings and groups them by their + // specified properties. + // + // To group across all sources provide a `-` as the source id. + // Example: /v1beta1/organizations/{organization_id}/sources/-/findings + rpc GroupFindings(GroupFindingsRequest) returns (GroupFindingsResponse) { + option (google.api.http) = { + post: "/v1beta1/{parent=organizations/*/sources/*}/findings:group" + body: "*" + }; + option (google.api.method_signature) = "parent,group_by"; + } + + // Lists an organization's assets. + rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=organizations/*}/assets" + }; + } + + // Lists an organization or source's findings. + // + // To list across all sources provide a `-` as the source id. + // Example: /v1beta1/organizations/{organization_id}/sources/-/findings + rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=organizations/*/sources/*}/findings" + }; + } + + // Lists all sources belonging to an organization. + rpc ListSources(ListSourcesRequest) returns (ListSourcesResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=organizations/*}/sources" + }; + option (google.api.method_signature) = "parent"; + } + + // Runs asset discovery. The discovery is tracked with a long-running + // operation. + // + // This API can only be called with limited frequency for an organization. If + // it is called too frequently the caller will receive a TOO_MANY_REQUESTS + // error. + rpc RunAssetDiscovery(RunAssetDiscoveryRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{parent=organizations/*}/assets:runDiscovery" + body: "*" + }; + option (google.api.method_signature) = "parent"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Empty" + }; + } + + // Updates the state of a finding. + rpc SetFindingState(SetFindingStateRequest) returns (Finding) { + option (google.api.http) = { + post: "/v1beta1/{name=organizations/*/sources/*/findings/*}:setState" + body: "*" + }; + option (google.api.method_signature) = "name,state,start_time"; + } + + // Sets the access control policy on the specified Source. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1beta1/{resource=organizations/*/sources/*}:setIamPolicy" + body: "*" + }; + option (google.api.method_signature) = "resource,policy"; + } + + // Returns the permissions that a caller has on the specified source. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1beta1/{resource=organizations/*/sources/*}:testIamPermissions" + body: "*" + }; + option (google.api.method_signature) = "resource,permissions"; + } + + // Creates or updates a finding. The corresponding source must exist for a + // finding creation to succeed. + rpc UpdateFinding(UpdateFindingRequest) returns (Finding) { + option (google.api.http) = { + patch: "/v1beta1/{finding.name=organizations/*/sources/*/findings/*}" + body: "finding" + }; + option (google.api.method_signature) = "finding"; + } + + // Updates an organization's settings. + rpc UpdateOrganizationSettings(UpdateOrganizationSettingsRequest) returns (OrganizationSettings) { + option (google.api.http) = { + patch: "/v1beta1/{organization_settings.name=organizations/*/organizationSettings}" + body: "organization_settings" + }; + option (google.api.method_signature) = "organization_settings"; + } + + // Updates a source. + rpc UpdateSource(UpdateSourceRequest) returns (Source) { + option (google.api.http) = { + patch: "/v1beta1/{source.name=organizations/*/sources/*}" + body: "source" + }; + option (google.api.method_signature) = "source"; + } + + // Updates security marks. + rpc UpdateSecurityMarks(UpdateSecurityMarksRequest) returns (SecurityMarks) { + option (google.api.http) = { + patch: "/v1beta1/{security_marks.name=organizations/*/assets/*/securityMarks}" + body: "security_marks" + additional_bindings { + patch: "/v1beta1/{security_marks.name=organizations/*/sources/*/findings/*/securityMarks}" + body: "security_marks" + } + }; + option (google.api.method_signature) = "security_marks"; + } +} + +// Request message for creating a finding. +message CreateFindingRequest { + // Required. Resource name of the new finding's parent. Its format should be + // "organizations/[organization_id]/sources/[source_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; + + // Required. Unique identifier provided by the client within the parent scope. + // It must be alphanumeric and less than or equal to 32 characters and + // greater than 0 characters in length. + string finding_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Finding being created. The name and security_marks will be ignored as + // they are both output only fields on this resource. + Finding finding = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for creating a source. +message CreateSourceRequest { + // Required. Resource name of the new source's parent. Its format should be + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // Required. The Source being created, only the display_name and description will be + // used. All other fields will be ignored. + Source source = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for getting organization settings. +message GetOrganizationSettingsRequest { + // Required. Name of the organization to get organization settings for. Its format is + // "organizations/[organization_id]/organizationSettings". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/OrganizationSettings" + } + ]; +} + +// Request message for getting a source. +message GetSourceRequest { + // Required. Relative resource name of the source. Its format is + // "organizations/[organization_id]/source/[source_id]". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; +} + +// Request message for grouping by assets. +message GroupAssetsRequest { + // Required. Name of the organization to groupBy. Its format is + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // Expression that defines the filter to apply across assets. + // The expression is a list of zero or more restrictions combined via logical + // operators `AND` and `OR`. + // Parentheses are not 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 Asset resource. Examples include: + // + // * name + // * security_center_properties.resource_name + // * resource_properties.a_property + // * security_marks.marks.marka + // + // 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. + // + // For example, `resource_properties.size = 100` is a valid filter string. + string filter = 2; + + // Required. Expression that defines what assets fields to use for grouping. The string + // value should follow SQL syntax: comma separated list of fields. For + // example: + // "security_center_properties.resource_project,security_center_properties.project". + // + // The following fields are supported when compare_duration is not set: + // + // * security_center_properties.resource_project + // * security_center_properties.resource_type + // * security_center_properties.resource_parent + // + // The following fields are supported when compare_duration is set: + // + // * security_center_properties.resource_type + string group_by = 3 [(google.api.field_behavior) = REQUIRED]; + + // When compare_duration is set, the Asset's "state" property is updated to + // indicate whether the asset was added, removed, or remained present during + // the compare_duration period of time that precedes the read_time. This is + // the time between (read_time - compare_duration) and read_time. + // + // The state value is derived based on the presence of the asset at the two + // points in time. Intermediate state changes between the two times don't + // affect the result. For example, the results aren't affected if the asset is + // removed and re-created again. + // + // Possible "state" values when compare_duration is specified: + // + // * "ADDED": indicates that the asset was not present before + // compare_duration, but present at reference_time. + // * "REMOVED": indicates that the asset was present at the start of + // compare_duration, but not present at reference_time. + // * "ACTIVE": indicates that the asset was present at both the + // start and the end of the time period defined by + // compare_duration and reference_time. + // + // This field is ignored if `state` is not a field in `group_by`. + google.protobuf.Duration compare_duration = 4; + + // Time used as a reference point when filtering assets. The filter is limited + // to assets existing at the supplied time and their values are those at that + // specific time. Absence of this field will default to the API's version of + // NOW. + google.protobuf.Timestamp read_time = 5; + + // The value returned by the last `GroupAssetsResponse`; indicates + // that this is a continuation of a prior `GroupAssets` call, and that the + // system should return the next page of data. + string page_token = 7; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 8; +} + +// Response message for grouping by assets. +message GroupAssetsResponse { + // Group results. There exists an element for each existing unique + // combination of property/values. The element contains a count for the number + // of times those specific property/values appear. + repeated GroupResult group_by_results = 1; + + // Time used for executing the groupBy request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; +} + +// Request message for grouping by findings. +message GroupFindingsRequest { + // Required. Name of the source to groupBy. Its format is + // "organizations/[organization_id]/sources/[source_id]". To groupBy across + // all sources provide a source_id of `-`. For example: + // organizations/{organization_id}/sources/- + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; + + // Expression that defines the filter to apply across findings. + // The expression is a list of one or more restrictions combined via logical + // operators `AND` and `OR`. + // Parentheses are not supported, and `OR` has higher precedence than `AND`. + // + // Restrictions have the form ` ` and may have a `-` + // character in front of them to indicate negation. Examples include: + // + // * name + // * source_properties.a_property + // * security_marks.marks.marka + // + // 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. + // + // For example, `source_properties.size = 100` is a valid filter string. + string filter = 2; + + // Required. Expression that defines what assets fields to use for grouping (including + // `state`). The string value should follow SQL syntax: comma separated list + // of fields. For example: + // "parent,resource_name". + // + // The following fields are supported: + // + // * resource_name + // * category + // * state + // * parent + string group_by = 3 [(google.api.field_behavior) = REQUIRED]; + + // Time used as a reference point when filtering findings. The filter is + // limited to findings existing at the supplied time and their values are + // those at that specific time. Absence of this field will default to the + // API's version of NOW. + google.protobuf.Timestamp read_time = 4; + + // The value returned by the last `GroupFindingsResponse`; indicates + // that this is a continuation of a prior `GroupFindings` call, and + // that the system should return the next page of data. + string page_token = 5; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 6; +} + +// Response message for group by findings. +message GroupFindingsResponse { + // Group results. There exists an element for each existing unique + // combination of property/values. The element contains a count for the number + // of times those specific property/values appear. + repeated GroupResult group_by_results = 1; + + // Time used for executing the groupBy request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; +} + +// Result containing the properties and count of a groupBy request. +message GroupResult { + // Properties matching the groupBy fields in the request. + map properties = 1; + + // Total count of resources for the given properties. + int64 count = 2; +} + +// Request message for listing sources. +message ListSourcesRequest { + // Required. Resource name of the parent of sources to list. Its format should be + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // The value returned by the last `ListSourcesResponse`; indicates + // that this is a continuation of a prior `ListSources` call, and + // that the system should return the next page of data. + string page_token = 2; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 7; +} + +// Response message for listing sources. +message ListSourcesResponse { + // Sources belonging to the requested parent. + repeated Source sources = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 2; +} + +// Request message for listing assets. +message ListAssetsRequest { + // Required. Name of the organization assets should belong to. Its format is + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // Expression that defines the filter to apply across assets. + // The expression is a list of zero or more restrictions combined via logical + // operators `AND` and `OR`. + // Parentheses are not 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 Asset resource. Examples include: + // + // * name + // * security_center_properties.resource_name + // * resource_properties.a_property + // * security_marks.marks.marka + // + // 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. + // + // For example, `resource_properties.size = 100` is a valid filter string. + string filter = 2; + + // Expression that defines what fields and order to use for sorting. The + // string value should follow SQL syntax: comma separated list of fields. For + // example: "name,resource_properties.a_property". The default sorting order + // is ascending. To specify descending order for a field, a suffix " desc" + // should be appended to the field name. For example: "name + // desc,resource_properties.a_property". Redundant space characters in the + // syntax are insignificant. "name desc,resource_properties.a_property" and " + // name desc , resource_properties.a_property " are equivalent. + string order_by = 3; + + // Time used as a reference point when filtering assets. The filter is limited + // to assets existing at the supplied time and their values are those at that + // specific time. Absence of this field will default to the API's version of + // NOW. + google.protobuf.Timestamp read_time = 4; + + // When compare_duration is set, the ListAssetResult's "state" attribute is + // updated to indicate whether the asset was added, removed, or remained + // present during the compare_duration period of time that precedes the + // read_time. This is the time between (read_time - + // compare_duration) and read_time. + // + // The state value is derived based on the presence of the asset at the two + // points in time. Intermediate state changes between the two times don't + // affect the result. For example, the results aren't affected if the asset is + // removed and re-created again. + // + // Possible "state" values when compare_duration is specified: + // + // * "ADDED": indicates that the asset was not present before + // compare_duration, but present at read_time. + // * "REMOVED": indicates that the asset was present at the start of + // compare_duration, but not present at read_time. + // * "ACTIVE": indicates that the asset was present at both the + // start and the end of the time period defined by + // compare_duration and read_time. + // + // If compare_duration is not specified, then the only possible state is + // "UNUSED", which indicates that the asset is present at read_time. + google.protobuf.Duration compare_duration = 5; + + // Optional. A field mask to specify the ListAssetsResult fields to be listed in the + // response. + // An empty field mask will list all fields. + google.protobuf.FieldMask field_mask = 7 [(google.api.field_behavior) = OPTIONAL]; + + // The value returned by the last `ListAssetsResponse`; indicates + // that this is a continuation of a prior `ListAssets` call, and + // that the system should return the next page of data. + string page_token = 8; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 9; +} + +// Response message for listing assets. +message ListAssetsResponse { + // Result containing the Asset and its State. + message ListAssetsResult { + // State of the asset. + // + // When querying across two points in time this describes + // the change between the two points: ADDED, REMOVED, or ACTIVE. + // If there was no compare_duration supplied in the request the state should + // be: UNUSED + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // Request did not specify use of this field in the result. + UNUSED = 1; + + // Asset was added between the points in time. + ADDED = 2; + + // Asset was removed between the points in time. + REMOVED = 3; + + // Asset was active at both point(s) in time. + ACTIVE = 4; + } + + // Asset matching the search request. + Asset asset = 1; + + // State of the asset. + State state = 2; + } + + // Assets matching the list request. + repeated ListAssetsResult list_assets_results = 1; + + // Time used for executing the list request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of assets matching the query. + int32 total_size = 4; +} + +// Request message for listing findings. +message ListFindingsRequest { + // Required. Name of the source the findings belong to. Its format is + // "organizations/[organization_id]/sources/[source_id]". To list across all + // sources provide a source_id of `-`. For example: + // organizations/{organization_id}/sources/- + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; + + // Expression that defines the filter to apply across findings. + // The expression is a list of one or more restrictions combined via logical + // operators `AND` and `OR`. + // Parentheses are not supported, and `OR` has higher precedence than `AND`. + // + // Restrictions have the form ` ` and may have a `-` + // character in front of them to indicate negation. Examples include: + // + // * name + // * source_properties.a_property + // * security_marks.marks.marka + // + // 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. + // + // For example, `source_properties.size = 100` is a valid filter string. + string filter = 2; + + // Expression that defines what fields and order to use for sorting. The + // string value should follow SQL syntax: comma separated list of fields. For + // example: "name,resource_properties.a_property". The default sorting order + // is ascending. To specify descending order for a field, a suffix " desc" + // should be appended to the field name. For example: "name + // desc,source_properties.a_property". Redundant space characters in the + // syntax are insignificant. "name desc,source_properties.a_property" and " + // name desc , source_properties.a_property " are equivalent. + string order_by = 3; + + // Time used as a reference point when filtering findings. The filter is + // limited to findings existing at the supplied time and their values are + // those at that specific time. Absence of this field will default to the + // API's version of NOW. + google.protobuf.Timestamp read_time = 4; + + // Optional. A field mask to specify the Finding fields to be listed in the response. + // An empty field mask will list all fields. + google.protobuf.FieldMask field_mask = 5 [(google.api.field_behavior) = OPTIONAL]; + + // The value returned by the last `ListFindingsResponse`; indicates + // that this is a continuation of a prior `ListFindings` call, and + // that the system should return the next page of data. + string page_token = 6; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 7; +} + +// Response message for listing findings. +message ListFindingsResponse { + // Findings matching the list request. + repeated Finding findings = 1; + + // Time used for executing the list request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of findings matching the query. + int32 total_size = 4; +} + +// Request message for updating a finding's state. +message SetFindingStateRequest { + // Required. The relative resource name of the finding. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Finding" + } + ]; + + // Required. The desired State of the finding. + Finding.State state = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The time at which the updated state takes effect. + google.protobuf.Timestamp start_time = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for running asset discovery for an organization. +message RunAssetDiscoveryRequest { + // Required. Name of the organization to run asset discovery for. Its format is + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; +} + +// Request message for updating or creating a finding. +message UpdateFindingRequest { + // Required. The finding resource to update or create if it does not already exist. + // parent, security_marks, and update_time will be ignored. + // + // In the case of creation, the finding id portion of the name must + // alphanumeric and less than or equal to 32 characters and greater than 0 + // characters in length. + Finding finding = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the finding resource. This field should + // not be specified when creating a finding. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating an organization's settings. +message UpdateOrganizationSettingsRequest { + // Required. The organization settings resource to update. + OrganizationSettings organization_settings = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the settings resource. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating a source. +message UpdateSourceRequest { + // Required. The source resource to update. + Source source = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the source resource. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating a SecurityMarks resource. +message UpdateSecurityMarksRequest { + // Required. The security marks resource to update. + SecurityMarks security_marks = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the security marks resource. + google.protobuf.FieldMask update_mask = 2; + + // The time at which the updated SecurityMarks take effect. + google.protobuf.Timestamp start_time = 3; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/source.proto b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/source.proto new file mode 100644 index 00000000000..d6fec93631d --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/source.proto @@ -0,0 +1,55 @@ +// Copyright 2020 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1beta1; + +import "google/api/resource.proto"; + +option go_package = "cloud.google.com/go/securitycenter/apiv1beta1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1beta1"; + +// Security Command Center finding source. A finding source +// is an entity or a mechanism that can produce a finding. A source is like a +// container of findings that come from the same scanner, logger, monitor, etc. +message Source { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/Source" + pattern: "organizations/{organization}/sources/{source}" + }; + + // The relative resource name of this source. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/sources/{source_id}" + string name = 1; + + // The source's display name. + // A source's display name must be unique amongst its siblings, for example, + // two sources with the same parent can't share the same display name. + // The display name must have a length between 1 and 64 characters + // (inclusive). + string display_name = 2; + + // The description of the source (max of 1024 characters). + // Example: + // "Web Security Scanner is a web security scanner for common + // vulnerabilities in App Engine applications. It can automatically + // scan and detect four common vulnerabilities, including cross-site-scripting + // (XSS), Flash injection, mixed content (HTTP in HTTPS), and + // outdated/insecure libraries." + string description = 3; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.create_finding.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.create_finding.js new file mode 100644 index 00000000000..4de06256a74 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.create_finding.js @@ -0,0 +1,75 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, findingId, finding) { + // [START securitycenter_v1beta1_generated_SecurityCenter_CreateFinding_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new finding's parent. Its format should be + * "organizations/[organization_id]/sources/[source_id]". + */ + // const parent = 'abc123' + /** + * Required. Unique identifier provided by the client within the parent scope. + * It must be alphanumeric and less than or equal to 32 characters and + * greater than 0 characters in length. + */ + // const findingId = 'abc123' + /** + * Required. The Finding being created. The name and security_marks will be ignored as + * they are both output only fields on this resource. + */ + // const finding = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateFinding() { + // Construct request + const request = { + parent, + findingId, + finding, + }; + + // Run request + const response = await securitycenterClient.createFinding(request); + console.log(response); + } + + callCreateFinding(); + // [END securitycenter_v1beta1_generated_SecurityCenter_CreateFinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.create_source.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.create_source.js new file mode 100644 index 00000000000..5f7f8ed258c --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.create_source.js @@ -0,0 +1,68 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, source) { + // [START securitycenter_v1beta1_generated_SecurityCenter_CreateSource_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new source's parent. Its format should be + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + /** + * Required. The Source being created, only the display_name and description will be + * used. All other fields will be ignored. + */ + // const source = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateSource() { + // Construct request + const request = { + parent, + source, + }; + + // Run request + const response = await securitycenterClient.createSource(request); + console.log(response); + } + + callCreateSource(); + // [END securitycenter_v1beta1_generated_SecurityCenter_CreateSource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_iam_policy.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_iam_policy.js new file mode 100644 index 00000000000..40d4608e605 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_iam_policy.js @@ -0,0 +1,67 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource) { + // [START securitycenter_v1beta1_generated_SecurityCenter_GetIamPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + */ + // const options = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await securitycenterClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END securitycenter_v1beta1_generated_SecurityCenter_GetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_organization_settings.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_organization_settings.js new file mode 100644 index 00000000000..5a2f5784f05 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_organization_settings.js @@ -0,0 +1,62 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1beta1_generated_SecurityCenter_GetOrganizationSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to get organization settings for. Its format is + * "organizations/[organization_id]/organizationSettings". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetOrganizationSettings() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getOrganizationSettings(request); + console.log(response); + } + + callGetOrganizationSettings(); + // [END securitycenter_v1beta1_generated_SecurityCenter_GetOrganizationSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_source.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_source.js new file mode 100644 index 00000000000..ffdc4eda51c --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_source.js @@ -0,0 +1,62 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1beta1_generated_SecurityCenter_GetSource_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Relative resource name of the source. Its format is + * "organizations/[organization_id]/source/[source_id]". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetSource() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getSource(request); + console.log(response); + } + + callGetSource(); + // [END securitycenter_v1beta1_generated_SecurityCenter_GetSource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.group_assets.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.group_assets.js new file mode 100644 index 00000000000..eac3b71634f --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.group_assets.js @@ -0,0 +1,139 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, groupBy) { + // [START securitycenter_v1beta1_generated_SecurityCenter_GroupAssets_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not 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 Asset resource. Examples include: + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * 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. + * For example, `resource_properties.size = 100` is a valid filter string. + */ + // const filter = 'abc123' + /** + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * The following fields are supported when compare_duration is not set: + * * security_center_properties.resource_project + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * The following fields are supported when compare_duration is set: + * * security_center_properties.resource_type + */ + // const groupBy = 'abc123' + /** + * When compare_duration is set, the Asset's "state" property is updated to + * indicate whether the asset was added, removed, or remained present during + * the compare_duration period of time that precedes the read_time. This is + * the time between (read_time - compare_duration) and read_time. + * The state value is derived based on the presence of the asset at the two + * points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * Possible "state" values when compare_duration is specified: + * * "ADDED": indicates that the asset was not present before + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * This field is ignored if `state` is not a field in `group_by`. + */ + // const compareDuration = {} + /** + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + */ + // const readTime = {} + /** + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGroupAssets() { + // Construct request + const request = { + parent, + groupBy, + }; + + // Run request + const iterable = await securitycenterClient.groupAssetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callGroupAssets(); + // [END securitycenter_v1beta1_generated_SecurityCenter_GroupAssets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.group_findings.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.group_findings.js new file mode 100644 index 00000000000..ddcc1f534b0 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.group_findings.js @@ -0,0 +1,118 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, groupBy) { + // [START securitycenter_v1beta1_generated_SecurityCenter_GroupFindings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]". To groupBy across + * all sources provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/- + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * 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. + * For example, `source_properties.size = 100` is a valid filter string. + */ + // const filter = 'abc123' + /** + * Required. Expression that defines what assets fields to use for grouping (including + * `state`). The string value should follow SQL syntax: comma separated list + * of fields. For example: + * "parent,resource_name". + * The following fields are supported: + * * resource_name + * * category + * * state + * * parent + */ + // const groupBy = 'abc123' + /** + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + */ + // const readTime = {} + /** + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGroupFindings() { + // Construct request + const request = { + parent, + groupBy, + }; + + // Run request + const iterable = await securitycenterClient.groupFindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callGroupFindings(); + // [END securitycenter_v1beta1_generated_SecurityCenter_GroupFindings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_assets.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_assets.js new file mode 100644 index 00000000000..8915077aeda --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_assets.js @@ -0,0 +1,144 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1beta1_generated_SecurityCenter_ListAssets_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not 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 Asset resource. Examples include: + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * 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. + * For example, `resource_properties.size = 100` is a valid filter string. + */ + // const filter = 'abc123' + /** + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + */ + // const orderBy = 'abc123' + /** + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + */ + // const readTime = {} + /** + * When compare_duration is set, the ListAssetResult's "state" attribute is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - + * compare_duration) and read_time. + * The state value is derived based on the presence of the asset at the two + * points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * Possible "state" values when compare_duration is specified: + * * "ADDED": indicates that the asset was not present before + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * If compare_duration is not specified, then the only possible state is + * "UNUSED", which indicates that the asset is present at read_time. + */ + // const compareDuration = {} + /** + * Optional. A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + */ + // const fieldMask = {} + /** + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListAssets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listAssetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAssets(); + // [END securitycenter_v1beta1_generated_SecurityCenter_ListAssets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_findings.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_findings.js new file mode 100644 index 00000000000..8fc14f840e0 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_findings.js @@ -0,0 +1,121 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1beta1_generated_SecurityCenter_ListFindings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id]". To list across all + * sources provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/- + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * 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. + * For example, `source_properties.size = 100` is a valid filter string. + */ + // const filter = 'abc123' + /** + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + */ + // const orderBy = 'abc123' + /** + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + */ + // const readTime = {} + /** + * Optional. A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + */ + // const fieldMask = {} + /** + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListFindings() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listFindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFindings(); + // [END securitycenter_v1beta1_generated_SecurityCenter_ListFindings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_sources.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_sources.js new file mode 100644 index 00000000000..175607f7e1f --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_sources.js @@ -0,0 +1,75 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1beta1_generated_SecurityCenter_ListSources_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + /** + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListSources() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listSourcesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSources(); + // [END securitycenter_v1beta1_generated_SecurityCenter_ListSources_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.run_asset_discovery.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.run_asset_discovery.js new file mode 100644 index 00000000000..7008016fbf0 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.run_asset_discovery.js @@ -0,0 +1,63 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to run asset discovery for. Its format is + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callRunAssetDiscovery() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await securitycenterClient.runAssetDiscovery(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRunAssetDiscovery(); + // [END securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.set_finding_state.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.set_finding_state.js new file mode 100644 index 00000000000..14287c126c0 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.set_finding_state.js @@ -0,0 +1,74 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, state, startTime) { + // [START securitycenter_v1beta1_generated_SecurityCenter_SetFindingState_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the finding. See: + * https://cloud.google.com/apis/design/resource_names#relative_resource_name + * Example: + * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". + */ + // const name = 'abc123' + /** + * Required. The desired State of the finding. + */ + // const state = {} + /** + * Required. The time at which the updated state takes effect. + */ + // const startTime = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callSetFindingState() { + // Construct request + const request = { + name, + state, + startTime, + }; + + // Run request + const response = await securitycenterClient.setFindingState(request); + console.log(response); + } + + callSetFindingState(); + // [END securitycenter_v1beta1_generated_SecurityCenter_SetFindingState_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.set_iam_policy.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.set_iam_policy.js new file mode 100644 index 00000000000..46f44ef33f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.set_iam_policy.js @@ -0,0 +1,77 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource, policy) { + // [START securitycenter_v1beta1_generated_SecurityCenter_SetIamPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + */ + // const policy = {} + /** + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * `paths: "bindings, etag"` + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await securitycenterClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END securitycenter_v1beta1_generated_SecurityCenter_SetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.test_iam_permissions.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.test_iam_permissions.js new file mode 100644 index 00000000000..8b85e662c11 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.test_iam_permissions.js @@ -0,0 +1,70 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource, permissions) { + // [START securitycenter_v1beta1_generated_SecurityCenter_TestIamPermissions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). + */ + // const permissions = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await securitycenterClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END securitycenter_v1beta1_generated_SecurityCenter_TestIamPermissions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_finding.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_finding.js new file mode 100644 index 00000000000..99c4b58a546 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_finding.js @@ -0,0 +1,70 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(finding) { + // [START securitycenter_v1beta1_generated_SecurityCenter_UpdateFinding_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The finding resource to update or create if it does not already exist. + * parent, security_marks, and update_time will be ignored. + * In the case of creation, the finding id portion of the name must + * alphanumeric and less than or equal to 32 characters and greater than 0 + * characters in length. + */ + // const finding = {} + /** + * The FieldMask to use when updating the finding resource. This field should + * not be specified when creating a finding. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateFinding() { + // Construct request + const request = { + finding, + }; + + // Run request + const response = await securitycenterClient.updateFinding(request); + console.log(response); + } + + callUpdateFinding(); + // [END securitycenter_v1beta1_generated_SecurityCenter_UpdateFinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_organization_settings.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_organization_settings.js new file mode 100644 index 00000000000..d48876b5e77 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_organization_settings.js @@ -0,0 +1,65 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(organizationSettings) { + // [START securitycenter_v1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The organization settings resource to update. + */ + // const organizationSettings = {} + /** + * The FieldMask to use when updating the settings resource. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateOrganizationSettings() { + // Construct request + const request = { + organizationSettings, + }; + + // Run request + const response = await securitycenterClient.updateOrganizationSettings(request); + console.log(response); + } + + callUpdateOrganizationSettings(); + // [END securitycenter_v1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_security_marks.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_security_marks.js new file mode 100644 index 00000000000..4fe37d0989b --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_security_marks.js @@ -0,0 +1,69 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(securityMarks) { + // [START securitycenter_v1beta1_generated_SecurityCenter_UpdateSecurityMarks_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The security marks resource to update. + */ + // const securityMarks = {} + /** + * The FieldMask to use when updating the security marks resource. + */ + // const updateMask = {} + /** + * The time at which the updated SecurityMarks take effect. + */ + // const startTime = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateSecurityMarks() { + // Construct request + const request = { + securityMarks, + }; + + // Run request + const response = await securitycenterClient.updateSecurityMarks(request); + console.log(response); + } + + callUpdateSecurityMarks(); + // [END securitycenter_v1beta1_generated_SecurityCenter_UpdateSecurityMarks_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_source.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_source.js new file mode 100644 index 00000000000..c0f495186cb --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_source.js @@ -0,0 +1,65 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(source) { + // [START securitycenter_v1beta1_generated_SecurityCenter_UpdateSource_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The source resource to update. + */ + // const source = {} + /** + * The FieldMask to use when updating the source resource. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateSource() { + // Construct request + const request = { + source, + }; + + // Run request + const response = await securitycenterClient.updateSource(request); + console.log(response); + } + + callUpdateSource(); + // [END securitycenter_v1beta1_generated_SecurityCenter_UpdateSource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json new file mode 100644 index 00000000000..e41fe5b440c --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json @@ -0,0 +1,895 @@ +{ + "clientLibrary": { + "name": "nodejs-securitycenter", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.securitycenter.v1beta1", + "version": "v1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_CreateSource_async", + "title": "SecurityCenter createSource Sample", + "origin": "API_DEFINITION", + "description": " Creates a source.", + "canonical": true, + "file": "security_center.create_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSource", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.CreateSource", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "source", + "type": ".google.cloud.securitycenter.v1beta1.Source" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.Source", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateSource", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.CreateSource", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_CreateFinding_async", + "title": "SecurityCenter createFinding Sample", + "origin": "API_DEFINITION", + "description": " Creates a finding. The corresponding source must exist for finding creation to succeed.", + "canonical": true, + "file": "security_center.create_finding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFinding", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.CreateFinding", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "finding_id", + "type": "TYPE_STRING" + }, + { + "name": "finding", + "type": ".google.cloud.securitycenter.v1beta1.Finding" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateFinding", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.CreateFinding", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GetIamPolicy_async", + "title": "SecurityCenter getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the access control policy on the specified Source.", + "canonical": true, + "file": "security_center.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetIamPolicy", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GetOrganizationSettings_async", + "title": "SecurityCenter getOrganizationSettings Sample", + "origin": "API_DEFINITION", + "description": " Gets the settings for an organization.", + "canonical": true, + "file": "security_center.get_organization_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetOrganizationSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.OrganizationSettings", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GetOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetOrganizationSettings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GetSource_async", + "title": "SecurityCenter getSource Sample", + "origin": "API_DEFINITION", + "description": " Gets a source.", + "canonical": true, + "file": "security_center.get_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSource", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetSource", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.Source", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GetSource", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetSource", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GroupAssets_async", + "title": "SecurityCenter groupAssets Sample", + "origin": "API_DEFINITION", + "description": " Filters an organization's assets and groups them by their specified properties.", + "canonical": true, + "file": "security_center.group_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 131, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GroupAssets", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GroupAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "group_by", + "type": "TYPE_STRING" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.GroupAssetsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GroupAssets", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GroupAssets", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GroupFindings_async", + "title": "SecurityCenter groupFindings Sample", + "origin": "API_DEFINITION", + "description": " Filters an organization or source's findings and groups them by their specified properties. To group across all sources provide a `-` as the source id. Example: /v1beta1/organizations/{organization_id}/sources/-/findings", + "canonical": true, + "file": "security_center.group_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 110, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GroupFindings", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GroupFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "group_by", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.GroupFindingsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GroupFindings", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GroupFindings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_ListAssets_async", + "title": "SecurityCenter listAssets Sample", + "origin": "API_DEFINITION", + "description": " Lists an organization's assets.", + "canonical": true, + "file": "security_center.list_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 136, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAssets", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.ListAssetsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "ListAssets", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListAssets", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_ListFindings_async", + "title": "SecurityCenter listFindings Sample", + "origin": "API_DEFINITION", + "description": " Lists an organization or source's findings. To list across all sources provide a `-` as the source id. Example: /v1beta1/organizations/{organization_id}/sources/-/findings", + "canonical": true, + "file": "security_center.list_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 113, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFindings", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.ListFindingsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "ListFindings", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListFindings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_ListSources_async", + "title": "SecurityCenter listSources Sample", + "origin": "API_DEFINITION", + "description": " Lists all sources belonging to an organization.", + "canonical": true, + "file": "security_center.list_sources.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSources", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListSources", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.ListSourcesResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "ListSources", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListSources", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async", + "title": "SecurityCenter runAssetDiscovery Sample", + "origin": "API_DEFINITION", + "description": " Runs asset discovery. The discovery is tracked with a long-running operation. This API can only be called with limited frequency for an organization. If it is called too frequently the caller will receive a TOO_MANY_REQUESTS error.", + "canonical": true, + "file": "security_center.run_asset_discovery.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RunAssetDiscovery", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.RunAssetDiscovery", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "RunAssetDiscovery", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.RunAssetDiscovery", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_SetFindingState_async", + "title": "SecurityCenter setFindingState Sample", + "origin": "API_DEFINITION", + "description": " Updates the state of a finding.", + "canonical": true, + "file": "security_center.set_finding_state.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetFindingState", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.SetFindingState", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "state", + "type": ".google.cloud.securitycenter.v1beta1.Finding.State" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "SetFindingState", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.SetFindingState", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_SetIamPolicy_async", + "title": "SecurityCenter setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the access control policy on the specified Source.", + "canonical": true, + "file": "security_center.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.SetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "policy", + "type": ".google.iam.v1.Policy" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.SetIamPolicy", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_TestIamPermissions_async", + "title": "SecurityCenter testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Returns the permissions that a caller has on the specified source.", + "canonical": true, + "file": "security_center.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.TestIamPermissions", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_UpdateFinding_async", + "title": "SecurityCenter updateFinding Sample", + "origin": "API_DEFINITION", + "description": " Creates or updates a finding. The corresponding source must exist for a finding creation to succeed.", + "canonical": true, + "file": "security_center.update_finding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFinding", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateFinding", + "async": true, + "parameters": [ + { + "name": "finding", + "type": ".google.cloud.securitycenter.v1beta1.Finding" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateFinding", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateFinding", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async", + "title": "SecurityCenter updateOrganizationSettings Sample", + "origin": "API_DEFINITION", + "description": " Updates an organization's settings.", + "canonical": true, + "file": "security_center.update_organization_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateOrganizationSettings", + "async": true, + "parameters": [ + { + "name": "organization_settings", + "type": ".google.cloud.securitycenter.v1beta1.OrganizationSettings" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.OrganizationSettings", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateOrganizationSettings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_UpdateSource_async", + "title": "SecurityCenter updateSource Sample", + "origin": "API_DEFINITION", + "description": " Updates a source.", + "canonical": true, + "file": "security_center.update_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSource", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateSource", + "async": true, + "parameters": [ + { + "name": "source", + "type": ".google.cloud.securitycenter.v1beta1.Source" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.Source", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateSource", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateSource", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_UpdateSecurityMarks_async", + "title": "SecurityCenter updateSecurityMarks Sample", + "origin": "API_DEFINITION", + "description": " Updates security marks.", + "canonical": true, + "file": "security_center.update_security_marks.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSecurityMarks", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateSecurityMarks", + "async": true, + "parameters": [ + { + "name": "security_marks", + "type": ".google.cloud.securitycenter.v1beta1.SecurityMarks" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.SecurityMarks", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateSecurityMarks", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateSecurityMarks", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/index.ts b/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/index.ts new file mode 100644 index 00000000000..0efca2458d0 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1beta1 from './v1beta1'; +const SecurityCenterClient = v1beta1.SecurityCenterClient; +type SecurityCenterClient = v1beta1.SecurityCenterClient; +export {v1beta1, SecurityCenterClient}; +export default {v1beta1, SecurityCenterClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/gapic_metadata.json new file mode 100644 index 00000000000..02da4303dc4 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/gapic_metadata.json @@ -0,0 +1,223 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.securitycenter.v1beta1", + "libraryPackage": "@google-cloud/security-center", + "services": { + "SecurityCenter": { + "clients": { + "grpc": { + "libraryClient": "SecurityCenterClient", + "rpcs": { + "CreateSource": { + "methods": [ + "createSource" + ] + }, + "CreateFinding": { + "methods": [ + "createFinding" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "GetOrganizationSettings": { + "methods": [ + "getOrganizationSettings" + ] + }, + "GetSource": { + "methods": [ + "getSource" + ] + }, + "SetFindingState": { + "methods": [ + "setFindingState" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "UpdateFinding": { + "methods": [ + "updateFinding" + ] + }, + "UpdateOrganizationSettings": { + "methods": [ + "updateOrganizationSettings" + ] + }, + "UpdateSource": { + "methods": [ + "updateSource" + ] + }, + "UpdateSecurityMarks": { + "methods": [ + "updateSecurityMarks" + ] + }, + "RunAssetDiscovery": { + "methods": [ + "runAssetDiscovery" + ] + }, + "GroupAssets": { + "methods": [ + "groupAssets", + "groupAssetsStream", + "groupAssetsAsync" + ] + }, + "GroupFindings": { + "methods": [ + "groupFindings", + "groupFindingsStream", + "groupFindingsAsync" + ] + }, + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + }, + "ListSources": { + "methods": [ + "listSources", + "listSourcesStream", + "listSourcesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SecurityCenterClient", + "rpcs": { + "CreateSource": { + "methods": [ + "createSource" + ] + }, + "CreateFinding": { + "methods": [ + "createFinding" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "GetOrganizationSettings": { + "methods": [ + "getOrganizationSettings" + ] + }, + "GetSource": { + "methods": [ + "getSource" + ] + }, + "SetFindingState": { + "methods": [ + "setFindingState" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "UpdateFinding": { + "methods": [ + "updateFinding" + ] + }, + "UpdateOrganizationSettings": { + "methods": [ + "updateOrganizationSettings" + ] + }, + "UpdateSource": { + "methods": [ + "updateSource" + ] + }, + "UpdateSecurityMarks": { + "methods": [ + "updateSecurityMarks" + ] + }, + "RunAssetDiscovery": { + "methods": [ + "runAssetDiscovery" + ] + }, + "GroupAssets": { + "methods": [ + "groupAssets", + "groupAssetsStream", + "groupAssetsAsync" + ] + }, + "GroupFindings": { + "methods": [ + "groupFindings", + "groupFindingsStream", + "groupFindingsAsync" + ] + }, + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + }, + "ListSources": { + "methods": [ + "listSources", + "listSourcesStream", + "listSourcesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/index.ts new file mode 100644 index 00000000000..fa3996e6154 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {SecurityCenterClient} from './security_center_client'; diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_client.ts b/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_client.ts new file mode 100644 index 00000000000..321cd279d9d --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_client.ts @@ -0,0 +1,3268 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta1/security_center_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './security_center_client_config.json'; +const version = require('../../../package.json').version; + +/** + * V1 Beta APIs for Security Center service. + * @class + * @memberof v1beta1 + */ +export class SecurityCenterClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + securityCenterStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SecurityCenterClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SecurityCenterClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SecurityCenterClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + assetPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/assets/{asset}' + ), + findingPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}/findings/{finding}' + ), + organizationPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}' + ), + organizationAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/assets/{asset}/securityMarks' + ), + organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/organizationSettings' + ), + organizationSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks' + ), + sourcePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + groupAssets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), + groupFindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), + listAssets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listAssetsResults'), + listFindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings'), + listSources: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sources') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=organizations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=organizations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=organizations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/{name=organizations/*/operations}',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const runAssetDiscoveryResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const runAssetDiscoveryMetadata = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + + this.descriptors.longrunning = { + runAssetDiscovery: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + runAssetDiscoveryResponse.decode.bind(runAssetDiscoveryResponse), + runAssetDiscoveryMetadata.decode.bind(runAssetDiscoveryMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.securitycenter.v1beta1.SecurityCenter', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.securityCenterStub) { + return this.securityCenterStub; + } + + // Put together the "service stub" for + // google.cloud.securitycenter.v1beta1.SecurityCenter. + this.securityCenterStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.securitycenter.v1beta1.SecurityCenter') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.securitycenter.v1beta1.SecurityCenter, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const securityCenterStubMethods = + ['createSource', 'createFinding', 'getIamPolicy', 'getOrganizationSettings', 'getSource', 'groupAssets', 'groupFindings', 'listAssets', 'listFindings', 'listSources', 'runAssetDiscovery', 'setFindingState', 'setIamPolicy', 'testIamPermissions', 'updateFinding', 'updateOrganizationSettings', 'updateSource', 'updateSecurityMarks']; + for (const methodName of securityCenterStubMethods) { + const callPromise = this.securityCenterStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.securityCenterStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'securitycenter.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'securitycenter.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Creates a source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new source's parent. Its format should be + * "organizations/[organization_id]". + * @param {google.cloud.securitycenter.v1beta1.Source} request.source + * Required. The Source being created, only the display_name and description will be + * used. All other fields will be ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1beta1.Source | Source}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.create_source.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_CreateSource_async + */ + createSource( + request?: protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|undefined, {}|undefined + ]>; + createSource( + request: protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|null|undefined, + {}|null|undefined>): void; + createSource( + request: protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|null|undefined, + {}|null|undefined>): void; + createSource( + request?: protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createSource(request, options, callback); + } +/** + * Creates a finding. The corresponding source must exist for finding creation + * to succeed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new finding's parent. Its format should be + * "organizations/[organization_id]/sources/[source_id]". + * @param {string} request.findingId + * Required. Unique identifier provided by the client within the parent scope. + * It must be alphanumeric and less than or equal to 32 characters and + * greater than 0 characters in length. + * @param {google.cloud.securitycenter.v1beta1.Finding} request.finding + * Required. The Finding being created. The name and security_marks will be ignored as + * they are both output only fields on this resource. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1beta1.Finding | Finding}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.create_finding.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_CreateFinding_async + */ + createFinding( + request?: protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|undefined, {}|undefined + ]>; + createFinding( + request: protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|null|undefined, + {}|null|undefined>): void; + createFinding( + request: protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|null|undefined, + {}|null|undefined>): void; + createFinding( + request?: protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createFinding(request, options, callback); + } +/** + * Gets the access control policy on the specified Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.GetPolicyOptions} request.options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.get_iam_policy.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GetIamPolicy_async + */ + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource': request.resource ?? '', + }); + this.initialize(); + return this.innerApiCalls.getIamPolicy(request, options, callback); + } +/** + * Gets the settings for an organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the organization to get organization settings for. Its format is + * "organizations/[organization_id]/organizationSettings". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1beta1.OrganizationSettings | OrganizationSettings}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.get_organization_settings.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GetOrganizationSettings_async + */ + getOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|undefined, {}|undefined + ]>; + getOrganizationSettings( + request: protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + getOrganizationSettings( + request: protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + getOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getOrganizationSettings(request, options, callback); + } +/** + * Gets a source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Relative resource name of the source. Its format is + * "organizations/[organization_id]/source/[source_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1beta1.Source | Source}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.get_source.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GetSource_async + */ + getSource( + request?: protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|undefined, {}|undefined + ]>; + getSource( + request: protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|null|undefined, + {}|null|undefined>): void; + getSource( + request: protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|null|undefined, + {}|null|undefined>): void; + getSource( + request?: protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getSource(request, options, callback); + } +/** + * Updates the state of a finding. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the finding. See: + * https://cloud.google.com/apis/design/resource_names#relative_resource_name + * Example: + * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". + * @param {google.cloud.securitycenter.v1beta1.Finding.State} request.state + * Required. The desired State of the finding. + * @param {google.protobuf.Timestamp} request.startTime + * Required. The time at which the updated state takes effect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1beta1.Finding | Finding}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.set_finding_state.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_SetFindingState_async + */ + setFindingState( + request?: protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|undefined, {}|undefined + ]>; + setFindingState( + request: protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>): void; + setFindingState( + request: protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>): void; + setFindingState( + request?: protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.setFindingState(request, options, callback); + } +/** + * Sets the access control policy on the specified Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.Policy} request.policy + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param {google.protobuf.FieldMask} request.updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.set_iam_policy.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_SetIamPolicy_async + */ + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource': request.resource ?? '', + }); + this.initialize(); + return this.innerApiCalls.setIamPolicy(request, options, callback); + } +/** + * Returns the permissions that a caller has on the specified source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.test_iam_permissions.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_TestIamPermissions_async + */ + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource': request.resource ?? '', + }); + this.initialize(); + return this.innerApiCalls.testIamPermissions(request, options, callback); + } +/** + * Creates or updates a finding. The corresponding source must exist for a + * finding creation to succeed. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1beta1.Finding} request.finding + * Required. The finding resource to update or create if it does not already exist. + * parent, security_marks, and update_time will be ignored. + * + * In the case of creation, the finding id portion of the name must + * alphanumeric and less than or equal to 32 characters and greater than 0 + * characters in length. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the finding resource. This field should + * not be specified when creating a finding. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1beta1.Finding | Finding}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.update_finding.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_UpdateFinding_async + */ + updateFinding( + request?: protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|undefined, {}|undefined + ]>; + updateFinding( + request: protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>): void; + updateFinding( + request: protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>): void; + updateFinding( + request?: protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'finding.name': request.finding!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFinding(request, options, callback); + } +/** + * Updates an organization's settings. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1beta1.OrganizationSettings} request.organizationSettings + * Required. The organization settings resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the settings resource. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1beta1.OrganizationSettings | OrganizationSettings}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.update_organization_settings.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async + */ + updateOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|undefined, {}|undefined + ]>; + updateOrganizationSettings( + request: protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateOrganizationSettings( + request: protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'organization_settings.name': request.organizationSettings!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateOrganizationSettings(request, options, callback); + } +/** + * Updates a source. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1beta1.Source} request.source + * Required. The source resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the source resource. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1beta1.Source | Source}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.update_source.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_UpdateSource_async + */ + updateSource( + request?: protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|undefined, {}|undefined + ]>; + updateSource( + request: protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>): void; + updateSource( + request: protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>): void; + updateSource( + request?: protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'source.name': request.source!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSource(request, options, callback); + } +/** + * Updates security marks. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1beta1.SecurityMarks} request.securityMarks + * Required. The security marks resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the security marks resource. + * @param {google.protobuf.Timestamp} request.startTime + * The time at which the updated SecurityMarks take effect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1beta1.SecurityMarks | SecurityMarks}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.update_security_marks.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_UpdateSecurityMarks_async + */ + updateSecurityMarks( + request?: protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|undefined, {}|undefined + ]>; + updateSecurityMarks( + request: protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>): void; + updateSecurityMarks( + request: protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>): void; + updateSecurityMarks( + request?: protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'security_marks.name': request.securityMarks!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSecurityMarks(request, options, callback); + } + +/** + * Runs asset discovery. The discovery is tracked with a long-running + * operation. + * + * This API can only be called with limited frequency for an organization. If + * it is called too frequently the caller will receive a TOO_MANY_REQUESTS + * error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to run asset discovery for. Its format is + * "organizations/[organization_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.run_asset_discovery.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async + */ + runAssetDiscovery( + request?: protos.google.cloud.securitycenter.v1beta1.IRunAssetDiscoveryRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + runAssetDiscovery( + request: protos.google.cloud.securitycenter.v1beta1.IRunAssetDiscoveryRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runAssetDiscovery( + request: protos.google.cloud.securitycenter.v1beta1.IRunAssetDiscoveryRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runAssetDiscovery( + request?: protos.google.cloud.securitycenter.v1beta1.IRunAssetDiscoveryRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.runAssetDiscovery(request, options, callback); + } +/** + * Check the status of the long running operation returned by `runAssetDiscovery()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.run_asset_discovery.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async + */ + async checkRunAssetDiscoveryProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runAssetDiscovery, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Filters an organization's assets and groups them by their specified + * properties. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not 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 Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * For example, `resource_properties.size = 100` is a valid filter string. + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * + * The following fields are supported when compare_duration is not set: + * + * * security_center_properties.resource_project + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * + * The following fields are supported when compare_duration is set: + * + * * security_center_properties.resource_type + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the Asset's "state" property is updated to + * indicate whether the asset was added, removed, or remained present during + * the compare_duration period of time that precedes the read_time. This is + * the time between (read_time - compare_duration) and read_time. + * + * The state value is derived based on the presence of the asset at the two + * points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present before + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * + * This field is ignored if `state` is not a field in `group_by`. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1beta1.GroupResult | GroupResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `groupAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + groupAssets( + request?: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IGroupResult[], + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest|null, + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse + ]>; + groupAssets( + request: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IGroupResult>): void; + groupAssets( + request: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IGroupResult>): void; + groupAssets( + request?: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IGroupResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IGroupResult>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IGroupResult[], + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest|null, + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.groupAssets(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not 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 Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * For example, `resource_properties.size = 100` is a valid filter string. + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * + * The following fields are supported when compare_duration is not set: + * + * * security_center_properties.resource_project + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * + * The following fields are supported when compare_duration is set: + * + * * security_center_properties.resource_type + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the Asset's "state" property is updated to + * indicate whether the asset was added, removed, or remained present during + * the compare_duration period of time that precedes the read_time. This is + * the time between (read_time - compare_duration) and read_time. + * + * The state value is derived based on the presence of the asset at the two + * points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present before + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * + * This field is ignored if `state` is not a field in `group_by`. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1beta1.GroupResult | GroupResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `groupAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + groupAssetsStream( + request?: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['groupAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupAssets.createStream( + this.innerApiCalls.groupAssets as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `groupAssets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not 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 Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * For example, `resource_properties.size = 100` is a valid filter string. + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * + * The following fields are supported when compare_duration is not set: + * + * * security_center_properties.resource_project + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * + * The following fields are supported when compare_duration is set: + * + * * security_center_properties.resource_type + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the Asset's "state" property is updated to + * indicate whether the asset was added, removed, or remained present during + * the compare_duration period of time that precedes the read_time. This is + * the time between (read_time - compare_duration) and read_time. + * + * The state value is derived based on the presence of the asset at the two + * points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present before + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * + * This field is ignored if `state` is not a field in `group_by`. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1beta1.GroupResult | GroupResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.group_assets.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GroupAssets_async + */ + groupAssetsAsync( + request?: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['groupAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupAssets.asyncIterate( + this.innerApiCalls['groupAssets'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Filters an organization or source's findings and groups them by their + * specified properties. + * + * To group across all sources provide a `-` as the source id. + * Example: /v1beta1/organizations/{organization_id}/sources/-/findings + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]". To groupBy across + * all sources provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * For example, `source_properties.size = 100` is a valid filter string. + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping (including + * `state`). The string value should follow SQL syntax: comma separated list + * of fields. For example: + * "parent,resource_name". + * + * The following fields are supported: + * + * * resource_name + * * category + * * state + * * parent + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1beta1.GroupResult | GroupResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `groupFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + groupFindings( + request?: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IGroupResult[], + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest|null, + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse + ]>; + groupFindings( + request: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IGroupResult>): void; + groupFindings( + request: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IGroupResult>): void; + groupFindings( + request?: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IGroupResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IGroupResult>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IGroupResult[], + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest|null, + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.groupFindings(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]". To groupBy across + * all sources provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * For example, `source_properties.size = 100` is a valid filter string. + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping (including + * `state`). The string value should follow SQL syntax: comma separated list + * of fields. For example: + * "parent,resource_name". + * + * The following fields are supported: + * + * * resource_name + * * category + * * state + * * parent + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1beta1.GroupResult | GroupResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `groupFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + groupFindingsStream( + request?: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['groupFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupFindings.createStream( + this.innerApiCalls.groupFindings as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `groupFindings`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]". To groupBy across + * all sources provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * For example, `source_properties.size = 100` is a valid filter string. + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping (including + * `state`). The string value should follow SQL syntax: comma separated list + * of fields. For example: + * "parent,resource_name". + * + * The following fields are supported: + * + * * resource_name + * * category + * * state + * * parent + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1beta1.GroupResult | GroupResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.group_findings.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GroupFindings_async + */ + groupFindingsAsync( + request?: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['groupFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupFindings.asyncIterate( + this.innerApiCalls['groupFindings'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists an organization's assets. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not 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 Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * For example, `resource_properties.size = 100` is a valid filter string. + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListAssetResult's "state" attribute is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - + * compare_duration) and read_time. + * + * The state value is derived based on the presence of the asset at the two + * points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present before + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * + * If compare_duration is not specified, then the only possible state is + * "UNUSED", which indicates that the asset is present at read_time. + * @param {google.protobuf.FieldMask} [request.fieldMask] + * Optional. A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult | ListAssetsResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAssets( + request?: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[], + protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest|null, + protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse + ]>; + listAssets( + request: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult>): void; + listAssets( + request: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult>): void; + listAssets( + request?: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[], + protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest|null, + protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listAssets(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not 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 Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * For example, `resource_properties.size = 100` is a valid filter string. + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListAssetResult's "state" attribute is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - + * compare_duration) and read_time. + * + * The state value is derived based on the presence of the asset at the two + * points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present before + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * + * If compare_duration is not specified, then the only possible state is + * "UNUSED", which indicates that the asset is present at read_time. + * @param {google.protobuf.FieldMask} [request.fieldMask] + * Optional. A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult | ListAssetsResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAssetsStream( + request?: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssets.createStream( + this.innerApiCalls.listAssets as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAssets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not 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 Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * For example, `resource_properties.size = 100` is a valid filter string. + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListAssetResult's "state" attribute is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - + * compare_duration) and read_time. + * + * The state value is derived based on the presence of the asset at the two + * points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present before + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * + * If compare_duration is not specified, then the only possible state is + * "UNUSED", which indicates that the asset is present at read_time. + * @param {google.protobuf.FieldMask} [request.fieldMask] + * Optional. A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult | ListAssetsResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.list_assets.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_ListAssets_async + */ + listAssetsAsync( + request?: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssets.asyncIterate( + this.innerApiCalls['listAssets'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists an organization or source's findings. + * + * To list across all sources provide a `-` as the source id. + * Example: /v1beta1/organizations/{organization_id}/sources/-/findings + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id]". To list across all + * sources provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * For example, `source_properties.size = 100` is a valid filter string. + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.FieldMask} [request.fieldMask] + * Optional. A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1beta1.Finding | Finding}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFindings( + request?: protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IFinding[], + protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest|null, + protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse + ]>; + listFindings( + request: protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IFinding>): void; + listFindings( + request: protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IFinding>): void; + listFindings( + request?: protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IFinding>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IFinding>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IFinding[], + protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest|null, + protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listFindings(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id]". To list across all + * sources provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * For example, `source_properties.size = 100` is a valid filter string. + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.FieldMask} [request.fieldMask] + * Optional. A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1beta1.Finding | Finding} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFindingsStream( + request?: protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFindings.createStream( + this.innerApiCalls.listFindings as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFindings`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id]". To list across all + * sources provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * For example, `source_properties.size = 100` is a valid filter string. + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.FieldMask} [request.fieldMask] + * Optional. A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1beta1.Finding | Finding}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.list_findings.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_ListFindings_async + */ + listFindingsAsync( + request?: protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFindings.asyncIterate( + this.innerApiCalls['listFindings'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all sources belonging to an organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id]". + * @param {string} request.pageToken + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1beta1.Source | Source}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSourcesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listSources( + request?: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISource[], + protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest|null, + protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse + ]>; + listSources( + request: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.ISource>): void; + listSources( + request: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.ISource>): void; + listSources( + request?: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.ISource>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.ISource>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISource[], + protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest|null, + protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listSources(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id]". + * @param {string} request.pageToken + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1beta1.Source | Source} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSourcesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listSourcesStream( + request?: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSources.createStream( + this.innerApiCalls.listSources as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSources`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id]". + * @param {string} request.pageToken + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1beta1.Source | Source}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.list_sources.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_ListSources_async + */ + listSourcesAsync( + request?: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSources.asyncIterate( + this.innerApiCalls['listSources'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified asset resource name string. + * + * @param {string} organization + * @param {string} asset + * @returns {string} Resource name string. + */ + assetPath(organization:string,asset:string) { + return this.pathTemplates.assetPathTemplate.render({ + organization: organization, + asset: asset, + }); + } + + /** + * Parse the organization from Asset resource. + * + * @param {string} assetName + * A fully-qualified path representing Asset resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromAssetName(assetName: string) { + return this.pathTemplates.assetPathTemplate.match(assetName).organization; + } + + /** + * Parse the asset from Asset resource. + * + * @param {string} assetName + * A fully-qualified path representing Asset resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromAssetName(assetName: string) { + return this.pathTemplates.assetPathTemplate.match(assetName).asset; + } + + /** + * Return a fully-qualified finding resource name string. + * + * @param {string} organization + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + findingPath(organization:string,source:string,finding:string) { + return this.pathTemplates.findingPathTemplate.render({ + organization: organization, + source: source, + finding: finding, + }); + } + + /** + * Parse the organization from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).organization; + } + + /** + * Parse the source from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the source. + */ + matchSourceFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).source; + } + + /** + * Parse the finding from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).finding; + } + + /** + * Return a fully-qualified organization resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationPath(organization:string) { + return this.pathTemplates.organizationPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from Organization resource. + * + * @param {string} organizationName + * A fully-qualified path representing Organization resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationName(organizationName: string) { + return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; + } + + /** + * Return a fully-qualified organizationAssetSecurityMarks resource name string. + * + * @param {string} organization + * @param {string} asset + * @returns {string} Resource name string. + */ + organizationAssetSecurityMarksPath(organization:string,asset:string) { + return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.render({ + organization: organization, + asset: asset, + }); + } + + /** + * Parse the organization from OrganizationAssetSecurityMarks resource. + * + * @param {string} organizationAssetSecurityMarksName + * A fully-qualified path representing organization_asset_securityMarks resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { + return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).organization; + } + + /** + * Parse the asset from OrganizationAssetSecurityMarks resource. + * + * @param {string} organizationAssetSecurityMarksName + * A fully-qualified path representing organization_asset_securityMarks resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { + return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).asset; + } + + /** + * Return a fully-qualified organizationSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationSettingsPath(organization:string) { + return this.pathTemplates.organizationSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationSettings resource. + * + * @param {string} organizationSettingsName + * A fully-qualified path representing OrganizationSettings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { + return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; + } + + /** + * Return a fully-qualified organizationSourceFindingSecurityMarks resource name string. + * + * @param {string} organization + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + organizationSourceFindingSecurityMarksPath(organization:string,source:string,finding:string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render({ + organization: organization, + source: source, + finding: finding, + }); + } + + /** + * Parse the organization from OrganizationSourceFindingSecurityMarks resource. + * + * @param {string} organizationSourceFindingSecurityMarksName + * A fully-qualified path representing organization_source_finding_securityMarks resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).organization; + } + + /** + * Parse the source from OrganizationSourceFindingSecurityMarks resource. + * + * @param {string} organizationSourceFindingSecurityMarksName + * A fully-qualified path representing organization_source_finding_securityMarks resource. + * @returns {string} A string representing the source. + */ + matchSourceFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).source; + } + + /** + * Parse the finding from OrganizationSourceFindingSecurityMarks resource. + * + * @param {string} organizationSourceFindingSecurityMarksName + * A fully-qualified path representing organization_source_finding_securityMarks resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).finding; + } + + /** + * Return a fully-qualified source resource name string. + * + * @param {string} organization + * @param {string} source + * @returns {string} Resource name string. + */ + sourcePath(organization:string,source:string) { + return this.pathTemplates.sourcePathTemplate.render({ + organization: organization, + source: source, + }); + } + + /** + * Parse the organization from Source resource. + * + * @param {string} sourceName + * A fully-qualified path representing Source resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromSourceName(sourceName: string) { + return this.pathTemplates.sourcePathTemplate.match(sourceName).organization; + } + + /** + * Parse the source from Source resource. + * + * @param {string} sourceName + * A fully-qualified path representing Source resource. + * @returns {string} A string representing the source. + */ + matchSourceFromSourceName(sourceName: string) { + return this.pathTemplates.sourcePathTemplate.match(sourceName).source; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.securityCenterStub && !this._terminated) { + return this.securityCenterStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_client_config.json b/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_client_config.json new file mode 100644 index 00000000000..a1a7e2d9386 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_client_config.json @@ -0,0 +1,116 @@ +{ + "interfaces": { + "google.cloud.securitycenter.v1beta1.SecurityCenter": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateSource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFinding": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetOrganizationSettings": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetSource": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GroupAssets": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GroupFindings": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListAssets": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindings": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListSources": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RunAssetDiscovery": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetFindingState": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateFinding": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateOrganizationSettings": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSecurityMarks": { + "timeout_millis": 480000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_proto_list.json b/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_proto_list.json new file mode 100644 index 00000000000..d10dce6c60d --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_proto_list.json @@ -0,0 +1,9 @@ +[ + "../../protos/google/cloud/securitycenter/v1beta1/asset.proto", + "../../protos/google/cloud/securitycenter/v1beta1/finding.proto", + "../../protos/google/cloud/securitycenter/v1beta1/organization_settings.proto", + "../../protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto", + "../../protos/google/cloud/securitycenter/v1beta1/security_marks.proto", + "../../protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto", + "../../protos/google/cloud/securitycenter/v1beta1/source.proto" +] diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..ca4c3d3425f --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const securitycenter = require('@google-cloud/security-center'); + +function main() { + const securityCenterClient = new securitycenter.SecurityCenterClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..323502f7e2f --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {SecurityCenterClient} from '@google-cloud/security-center'; + +// check that the client class type name can be used +function doStuffWithSecurityCenterClient(client: SecurityCenterClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const securityCenterClient = new SecurityCenterClient(); + doStuffWithSecurityCenterClient(securityCenterClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/test/gapic_security_center_v1beta1.ts b/owl-bot-staging/google-cloud-securitycenter/v1beta1/test/gapic_security_center_v1beta1.ts new file mode 100644 index 00000000000..f71f54bd9bc --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/test/gapic_security_center_v1beta1.ts @@ -0,0 +1,3173 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as securitycenterModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta1.SecurityCenterClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = securitycenterModule.v1beta1.SecurityCenterClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = securitycenterModule.v1beta1.SecurityCenterClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = securitycenterModule.v1beta1.SecurityCenterClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.securityCenterStub, undefined); + await client.initialize(); + assert(client.securityCenterStub); + }); + + it('has close method for the initialized client', done => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.securityCenterStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.securityCenterStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('createSource', () => { + it('invokes createSource without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.CreateSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.CreateSourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.Source() + ); + client.innerApiCalls.createSource = stubSimpleCall(expectedResponse); + const [response] = await client.createSource(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSource without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.CreateSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.CreateSourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.Source() + ); + client.innerApiCalls.createSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSource( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSource with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.CreateSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.CreateSourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSource(request), expectedError); + const actualRequest = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSource with closed client', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.CreateSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.CreateSourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSource(request), expectedError); + }); + }); + + describe('createFinding', () => { + it('invokes createFinding without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.CreateFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.CreateFindingRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.Finding() + ); + client.innerApiCalls.createFinding = stubSimpleCall(expectedResponse); + const [response] = await client.createFinding(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFinding without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.CreateFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.CreateFindingRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.Finding() + ); + client.innerApiCalls.createFinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFinding( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFinding with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.CreateFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.CreateFindingRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createFinding(request), expectedError); + const actualRequest = (client.innerApiCalls.createFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFinding with closed client', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.CreateFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.CreateFindingRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createFinding(request), expectedError); + }); + }); + + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIamPolicy without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIamPolicy with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIamPolicy with closed client', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIamPolicy(request), expectedError); + }); + }); + + describe('getOrganizationSettings', () => { + it('invokes getOrganizationSettings without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.OrganizationSettings() + ); + client.innerApiCalls.getOrganizationSettings = stubSimpleCall(expectedResponse); + const [response] = await client.getOrganizationSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOrganizationSettings without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.OrganizationSettings() + ); + client.innerApiCalls.getOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getOrganizationSettings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOrganizationSettings with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getOrganizationSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getOrganizationSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOrganizationSettings with closed client', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getOrganizationSettings(request), expectedError); + }); + }); + + describe('getSource', () => { + it('invokes getSource without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GetSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GetSourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.Source() + ); + client.innerApiCalls.getSource = stubSimpleCall(expectedResponse); + const [response] = await client.getSource(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSource without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GetSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GetSourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.Source() + ); + client.innerApiCalls.getSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSource( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSource with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GetSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GetSourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSource(request), expectedError); + const actualRequest = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSource with closed client', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GetSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GetSourceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSource(request), expectedError); + }); + }); + + describe('setFindingState', () => { + it('invokes setFindingState without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.SetFindingStateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.SetFindingStateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.Finding() + ); + client.innerApiCalls.setFindingState = stubSimpleCall(expectedResponse); + const [response] = await client.setFindingState(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setFindingState without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.SetFindingStateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.SetFindingStateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.Finding() + ); + client.innerApiCalls.setFindingState = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setFindingState( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setFindingState with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.SetFindingStateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.SetFindingStateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setFindingState = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setFindingState(request), expectedError); + const actualRequest = (client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setFindingState with closed client', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.SetFindingStateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.SetFindingStateRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setFindingState(request), expectedError); + }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setIamPolicy without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setIamPolicy with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setIamPolicy with closed client', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setIamPolicy(request), expectedError); + }); + }); + + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsResponse() + ); + client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes testIamPermissions without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsResponse() + ); + client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes testIamPermissions with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request), expectedError); + const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes testIamPermissions with closed client', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.testIamPermissions(request), expectedError); + }); + }); + + describe('updateFinding', () => { + it('invokes updateFinding without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.UpdateFindingRequest() + ); + request.finding ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateFindingRequest', ['finding', 'name']); + request.finding.name = defaultValue1; + const expectedHeaderRequestParams = `finding.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.Finding() + ); + client.innerApiCalls.updateFinding = stubSimpleCall(expectedResponse); + const [response] = await client.updateFinding(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFinding without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.UpdateFindingRequest() + ); + request.finding ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateFindingRequest', ['finding', 'name']); + request.finding.name = defaultValue1; + const expectedHeaderRequestParams = `finding.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.Finding() + ); + client.innerApiCalls.updateFinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFinding( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFinding with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.UpdateFindingRequest() + ); + request.finding ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateFindingRequest', ['finding', 'name']); + request.finding.name = defaultValue1; + const expectedHeaderRequestParams = `finding.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateFinding(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFinding with closed client', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.UpdateFindingRequest() + ); + request.finding ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateFindingRequest', ['finding', 'name']); + request.finding.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateFinding(request), expectedError); + }); + }); + + describe('updateOrganizationSettings', () => { + it('invokes updateOrganizationSettings without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest() + ); + request.organizationSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); + request.organizationSettings.name = defaultValue1; + const expectedHeaderRequestParams = `organization_settings.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.OrganizationSettings() + ); + client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(expectedResponse); + const [response] = await client.updateOrganizationSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateOrganizationSettings without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest() + ); + request.organizationSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); + request.organizationSettings.name = defaultValue1; + const expectedHeaderRequestParams = `organization_settings.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.OrganizationSettings() + ); + client.innerApiCalls.updateOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateOrganizationSettings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateOrganizationSettings with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest() + ); + request.organizationSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); + request.organizationSettings.name = defaultValue1; + const expectedHeaderRequestParams = `organization_settings.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateOrganizationSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateOrganizationSettings with closed client', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest() + ); + request.organizationSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); + request.organizationSettings.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateOrganizationSettings(request), expectedError); + }); + }); + + describe('updateSource', () => { + it('invokes updateSource without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.UpdateSourceRequest() + ); + request.source ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateSourceRequest', ['source', 'name']); + request.source.name = defaultValue1; + const expectedHeaderRequestParams = `source.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.Source() + ); + client.innerApiCalls.updateSource = stubSimpleCall(expectedResponse); + const [response] = await client.updateSource(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSource without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.UpdateSourceRequest() + ); + request.source ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateSourceRequest', ['source', 'name']); + request.source.name = defaultValue1; + const expectedHeaderRequestParams = `source.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.Source() + ); + client.innerApiCalls.updateSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSource( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSource with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.UpdateSourceRequest() + ); + request.source ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateSourceRequest', ['source', 'name']); + request.source.name = defaultValue1; + const expectedHeaderRequestParams = `source.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSource(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSource with closed client', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.UpdateSourceRequest() + ); + request.source ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateSourceRequest', ['source', 'name']); + request.source.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSource(request), expectedError); + }); + }); + + describe('updateSecurityMarks', () => { + it('invokes updateSecurityMarks without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest() + ); + request.securityMarks ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); + request.securityMarks.name = defaultValue1; + const expectedHeaderRequestParams = `security_marks.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.SecurityMarks() + ); + client.innerApiCalls.updateSecurityMarks = stubSimpleCall(expectedResponse); + const [response] = await client.updateSecurityMarks(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSecurityMarks without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest() + ); + request.securityMarks ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); + request.securityMarks.name = defaultValue1; + const expectedHeaderRequestParams = `security_marks.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.SecurityMarks() + ); + client.innerApiCalls.updateSecurityMarks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSecurityMarks( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISecurityMarks|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSecurityMarks with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest() + ); + request.securityMarks ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); + request.securityMarks.name = defaultValue1; + const expectedHeaderRequestParams = `security_marks.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityMarks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSecurityMarks(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSecurityMarks with closed client', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest() + ); + request.securityMarks ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); + request.securityMarks.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSecurityMarks(request), expectedError); + }); + }); + + describe('runAssetDiscovery', () => { + it('invokes runAssetDiscovery without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(expectedResponse); + const [operation] = await client.runAssetDiscovery(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runAssetDiscovery without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.runAssetDiscovery( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runAssetDiscovery with call error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.runAssetDiscovery(request), expectedError); + const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runAssetDiscovery with LRO error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.runAssetDiscovery(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRunAssetDiscoveryProgress without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRunAssetDiscoveryProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRunAssetDiscoveryProgress with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRunAssetDiscoveryProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('groupAssets', () => { + it('invokes groupAssets without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + ]; + client.innerApiCalls.groupAssets = stubSimpleCall(expectedResponse); + const [response] = await client.groupAssets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes groupAssets without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + ]; + client.innerApiCalls.groupAssets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.groupAssets( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IGroupResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes groupAssets with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.groupAssets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.groupAssets(request), expectedError); + const actualRequest = (client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes groupAssetsStream without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + ]; + client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.groupAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.GroupResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); + assert( + (client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes groupAssetsStream with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.groupAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.GroupResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); + assert( + (client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with groupAssets without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + ]; + client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1beta1.IGroupResult[] = []; + const iterable = client.groupAssetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with groupAssets with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.groupAssetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1beta1.IGroupResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('groupFindings', () => { + it('invokes groupFindings without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + ]; + client.innerApiCalls.groupFindings = stubSimpleCall(expectedResponse); + const [response] = await client.groupFindings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes groupFindings without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + ]; + client.innerApiCalls.groupFindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.groupFindings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IGroupResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes groupFindings with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.groupFindings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.groupFindings(request), expectedError); + const actualRequest = (client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes groupFindingsStream without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + ]; + client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.groupFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.GroupResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); + assert( + (client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes groupFindingsStream with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.groupFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.GroupResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); + assert( + (client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with groupFindings without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + ]; + client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1beta1.IGroupResult[] = []; + const iterable = client.groupFindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with groupFindings with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.groupFindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1beta1.IGroupResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listAssets', () => { + it('invokes listAssets without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + ]; + client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); + const [response] = await client.listAssets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssets without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + ]; + client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAssets( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssets with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAssets(request), expectedError); + const actualRequest = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssetsStream without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + ]; + client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); + assert( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAssetsStream with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); + assert( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAssets without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + ]; + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[] = []; + const iterable = client.listAssetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAssets with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAssetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listFindings', () => { + it('invokes listFindings without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + ]; + client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); + const [response] = await client.listFindings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindings without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + ]; + client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IFinding[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindings with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFindings(request), expectedError); + const actualRequest = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingsStream without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + ]; + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.Finding[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.Finding) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFindingsStream with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.Finding[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.Finding) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFindings without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + ]; + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1beta1.IFinding[] = []; + const iterable = client.listFindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFindings with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1beta1.IFinding[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listSources', () => { + it('invokes listSources without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + ]; + client.innerApiCalls.listSources = stubSimpleCall(expectedResponse); + const [response] = await client.listSources(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSources without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + ]; + client.innerApiCalls.listSources = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSources( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISource[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSources with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSources = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSources(request), expectedError); + const actualRequest = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSourcesStream without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + ]; + client.descriptors.page.listSources.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.Source[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.Source) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSources, request)); + assert( + (client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listSourcesStream with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSources.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.Source[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.Source) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSources, request)); + assert( + (client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSources without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + ]; + client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1beta1.ISource[] = []; + const iterable = client.listSourcesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSources with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSourcesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1beta1.ISource[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('asset', () => { + const fakePath = "/rendered/path/asset"; + const expectedParameters = { + organization: "organizationValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.assetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.assetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('assetPath', () => { + const result = client.assetPath("organizationValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.assetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromAssetName', () => { + const result = client.matchOrganizationFromAssetName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromAssetName', () => { + const result = client.matchAssetFromAssetName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('finding', () => { + const fakePath = "/rendered/path/finding"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.findingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.findingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('findingPath', () => { + const result = client.findingPath("organizationValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.findingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromFindingName', () => { + const result = client.matchOrganizationFromFindingName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromFindingName', () => { + const result = client.matchSourceFromFindingName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromFindingName', () => { + const result = client.matchFindingFromFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organization', () => { + const fakePath = "/rendered/path/organization"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationPath', () => { + const result = client.organizationPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationName', () => { + const result = client.matchOrganizationFromOrganizationName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationAssetSecurityMarks', () => { + const fakePath = "/rendered/path/organizationAssetSecurityMarks"; + const expectedParameters = { + organization: "organizationValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAssetSecurityMarksPath', () => { + const result = client.organizationAssetSecurityMarksPath("organizationValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationAssetSecurityMarksName', () => { + const result = client.matchOrganizationFromOrganizationAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromOrganizationAssetSecurityMarksName', () => { + const result = client.matchAssetFromOrganizationAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSettings', () => { + const fakePath = "/rendered/path/organizationSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSettingsPath', () => { + const result = client.organizationSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSettingsName', () => { + const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSourceFindingSecurityMarks', () => { + const fakePath = "/rendered/path/organizationSourceFindingSecurityMarks"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSourceFindingSecurityMarksPath', () => { + const result = client.organizationSourceFindingSecurityMarksPath("organizationValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSourceFindingSecurityMarksName', () => { + const result = client.matchOrganizationFromOrganizationSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromOrganizationSourceFindingSecurityMarksName', () => { + const result = client.matchSourceFromOrganizationSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromOrganizationSourceFindingSecurityMarksName', () => { + const result = client.matchFindingFromOrganizationSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('source', () => { + const fakePath = "/rendered/path/source"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + }; + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sourcePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sourcePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sourcePath', () => { + const result = client.sourcePath("organizationValue", "sourceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sourcePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromSourceName', () => { + const result = client.matchOrganizationFromSourceName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.sourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromSourceName', () => { + const result = client.matchSourceFromSourceName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.sourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/tsconfig.json b/owl-bot-staging/google-cloud-securitycenter/v1beta1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/webpack.config.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/webpack.config.js new file mode 100644 index 00000000000..4aeca8bf63a --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1beta1/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 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 +// +// https://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. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'SecurityCenter', + filename: './security-center.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.eslintignore b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.gitignore b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +/.coverage +/coverage +/.nyc_output +/docs/ +/out/ +/build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.jsdoc.js new file mode 100644 index 00000000000..4d5ad9781e7 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2023 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/security-center', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.mocharc.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/README.md b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/README.md new file mode 100644 index 00000000000..73f34764a12 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/README.md @@ -0,0 +1 @@ +Securitycenter: Nodejs Client diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/linkinator.config.json b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/package.json b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/package.json new file mode 100644 index 00000000000..efcfeb4e7ad --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/security-center", + "version": "0.1.0", + "description": "Securitycenter client for Node.js", + "repository": "googleapis/nodejs-securitycenter", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google securitycenter", + "securitycenter", + "security center" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.5.7" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^4.0.0", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.1.2", + "mocha": "^10.2.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.0.1", + "ts-loader": "^8.4.0", + "typescript": "^4.8.4", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/asset.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/asset.proto new file mode 100644 index 00000000000..df4a093f15f --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/asset.proto @@ -0,0 +1,134 @@ +// Copyright 2021 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1p1beta1/folder.proto"; +import "google/cloud/securitycenter/v1p1beta1/security_marks.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; + +// Security Command Center representation of a Google Cloud +// resource. +// +// The Asset is a Security Command Center resource that captures information +// about a single Google Cloud resource. All modifications to an Asset are only +// within the context of Security Command Center and don't affect the referenced +// Google Cloud resource. +message Asset { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/Asset" + pattern: "organizations/{organization}/assets/{asset}" + pattern: "folders/{folder}/assets/{asset}" + pattern: "projects/{project}/assets/{asset}" + }; + + // Security Command Center managed properties. These properties are managed by + // Security Command Center and cannot be modified by the user. + message SecurityCenterProperties { + // The full resource name of the Google Cloud resource this asset + // represents. This field is immutable after create time. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_name = 1; + + // The type of the Google Cloud resource. Examples include: APPLICATION, + // PROJECT, and ORGANIZATION. This is a case insensitive field defined by + // Security Command Center and/or the producer of the resource and is + // immutable after create time. + string resource_type = 2; + + // The full resource name of the immediate parent of the resource. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_parent = 3; + + // The full resource name of the project the resource belongs to. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_project = 4; + + // Owners of the Google Cloud resource. + repeated string resource_owners = 5; + + // The user defined display name for this resource. + string resource_display_name = 6; + + // The user defined display name for the parent of this resource. + string resource_parent_display_name = 7; + + // The user defined display name for the project of this resource. + string resource_project_display_name = 8; + + // Contains a Folder message for each folder in the assets ancestry. + // The first folder is the deepest nested folder, and the last folder is the + // folder directly under the Organization. + repeated Folder folders = 10; + } + + // Cloud IAM Policy information associated with the Google Cloud resource + // described by the Security Command Center asset. This information is managed + // and defined by the Google Cloud resource and cannot be modified by the + // user. + message IamPolicy { + // The JSON representation of the Policy associated with the asset. + // See https://cloud.google.com/iam/docs/reference/rest/v1/Policy for + // format details. + string policy_blob = 1; + } + + // The relative resource name of this asset. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/assets/{asset_id}". + string name = 1; + + // Security Command Center managed properties. These properties are managed by + // Security Command Center and cannot be modified by the user. + SecurityCenterProperties security_center_properties = 2; + + // Resource managed properties. These properties are managed and defined by + // the Google Cloud resource and cannot be modified by the user. + map resource_properties = 7; + + // User specified security marks. These marks are entirely managed by the user + // and come from the SecurityMarks resource that belongs to the asset. + SecurityMarks security_marks = 8; + + // The time at which the asset was created in Security Command Center. + google.protobuf.Timestamp create_time = 9; + + // The time at which the asset was last updated or added in Cloud SCC. + google.protobuf.Timestamp update_time = 10; + + // Cloud IAM Policy information associated with the Google Cloud resource + // described by the Security Command Center asset. This information is managed + // and defined by the Google Cloud resource and cannot be modified by the + // user. + IamPolicy iam_policy = 11; + + // The canonical name of the resource. It's either + // "organizations/{organization_id}/assets/{asset_id}", + // "folders/{folder_id}/assets/{asset_id}" or + // "projects/{project_number}/assets/{asset_id}", depending on the closest CRM + // ancestor of the resource. + string canonical_name = 13; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/finding.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/finding.proto new file mode 100644 index 00000000000..f88034bb5ad --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/finding.proto @@ -0,0 +1,145 @@ +// Copyright 2021 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1p1beta1/security_marks.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; + +// Security Command Center finding. +// +// A finding is a record of assessment data (security, risk, health or privacy) +// ingested into Security Command Center for presentation, notification, +// analysis, policy testing, and enforcement. For example, an XSS vulnerability +// in an App Engine application is a finding. +message Finding { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/Finding" + pattern: "organizations/{organization}/sources/{source}/findings/{finding}" + pattern: "folders/{folder}/sources/{source}/findings/{finding}" + pattern: "projects/{project}/sources/{source}/findings/{finding}" + }; + + // The state of the finding. + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // The finding requires attention and has not been addressed yet. + ACTIVE = 1; + + // The finding has been fixed, triaged as a non-issue or otherwise addressed + // and is no longer active. + INACTIVE = 2; + } + + // The severity of the finding. This field is managed by the source that + // writes the finding. + enum Severity { + // No severity specified. The default value. + SEVERITY_UNSPECIFIED = 0; + + // Critical severity. + CRITICAL = 1; + + // High severity. + HIGH = 2; + + // Medium severity. + MEDIUM = 3; + + // Low severity. + LOW = 4; + } + + // The relative resource name of this finding. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}" + string name = 1; + + // The relative resource name of the source the finding belongs to. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // This field is immutable after creation time. + // For example: + // "organizations/{organization_id}/sources/{source_id}" + string parent = 2; + + // For findings on Google Cloud resources, the full resource + // name of the Google Cloud resource this finding is for. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + // When the finding is for a non-Google Cloud resource, the resourceName can + // be a customer or partner defined string. This field is immutable after + // creation time. + string resource_name = 3; + + // The state of the finding. + State state = 4; + + // The additional taxonomy group within findings from a given source. + // This field is immutable after creation time. + // Example: "XSS_FLASH_INJECTION" + string category = 5; + + // The URI that, if available, points to a web page outside of Security + // Command Center where additional information about the finding can be found. + // This field is guaranteed to be either empty or a well formed URL. + string external_uri = 6; + + // Source specific properties. These properties are managed by the source + // that writes the finding. The key names in the source_properties map must be + // between 1 and 255 characters, and must start with a letter and contain + // alphanumeric characters or underscores only. + map source_properties = 7; + + // Output only. User specified security marks. These marks are entirely + // managed by the user and come from the SecurityMarks resource that belongs + // to the finding. + SecurityMarks security_marks = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The time at which the event took place, or when an update to the finding + // occurred. For example, if the finding represents an open firewall it would + // capture the time the detector believes the firewall became open. The + // accuracy is determined by the detector. If the finding were to be resolved + // afterward, this time would reflect when the finding was resolved. Must not + // be set to a value greater than the current timestamp. + google.protobuf.Timestamp event_time = 9; + + // The time at which the finding was created in Security Command Center. + google.protobuf.Timestamp create_time = 10; + + // The severity of the finding. This field is managed by the source that + // writes the finding. + Severity severity = 13; + + // The canonical name of the finding. It's either + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", + // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}" or + // "projects/{project_number}/sources/{source_id}/findings/{finding_id}", + // depending on the closest CRM ancestor of the resource associated with the + // finding. + string canonical_name = 14; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/folder.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/folder.proto new file mode 100644 index 00000000000..c94f2da69a6 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/folder.proto @@ -0,0 +1,37 @@ +// Copyright 2021 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "FolderProto"; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1Beta1"; + +// Message that contains the resource name and display name of a folder +// resource. +message Folder { + // Full resource name of this folder. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_folder = 1; + + // The user defined display name for this folder. + string resource_folder_display_name = 2; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto new file mode 100644 index 00000000000..87f2dbbc683 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto @@ -0,0 +1,107 @@ +// Copyright 2021 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Topic" + pattern: "projects/{project}/topics/{topic}" +}; + +// Security Command Center notification configs. +// +// A notification config is a Security Command Center resource that contains the +// configuration to send notifications for create/update events of findings, +// assets and etc. +message NotificationConfig { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/NotificationConfig" + pattern: "organizations/{organization}/notificationConfigs/{notification_config}" + }; + + // The config for streaming-based notifications, which send each event as soon + // as it is detected. + message StreamingConfig { + // Expression that defines the filter to apply across create/update events + // of assets or findings as specified by the event type. 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. + string filter = 1; + } + + // The type of events. + enum EventType { + // Unspecified event type. + EVENT_TYPE_UNSPECIFIED = 0; + + // Events for findings. + FINDING = 1; + } + + // The relative resource name of this notification config. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/notificationConfigs/notify_public_bucket". + string name = 1; + + // The description of the notification config (max of 1024 characters). + string description = 2; + + // The type of events the config is for, e.g. FINDING. + EventType event_type = 3; + + // The Pub/Sub topic to send notifications to. Its format is + // "projects/[project_id]/topics/[topic]". + string pubsub_topic = 4 [(google.api.resource_reference) = { + type: "pubsub.googleapis.com/Topic" + }]; + + // Output only. The service account that needs "pubsub.topics.publish" + // permission to publish to the Pub/Sub topic. + string service_account = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The config for triggering notifications. + oneof notify_config { + // The config for triggering streaming-based notifications. + StreamingConfig streaming_config = 6; + } +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto new file mode 100644 index 00000000000..eb1c43a5778 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto @@ -0,0 +1,43 @@ +// Copyright 2021 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/cloud/securitycenter/v1p1beta1/finding.proto"; +import "google/cloud/securitycenter/v1p1beta1/resource.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; + +// Security Command Center's Notification +message NotificationMessage { + // Name of the notification config that generated current notification. + string notification_config_name = 1; + + // Notification Event. + oneof event { + // If it's a Finding based notification config, this field will be + // populated. + Finding finding = 2; + } + + // The Cloud resource tied to the notification. + Resource resource = 3; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto new file mode 100644 index 00000000000..b4d26c907a2 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto @@ -0,0 +1,85 @@ +// Copyright 2021 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; + +// User specified settings that are attached to the Security Command +// Center organization. +message OrganizationSettings { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/OrganizationSettings" + pattern: "organizations/{organization}/organizationSettings" + }; + + // The configuration used for Asset Discovery runs. + message AssetDiscoveryConfig { + // The mode of inclusion when running Asset Discovery. + // Asset discovery can be limited by explicitly identifying projects to be + // included or excluded. If INCLUDE_ONLY is set, then only those projects + // within the organization and their children are discovered during asset + // discovery. If EXCLUDE is set, then projects that don't match those + // projects are discovered during asset discovery. If neither are set, then + // all projects within the organization are discovered during asset + // discovery. + enum InclusionMode { + // Unspecified. Setting the mode with this value will disable + // inclusion/exclusion filtering for Asset Discovery. + INCLUSION_MODE_UNSPECIFIED = 0; + + // Asset Discovery will capture only the resources within the projects + // specified. All other resources will be ignored. + INCLUDE_ONLY = 1; + + // Asset Discovery will ignore all resources under the projects specified. + // All other resources will be retrieved. + EXCLUDE = 2; + } + + // The project ids to use for filtering asset discovery. + repeated string project_ids = 1; + + // The mode to use for filtering asset discovery. + InclusionMode inclusion_mode = 2; + + // The folder ids to use for filtering asset discovery. + // It consists of only digits, e.g., 756619654966. + repeated string folder_ids = 3; + } + + // The relative resource name of the settings. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/organizationSettings". + string name = 1; + + // A flag that indicates if Asset Discovery should be enabled. If the flag is + // set to `true`, then discovery of assets will occur. If it is set to `false, + // all historical assets will remain, but discovery of future assets will not + // occur. + bool enable_asset_discovery = 2; + + // The configuration used for Asset Discovery runs. + AssetDiscoveryConfig asset_discovery_config = 3; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/resource.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/resource.proto new file mode 100644 index 00000000000..fd1ef2e266e --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/resource.proto @@ -0,0 +1,52 @@ +// Copyright 2021 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/api/field_behavior.proto"; +import "google/cloud/securitycenter/v1p1beta1/folder.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "ResourceProto"; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; + +// Information related to the Google Cloud resource. +message Resource { + // The full resource name of the resource. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string name = 1; + + // The full resource name of project that the resource belongs to. + string project = 2; + + // The human readable name of project that the resource belongs to. + string project_display_name = 3; + + // The full resource name of resource's parent. + string parent = 4; + + // The human readable name of resource's parent. + string parent_display_name = 5; + + // Output only. Contains a Folder message for each folder in the assets ancestry. + // The first folder is the deepest nested folder, and the last folder is the + // folder directly under the Organization. + repeated Folder folders = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto new file mode 100644 index 00000000000..96c4f1d1459 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto @@ -0,0 +1,51 @@ +// Copyright 2021 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/protobuf/duration.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; + +// Response of asset discovery run +message RunAssetDiscoveryResponse { + // The state of an asset discovery run. + enum State { + // Asset discovery run state was unspecified. + STATE_UNSPECIFIED = 0; + + // Asset discovery run completed successfully. + COMPLETED = 1; + + // Asset discovery run was cancelled with tasks still pending, as another + // run for the same organization was started with a higher priority. + SUPERSEDED = 2; + + // Asset discovery run was killed and terminated. + TERMINATED = 3; + } + + // The state of an asset discovery run. + State state = 1; + + // The duration between asset discovery run start and end + google.protobuf.Duration duration = 2; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto new file mode 100644 index 00000000000..52762b5be34 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto @@ -0,0 +1,69 @@ +// Copyright 2021 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; + +// User specified security marks that are attached to the parent Security +// Command Center resource. Security marks are scoped within a Security Command +// Center organization -- they can be modified and viewed by all users who have +// proper permissions on the organization. +message SecurityMarks { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/SecurityMarks" + pattern: "organizations/{organization}/assets/{asset}/securityMarks" + pattern: "organizations/{organization}/sources/{source}/findings/{finding}/securityMarks" + pattern: "folders/{folder}/assets/{asset}/securityMarks" + pattern: "projects/{project}/assets/{asset}/securityMarks" + pattern: "folders/{folder}/sources/{source}/findings/{finding}/securityMarks" + pattern: "projects/{project}/sources/{source}/findings/{finding}/securityMarks" + }; + + // The relative resource name of the SecurityMarks. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Examples: + // "organizations/{organization_id}/assets/{asset_id}/securityMarks" + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks". + string name = 1; + + // Mutable user specified security marks belonging to the parent resource. + // Constraints are as follows: + // + // * Keys and values are treated as case insensitive + // * Keys must be between 1 - 256 characters (inclusive) + // * Keys must be letters, numbers, underscores, or dashes + // * Values have leading and trailing whitespace trimmed, remaining + // characters must be between 1 - 4096 characters (inclusive) + map marks = 2; + + // The canonical name of the marks. + // Examples: + // "organizations/{organization_id}/assets/{asset_id}/securityMarks" + // "folders/{folder_id}/assets/{asset_id}/securityMarks" + // "projects/{project_number}/assets/{asset_id}/securityMarks" + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks" + // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}/securityMarks" + // "projects/{project_number}/sources/{source_id}/findings/{finding_id}/securityMarks" + string canonical_name = 3; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto new file mode 100644 index 00000000000..b2fae10eebf --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto @@ -0,0 +1,1351 @@ +// Copyright 2021 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import public "google/cloud/securitycenter/v1p1beta1/notification_message.proto"; +import public "google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto"; +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1p1beta1/asset.proto"; +import "google/cloud/securitycenter/v1p1beta1/finding.proto"; +import "google/cloud/securitycenter/v1p1beta1/folder.proto"; +import "google/cloud/securitycenter/v1p1beta1/notification_config.proto"; +import "google/cloud/securitycenter/v1p1beta1/organization_settings.proto"; +import "google/cloud/securitycenter/v1p1beta1/security_marks.proto"; +import "google/cloud/securitycenter/v1p1beta1/source.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; + +// V1p1Beta1 APIs for Security Center service. +service SecurityCenter { + option (google.api.default_host) = "securitycenter.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a source. + rpc CreateSource(CreateSourceRequest) returns (Source) { + option (google.api.http) = { + post: "/v1p1beta1/{parent=organizations/*}/sources" + body: "source" + }; + option (google.api.method_signature) = "parent,source"; + } + + // Creates a finding. The corresponding source must exist for finding + // creation to succeed. + rpc CreateFinding(CreateFindingRequest) returns (Finding) { + option (google.api.http) = { + post: "/v1p1beta1/{parent=organizations/*/sources/*}/findings" + body: "finding" + }; + option (google.api.method_signature) = "parent,finding_id,finding"; + option (google.api.method_signature) = "parent,finding,finding_id"; + } + + // Creates a notification config. + rpc CreateNotificationConfig(CreateNotificationConfigRequest) returns (NotificationConfig) { + option (google.api.http) = { + post: "/v1p1beta1/{parent=organizations/*}/notificationConfigs" + body: "notification_config" + }; + option (google.api.method_signature) = "parent,config_id,notification_config"; + option (google.api.method_signature) = "parent,notification_config"; + } + + // Deletes a notification config. + rpc DeleteNotificationConfig(DeleteNotificationConfigRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1p1beta1/{name=organizations/*/notificationConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets the access control policy on the specified Source. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1p1beta1/{resource=organizations/*/sources/*}:getIamPolicy" + body: "*" + }; + option (google.api.method_signature) = "resource"; + } + + // Gets a notification config. + rpc GetNotificationConfig(GetNotificationConfigRequest) returns (NotificationConfig) { + option (google.api.http) = { + get: "/v1p1beta1/{name=organizations/*/notificationConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets the settings for an organization. + rpc GetOrganizationSettings(GetOrganizationSettingsRequest) returns (OrganizationSettings) { + option (google.api.http) = { + get: "/v1p1beta1/{name=organizations/*/organizationSettings}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a source. + rpc GetSource(GetSourceRequest) returns (Source) { + option (google.api.http) = { + get: "/v1p1beta1/{name=organizations/*/sources/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Filters an organization's assets and groups them by their specified + // properties. + rpc GroupAssets(GroupAssetsRequest) returns (GroupAssetsResponse) { + option (google.api.http) = { + post: "/v1p1beta1/{parent=organizations/*}/assets:group" + body: "*" + additional_bindings { + post: "/v1p1beta1/{parent=folders/*}/assets:group" + body: "*" + } + additional_bindings { + post: "/v1p1beta1/{parent=projects/*}/assets:group" + body: "*" + } + }; + } + + // Filters an organization or source's findings and groups them by their + // specified properties. + // + // To group across all sources provide a `-` as the source id. + // Example: /v1/organizations/{organization_id}/sources/-/findings, + // /v1/folders/{folder_id}/sources/-/findings, + // /v1/projects/{project_id}/sources/-/findings + rpc GroupFindings(GroupFindingsRequest) returns (GroupFindingsResponse) { + option (google.api.http) = { + post: "/v1p1beta1/{parent=organizations/*/sources/*}/findings:group" + body: "*" + additional_bindings { + post: "/v1p1beta1/{parent=folders/*/sources/*}/findings:group" + body: "*" + } + additional_bindings { + post: "/v1p1beta1/{parent=projects/*/sources/*}/findings:group" + body: "*" + } + }; + option (google.api.method_signature) = "parent,group_by"; + } + + // Lists an organization's assets. + rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { + option (google.api.http) = { + get: "/v1p1beta1/{parent=organizations/*}/assets" + additional_bindings { + get: "/v1p1beta1/{parent=folders/*}/assets" + } + additional_bindings { + get: "/v1p1beta1/{parent=projects/*}/assets" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Lists an organization or source's findings. + // + // To list across all sources provide a `-` as the source id. + // Example: /v1p1beta1/organizations/{organization_id}/sources/-/findings + rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { + option (google.api.http) = { + get: "/v1p1beta1/{parent=organizations/*/sources/*}/findings" + additional_bindings { + get: "/v1p1beta1/{parent=folders/*/sources/*}/findings" + } + additional_bindings { + get: "/v1p1beta1/{parent=projects/*/sources/*}/findings" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Lists notification configs. + rpc ListNotificationConfigs(ListNotificationConfigsRequest) returns (ListNotificationConfigsResponse) { + option (google.api.http) = { + get: "/v1p1beta1/{parent=organizations/*}/notificationConfigs" + }; + option (google.api.method_signature) = "parent"; + } + + // Lists all sources belonging to an organization. + rpc ListSources(ListSourcesRequest) returns (ListSourcesResponse) { + option (google.api.http) = { + get: "/v1p1beta1/{parent=organizations/*}/sources" + additional_bindings { + get: "/v1p1beta1/{parent=folders/*}/sources" + } + additional_bindings { + get: "/v1p1beta1/{parent=projects/*}/sources" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Runs asset discovery. The discovery is tracked with a long-running + // operation. + // + // This API can only be called with limited frequency for an organization. If + // it is called too frequently the caller will receive a TOO_MANY_REQUESTS + // error. + rpc RunAssetDiscovery(RunAssetDiscoveryRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1p1beta1/{parent=organizations/*}/assets:runDiscovery" + body: "*" + }; + option (google.api.method_signature) = "parent"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryResponse" + metadata_type: "google.protobuf.Empty" + }; + } + + // Updates the state of a finding. + rpc SetFindingState(SetFindingStateRequest) returns (Finding) { + option (google.api.http) = { + post: "/v1p1beta1/{name=organizations/*/sources/*/findings/*}:setState" + body: "*" + additional_bindings { + post: "/v1p1beta1/{name=folders/*/sources/*/findings/*}:setState" + body: "*" + } + additional_bindings { + post: "/v1p1beta1/{name=projects/*/sources/*/findings/*}:setState" + body: "*" + } + }; + option (google.api.method_signature) = "name,state,start_time"; + } + + // Sets the access control policy on the specified Source. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1p1beta1/{resource=organizations/*/sources/*}:setIamPolicy" + body: "*" + }; + option (google.api.method_signature) = "resource,policy"; + } + + // Returns the permissions that a caller has on the specified source. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1p1beta1/{resource=organizations/*/sources/*}:testIamPermissions" + body: "*" + }; + option (google.api.method_signature) = "resource,permissions"; + } + + // Creates or updates a finding. The corresponding source must exist for a + // finding creation to succeed. + rpc UpdateFinding(UpdateFindingRequest) returns (Finding) { + option (google.api.http) = { + patch: "/v1p1beta1/{finding.name=organizations/*/sources/*/findings/*}" + body: "finding" + additional_bindings { + patch: "/v1p1beta1/{finding.name=folders/*/sources/*/findings/*}" + body: "finding" + } + additional_bindings { + patch: "/v1p1beta1/{finding.name=projects/*/sources/*/findings/*}" + body: "finding" + } + }; + option (google.api.method_signature) = "finding"; + option (google.api.method_signature) = "finding,update_mask"; + } + + // Updates a notification config. The following update + // fields are allowed: description, pubsub_topic, streaming_config.filter + rpc UpdateNotificationConfig(UpdateNotificationConfigRequest) returns (NotificationConfig) { + option (google.api.http) = { + patch: "/v1p1beta1/{notification_config.name=organizations/*/notificationConfigs/*}" + body: "notification_config" + }; + option (google.api.method_signature) = "notification_config"; + option (google.api.method_signature) = "notification_config,update_mask"; + } + + // Updates an organization's settings. + rpc UpdateOrganizationSettings(UpdateOrganizationSettingsRequest) returns (OrganizationSettings) { + option (google.api.http) = { + patch: "/v1p1beta1/{organization_settings.name=organizations/*/organizationSettings}" + body: "organization_settings" + }; + option (google.api.method_signature) = "organization_settings"; + } + + // Updates a source. + rpc UpdateSource(UpdateSourceRequest) returns (Source) { + option (google.api.http) = { + patch: "/v1p1beta1/{source.name=organizations/*/sources/*}" + body: "source" + }; + option (google.api.method_signature) = "source"; + option (google.api.method_signature) = "source,update_mask"; + } + + // Updates security marks. + rpc UpdateSecurityMarks(UpdateSecurityMarksRequest) returns (SecurityMarks) { + option (google.api.http) = { + patch: "/v1p1beta1/{security_marks.name=organizations/*/assets/*/securityMarks}" + body: "security_marks" + additional_bindings { + patch: "/v1p1beta1/{security_marks.name=folders/*/assets/*/securityMarks}" + body: "security_marks" + } + additional_bindings { + patch: "/v1p1beta1/{security_marks.name=projects/*/assets/*/securityMarks}" + body: "security_marks" + } + additional_bindings { + patch: "/v1p1beta1/{security_marks.name=organizations/*/sources/*/findings/*/securityMarks}" + body: "security_marks" + } + additional_bindings { + patch: "/v1p1beta1/{security_marks.name=folders/*/sources/*/findings/*/securityMarks}" + body: "security_marks" + } + additional_bindings { + patch: "/v1p1beta1/{security_marks.name=projects/*/sources/*/findings/*/securityMarks}" + body: "security_marks" + } + }; + option (google.api.method_signature) = "security_marks"; + option (google.api.method_signature) = "security_marks,update_mask"; + } +} + +// Request message for creating a finding. +message CreateFindingRequest { + // Required. Resource name of the new finding's parent. Its format should be + // "organizations/[organization_id]/sources/[source_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; + + // Required. Unique identifier provided by the client within the parent scope. + string finding_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Finding being created. The name and security_marks will be ignored as + // they are both output only fields on this resource. + Finding finding = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for creating a notification config. +message CreateNotificationConfigRequest { + // Required. Resource name of the new notification config's parent. Its format is + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // Required. Unique identifier provided by the client within the parent scope. + // It must be between 1 and 128 characters, and contains alphanumeric + // characters, underscores or hyphens only. + string config_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The notification config being created. The name and the service account + // will be ignored as they are both output only fields on this resource. + NotificationConfig notification_config = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for creating a source. +message CreateSourceRequest { + // Required. Resource name of the new source's parent. Its format should be + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // Required. The Source being created, only the display_name and description will be + // used. All other fields will be ignored. + Source source = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for deleting a notification config. +message DeleteNotificationConfigRequest { + // Required. Name of the notification config to delete. Its format is + // "organizations/[organization_id]/notificationConfigs/[config_id]". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/NotificationConfig" + } + ]; +} + +// Request message for getting a notification config. +message GetNotificationConfigRequest { + // Required. Name of the notification config to get. Its format is + // "organizations/[organization_id]/notificationConfigs/[config_id]". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/NotificationConfig" + } + ]; +} + +// Request message for getting organization settings. +message GetOrganizationSettingsRequest { + // Required. Name of the organization to get organization settings for. Its format is + // "organizations/[organization_id]/organizationSettings". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/OrganizationSettings" + } + ]; +} + +// Request message for getting a source. +message GetSourceRequest { + // Required. Relative resource name of the source. Its format is + // "organizations/[organization_id]/source/[source_id]". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; +} + +// Request message for grouping by assets. +message GroupAssetsRequest { + // Required. Name of the organization to groupBy. Its format is + // "organizations/[organization_id], folders/[folder_id], or + // projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/Asset" + } + ]; + + // Expression that defines the filter to apply across assets. + // 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 Asset resource. Examples include: + // + // * name + // * security_center_properties.resource_name + // * resource_properties.a_property + // * security_marks.marks.marka + // + // 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. + // + // The following field and operator combinations are supported: + // + // * name: `=` + // * update_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `update_time = "2019-06-10T16:07:18-07:00"` + // `update_time = 1560208038000` + // + // * create_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `create_time = "2019-06-10T16:07:18-07:00"` + // `create_time = 1560208038000` + // + // * iam_policy.policy_blob: `=`, `:` + // * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + // * security_marks.marks: `=`, `:` + // * security_center_properties.resource_name: `=`, `:` + // * security_center_properties.resource_name_display_name: `=`, `:` + // * security_center_properties.resource_type: `=`, `:` + // * security_center_properties.resource_parent: `=`, `:` + // * security_center_properties.resource_parent_display_name: `=`, `:` + // * security_center_properties.resource_project: `=`, `:` + // * security_center_properties.resource_project_display_name: `=`, `:` + // * security_center_properties.resource_owners: `=`, `:` + // + // For example, `resource_properties.size = 100` is a valid filter string. + // + // Use a partial match on the empty string to filter based on a property + // existing: `resource_properties.my_property : ""` + // + // Use a negated partial match on the empty string to filter based on a + // property not existing: `-resource_properties.my_property : ""` + string filter = 2; + + // Required. Expression that defines what assets fields to use for grouping. The string + // value should follow SQL syntax: comma separated list of fields. For + // example: + // "security_center_properties.resource_project,security_center_properties.project". + // + // The following fields are supported when compare_duration is not set: + // + // * security_center_properties.resource_project + // * security_center_properties.resource_project_display_name + // * security_center_properties.resource_type + // * security_center_properties.resource_parent + // * security_center_properties.resource_parent_display_name + // + // The following fields are supported when compare_duration is set: + // + // * security_center_properties.resource_type + // * security_center_properties.resource_project_display_name + // * security_center_properties.resource_parent_display_name + string group_by = 3 [(google.api.field_behavior) = REQUIRED]; + + // When compare_duration is set, the GroupResult's "state_change" property is + // updated to indicate whether the asset was added, removed, or remained + // present during the compare_duration period of time that precedes the + // read_time. This is the time between (read_time - compare_duration) and + // read_time. + // + // The state change value is derived based on the presence of the asset at the + // two points in time. Intermediate state changes between the two times don't + // affect the result. For example, the results aren't affected if the asset is + // removed and re-created again. + // + // Possible "state_change" values when compare_duration is specified: + // + // * "ADDED": indicates that the asset was not present at the start of + // compare_duration, but present at reference_time. + // * "REMOVED": indicates that the asset was present at the start of + // compare_duration, but not present at reference_time. + // * "ACTIVE": indicates that the asset was present at both the + // start and the end of the time period defined by + // compare_duration and reference_time. + // + // If compare_duration is not specified, then the only possible state_change + // is "UNUSED", which will be the state_change set for all assets present at + // read_time. + // + // If this field is set then `state_change` must be a specified field in + // `group_by`. + google.protobuf.Duration compare_duration = 4; + + // Time used as a reference point when filtering assets. The filter is limited + // to assets existing at the supplied time and their values are those at that + // specific time. Absence of this field will default to the API's version of + // NOW. + google.protobuf.Timestamp read_time = 5; + + // The value returned by the last `GroupAssetsResponse`; indicates + // that this is a continuation of a prior `GroupAssets` call, and that the + // system should return the next page of data. + string page_token = 7; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 8; +} + +// Response message for grouping by assets. +message GroupAssetsResponse { + // Group results. There exists an element for each existing unique + // combination of property/values. The element contains a count for the number + // of times those specific property/values appear. + repeated GroupResult group_by_results = 1; + + // Time used for executing the groupBy request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of results matching the query. + int32 total_size = 4; +} + +// Request message for grouping by findings. +message GroupFindingsRequest { + // Required. Name of the source to groupBy. Its format is + // "organizations/[organization_id]/sources/[source_id]", + // folders/[folder_id]/sources/[source_id], or + // projects/[project_id]/sources/[source_id]. To groupBy across all sources + // provide a source_id of `-`. For example: + // organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + // or projects/{project_id}/sources/- + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; + + // Expression that defines the filter to apply across findings. + // The expression is a list of one 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. Examples include: + // + // * name + // * source_properties.a_property + // * security_marks.marks.marka + // + // 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. + // + // The following field and operator combinations are supported: + // + // * name: `=` + // * parent: `=`, `:` + // * resource_name: `=`, `:` + // * state: `=`, `:` + // * category: `=`, `:` + // * external_uri: `=`, `:` + // * event_time: `=`, `>`, `<`, `>=`, `<=` + // * severity: `=`, `:` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `event_time = "2019-06-10T16:07:18-07:00"` + // `event_time = 1560208038000` + // + // * security_marks.marks: `=`, `:` + // * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + // + // For example, `source_properties.size = 100` is a valid filter string. + // + // Use a partial match on the empty string to filter based on a property + // existing: `source_properties.my_property : ""` + // + // Use a negated partial match on the empty string to filter based on a + // property not existing: `-source_properties.my_property : ""` + string filter = 2; + + // Required. Expression that defines what assets fields to use for grouping (including + // `state_change`). The string value should follow SQL syntax: comma separated + // list of fields. For example: "parent,resource_name". + // + // The following fields are supported: + // + // * resource_name + // * category + // * state + // * parent + // * severity + // + // The following fields are supported when compare_duration is set: + // + // * state_change + string group_by = 3 [(google.api.field_behavior) = REQUIRED]; + + // Time used as a reference point when filtering findings. The filter is + // limited to findings existing at the supplied time and their values are + // those at that specific time. Absence of this field will default to the + // API's version of NOW. + google.protobuf.Timestamp read_time = 4; + + // When compare_duration is set, the GroupResult's "state_change" attribute is + // updated to indicate whether the finding had its state changed, the + // finding's state remained unchanged, or if the finding was added during the + // compare_duration period of time that precedes the read_time. This is the + // time between (read_time - compare_duration) and read_time. + // + // The state_change value is derived based on the presence and state of the + // finding at the two points in time. Intermediate state changes between the + // two times don't affect the result. For example, the results aren't affected + // if the finding is made inactive and then active again. + // + // Possible "state_change" values when compare_duration is specified: + // + // * "CHANGED": indicates that the finding was present and matched the given + // filter at the start of compare_duration, but changed its + // state at read_time. + // * "UNCHANGED": indicates that the finding was present and matched the given + // filter at the start of compare_duration and did not change + // state at read_time. + // * "ADDED": indicates that the finding did not match the given filter or + // was not present at the start of compare_duration, but was + // present at read_time. + // * "REMOVED": indicates that the finding was present and matched the + // filter at the start of compare_duration, but did not match + // the filter at read_time. + // + // If compare_duration is not specified, then the only possible state_change + // is "UNUSED", which will be the state_change set for all findings present + // at read_time. + // + // If this field is set then `state_change` must be a specified field in + // `group_by`. + google.protobuf.Duration compare_duration = 5; + + // The value returned by the last `GroupFindingsResponse`; indicates + // that this is a continuation of a prior `GroupFindings` call, and + // that the system should return the next page of data. + string page_token = 7; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 8; +} + +// Response message for group by findings. +message GroupFindingsResponse { + // Group results. There exists an element for each existing unique + // combination of property/values. The element contains a count for the number + // of times those specific property/values appear. + repeated GroupResult group_by_results = 1; + + // Time used for executing the groupBy request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of results matching the query. + int32 total_size = 4; +} + +// Result containing the properties and count of a groupBy request. +message GroupResult { + // Properties matching the groupBy fields in the request. + map properties = 1; + + // Total count of resources for the given properties. + int64 count = 2; +} + +// Request message for listing notification configs. +message ListNotificationConfigsRequest { + // Required. Name of the organization to list notification configs. + // Its format is "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // The value returned by the last `ListNotificationConfigsResponse`; indicates + // that this is a continuation of a prior `ListNotificationConfigs` call, and + // that the system should return the next page of data. + string page_token = 2; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 3; +} + +// Response message for listing notification configs. +message ListNotificationConfigsResponse { + // Notification configs belonging to the requested parent. + repeated NotificationConfig notification_configs = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 2; +} + +// Request message for listing sources. +message ListSourcesRequest { + // Required. Resource name of the parent of sources to list. Its format should be + // "organizations/[organization_id], folders/[folder_id], or + // projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/Source" + } + ]; + + // The value returned by the last `ListSourcesResponse`; indicates + // that this is a continuation of a prior `ListSources` call, and + // that the system should return the next page of data. + string page_token = 2; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 7; +} + +// Response message for listing sources. +message ListSourcesResponse { + // Sources belonging to the requested parent. + repeated Source sources = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 2; +} + +// Request message for listing assets. +message ListAssetsRequest { + // Required. Name of the organization assets should belong to. Its format is + // "organizations/[organization_id], folders/[folder_id], or + // projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/Asset" + } + ]; + + // Expression that defines the filter to apply across assets. + // 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 Asset resource. Examples include: + // + // * name + // * security_center_properties.resource_name + // * resource_properties.a_property + // * security_marks.marks.marka + // + // 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. + // + // The following are the allowed field and operator combinations: + // + // * name: `=` + // * update_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `update_time = "2019-06-10T16:07:18-07:00"` + // `update_time = 1560208038000` + // + // * create_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `create_time = "2019-06-10T16:07:18-07:00"` + // `create_time = 1560208038000` + // + // * iam_policy.policy_blob: `=`, `:` + // * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + // * security_marks.marks: `=`, `:` + // * security_center_properties.resource_name: `=`, `:` + // * security_center_properties.resource_display_name: `=`, `:` + // * security_center_properties.resource_type: `=`, `:` + // * security_center_properties.resource_parent: `=`, `:` + // * security_center_properties.resource_parent_display_name: `=`, `:` + // * security_center_properties.resource_project: `=`, `:` + // * security_center_properties.resource_project_display_name: `=`, `:` + // * security_center_properties.resource_owners: `=`, `:` + // + // For example, `resource_properties.size = 100` is a valid filter string. + // + // Use a partial match on the empty string to filter based on a property + // existing: `resource_properties.my_property : ""` + // + // Use a negated partial match on the empty string to filter based on a + // property not existing: `-resource_properties.my_property : ""` + string filter = 2; + + // Expression that defines what fields and order to use for sorting. The + // string value should follow SQL syntax: comma separated list of fields. For + // example: "name,resource_properties.a_property". The default sorting order + // is ascending. To specify descending order for a field, a suffix " desc" + // should be appended to the field name. For example: "name + // desc,resource_properties.a_property". Redundant space characters in the + // syntax are insignificant. "name desc,resource_properties.a_property" and " + // name desc , resource_properties.a_property " are equivalent. + // + // The following fields are supported: + // name + // update_time + // resource_properties + // security_marks.marks + // security_center_properties.resource_name + // security_center_properties.resource_display_name + // security_center_properties.resource_parent + // security_center_properties.resource_parent_display_name + // security_center_properties.resource_project + // security_center_properties.resource_project_display_name + // security_center_properties.resource_type + string order_by = 3; + + // Time used as a reference point when filtering assets. The filter is limited + // to assets existing at the supplied time and their values are those at that + // specific time. Absence of this field will default to the API's version of + // NOW. + google.protobuf.Timestamp read_time = 4; + + // When compare_duration is set, the ListAssetsResult's "state_change" + // attribute is updated to indicate whether the asset was added, removed, or + // remained present during the compare_duration period of time that precedes + // the read_time. This is the time between (read_time - compare_duration) and + // read_time. + // + // The state_change value is derived based on the presence of the asset at the + // two points in time. Intermediate state changes between the two times don't + // affect the result. For example, the results aren't affected if the asset is + // removed and re-created again. + // + // Possible "state_change" values when compare_duration is specified: + // + // * "ADDED": indicates that the asset was not present at the start of + // compare_duration, but present at read_time. + // * "REMOVED": indicates that the asset was present at the start of + // compare_duration, but not present at read_time. + // * "ACTIVE": indicates that the asset was present at both the + // start and the end of the time period defined by + // compare_duration and read_time. + // + // If compare_duration is not specified, then the only possible state_change + // is "UNUSED", which will be the state_change set for all assets present at + // read_time. + google.protobuf.Duration compare_duration = 5; + + // A field mask to specify the ListAssetsResult fields to be listed in the + // response. + // An empty field mask will list all fields. + google.protobuf.FieldMask field_mask = 7; + + // The value returned by the last `ListAssetsResponse`; indicates + // that this is a continuation of a prior `ListAssets` call, and + // that the system should return the next page of data. + string page_token = 8; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 9; +} + +// Response message for listing assets. +message ListAssetsResponse { + // Result containing the Asset and its State. + message ListAssetsResult { + // The change in state of the asset. + // + // When querying across two points in time this describes + // the change between the two points: ADDED, REMOVED, or ACTIVE. + // If there was no compare_duration supplied in the request the state change + // will be: UNUSED + enum StateChange { + // State change is unused, this is the canonical default for this enum. + UNUSED = 0; + + // Asset was added between the points in time. + ADDED = 1; + + // Asset was removed between the points in time. + REMOVED = 2; + + // Asset was present at both point(s) in time. + ACTIVE = 3; + } + + // Asset matching the search request. + Asset asset = 1; + + // State change of the asset between the points in time. + StateChange state_change = 2; + } + + // Assets matching the list request. + repeated ListAssetsResult list_assets_results = 1; + + // Time used for executing the list request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of assets matching the query. + int32 total_size = 4; +} + +// Request message for listing findings. +message ListFindingsRequest { + // Required. Name of the source the findings belong to. Its format is + // "organizations/[organization_id]/sources/[source_id], + // folders/[folder_id]/sources/[source_id], or + // projects/[project_id]/sources/[source_id]". To list across all sources + // provide a source_id of `-`. For example: + // organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + // projects/{projects_id}/sources/- + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; + + // Expression that defines the filter to apply across findings. + // The expression is a list of one 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. Examples include: + // + // * name + // * source_properties.a_property + // * security_marks.marks.marka + // + // 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. + // + // The following field and operator combinations are supported: + // + // * name: `=` + // * parent: `=`, `:` + // * resource_name: `=`, `:` + // * state: `=`, `:` + // * category: `=`, `:` + // * external_uri: `=`, `:` + // * event_time: `=`, `>`, `<`, `>=`, `<=` + // * severity: `=`, `:` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `event_time = "2019-06-10T16:07:18-07:00"` + // `event_time = 1560208038000` + // + // security_marks.marks: `=`, `:` + // source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + // + // For example, `source_properties.size = 100` is a valid filter string. + // + // Use a partial match on the empty string to filter based on a property + // existing: `source_properties.my_property : ""` + // + // Use a negated partial match on the empty string to filter based on a + // property not existing: `-source_properties.my_property : ""` + string filter = 2; + + // Expression that defines what fields and order to use for sorting. The + // string value should follow SQL syntax: comma separated list of fields. For + // example: "name,resource_properties.a_property". The default sorting order + // is ascending. To specify descending order for a field, a suffix " desc" + // should be appended to the field name. For example: "name + // desc,source_properties.a_property". Redundant space characters in the + // syntax are insignificant. "name desc,source_properties.a_property" and " + // name desc , source_properties.a_property " are equivalent. + // + // The following fields are supported: + // name + // parent + // state + // category + // resource_name + // event_time + // source_properties + // security_marks.marks + string order_by = 3; + + // Time used as a reference point when filtering findings. The filter is + // limited to findings existing at the supplied time and their values are + // those at that specific time. Absence of this field will default to the + // API's version of NOW. + google.protobuf.Timestamp read_time = 4; + + // When compare_duration is set, the ListFindingsResult's "state_change" + // attribute is updated to indicate whether the finding had its state changed, + // the finding's state remained unchanged, or if the finding was added in any + // state during the compare_duration period of time that precedes the + // read_time. This is the time between (read_time - compare_duration) and + // read_time. + // + // The state_change value is derived based on the presence and state of the + // finding at the two points in time. Intermediate state changes between the + // two times don't affect the result. For example, the results aren't affected + // if the finding is made inactive and then active again. + // + // Possible "state_change" values when compare_duration is specified: + // + // * "CHANGED": indicates that the finding was present and matched the given + // filter at the start of compare_duration, but changed its + // state at read_time. + // * "UNCHANGED": indicates that the finding was present and matched the given + // filter at the start of compare_duration and did not change + // state at read_time. + // * "ADDED": indicates that the finding did not match the given filter or + // was not present at the start of compare_duration, but was + // present at read_time. + // * "REMOVED": indicates that the finding was present and matched the + // filter at the start of compare_duration, but did not match + // the filter at read_time. + // + // If compare_duration is not specified, then the only possible state_change + // is "UNUSED", which will be the state_change set for all findings present at + // read_time. + google.protobuf.Duration compare_duration = 5; + + // A field mask to specify the Finding fields to be listed in the response. + // An empty field mask will list all fields. + google.protobuf.FieldMask field_mask = 7; + + // The value returned by the last `ListFindingsResponse`; indicates + // that this is a continuation of a prior `ListFindings` call, and + // that the system should return the next page of data. + string page_token = 8; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 9; +} + +// Response message for listing findings. +message ListFindingsResponse { + // Result containing the Finding and its StateChange. + message ListFindingsResult { + // Information related to the Google Cloud resource that is + // associated with this finding. + message Resource { + // The full resource name of the resource. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string name = 1; + + // The full resource name of project that the resource belongs to. + string project_name = 2; + + // The human readable name of project that the resource belongs to. + string project_display_name = 3; + + // The full resource name of resource's parent. + string parent_name = 4; + + // The human readable name of resource's parent. + string parent_display_name = 5; + + // Contains a Folder message for each folder in the assets ancestry. + // The first folder is the deepest nested folder, and the last folder is + // the folder directly under the Organization. + repeated Folder folders = 10; + } + + // The change in state of the finding. + // + // When querying across two points in time this describes + // the change in the finding between the two points: CHANGED, UNCHANGED, + // ADDED, or REMOVED. Findings can not be deleted, so REMOVED implies that + // the finding at timestamp does not match the filter specified, but it did + // at timestamp - compare_duration. If there was no compare_duration + // supplied in the request the state change will be: UNUSED + enum StateChange { + // State change is unused, this is the canonical default for this enum. + UNUSED = 0; + + // The finding has changed state in some way between the points in time + // and existed at both points. + CHANGED = 1; + + // The finding has not changed state between the points in time and + // existed at both points. + UNCHANGED = 2; + + // The finding was created between the points in time. + ADDED = 3; + + // The finding at timestamp does not match the filter specified, but it + // did at timestamp - compare_duration. + REMOVED = 4; + } + + // Finding matching the search request. + Finding finding = 1; + + // State change of the finding between the points in time. + StateChange state_change = 2; + + // Output only. Resource that is associated with this finding. + Resource resource = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Findings matching the list request. + repeated ListFindingsResult list_findings_results = 1; + + // Time used for executing the list request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of findings matching the query. + int32 total_size = 4; +} + +// Request message for updating a finding's state. +message SetFindingStateRequest { + // Required. The relative resource name of the finding. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Finding" + } + ]; + + // Required. The desired State of the finding. + Finding.State state = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The time at which the updated state takes effect. + google.protobuf.Timestamp start_time = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for running asset discovery for an organization. +message RunAssetDiscoveryRequest { + // Required. Name of the organization to run asset discovery for. Its format is + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; +} + +// Request message for updating or creating a finding. +message UpdateFindingRequest { + // Required. The finding resource to update or create if it does not already exist. + // parent, security_marks, and update_time will be ignored. + // + // In the case of creation, the finding id portion of the name must be + // alphanumeric and less than or equal to 32 characters and greater than 0 + // characters in length. + Finding finding = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the finding resource. This field should + // not be specified when creating a finding. + // + // When updating a finding, an empty mask is treated as updating all mutable + // fields and replacing source_properties. Individual source_properties can + // be added/updated by using "source_properties." in the field + // mask. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating a notification config. +message UpdateNotificationConfigRequest { + // Required. The notification config to update. + NotificationConfig notification_config = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the notification config. + // + // If empty all mutable fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating an organization's settings. +message UpdateOrganizationSettingsRequest { + // Required. The organization settings resource to update. + OrganizationSettings organization_settings = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the settings resource. + // + // If empty all mutable fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating a source. +message UpdateSourceRequest { + // Required. The source resource to update. + Source source = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the source resource. + // + // If empty all mutable fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating a SecurityMarks resource. +message UpdateSecurityMarksRequest { + // Required. The security marks resource to update. + SecurityMarks security_marks = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the security marks resource. + // + // The field mask must not contain duplicate fields. + // If empty or set to "marks", all marks will be replaced. Individual + // marks can be updated using "marks.". + google.protobuf.FieldMask update_mask = 2; + + // The time at which the updated SecurityMarks take effect. + // If not set uses current server time. Updates will be applied to the + // SecurityMarks that are active immediately preceding this time. + google.protobuf.Timestamp start_time = 3; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/source.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/source.proto new file mode 100644 index 00000000000..bcbc5e62a87 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/source.proto @@ -0,0 +1,68 @@ +// Copyright 2021 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. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; + +// Security Command Center finding source. A finding source +// is an entity or a mechanism that can produce a finding. A source is like a +// container of findings that come from the same scanner, logger, monitor, etc. +message Source { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/Source" + pattern: "organizations/{organization}/sources/{source}" + pattern: "folders/{folder}/sources/{source}" + pattern: "projects/{project}/sources/{source}" + }; + + // The relative resource name of this source. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/sources/{source_id}" + string name = 1; + + // The source's display name. + // A source's display name must be unique amongst its siblings, for example, + // two sources with the same parent can't share the same display name. + // The display name must have a length between 1 and 64 characters + // (inclusive). + string display_name = 2; + + // The description of the source (max of 1024 characters). + // Example: + // "Web Security Scanner is a web security scanner for common + // vulnerabilities in App Engine applications. It can automatically + // scan and detect four common vulnerabilities, including cross-site-scripting + // (XSS), Flash injection, mixed content (HTTP in HTTPS), and + // outdated/insecure libraries." + string description = 3; + + // The canonical name of the finding. It's either + // "organizations/{organization_id}/sources/{source_id}", + // "folders/{folder_id}/sources/{source_id}" or + // "projects/{project_number}/sources/{source_id}", + // depending on the closest CRM ancestor of the resource associated with the + // finding. + string canonical_name = 14; +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_finding.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_finding.js new file mode 100644 index 00000000000..3df65f018d4 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_finding.js @@ -0,0 +1,73 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, findingId, finding) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_CreateFinding_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new finding's parent. Its format should be + * "organizations/[organization_id]/sources/[source_id]". + */ + // const parent = 'abc123' + /** + * Required. Unique identifier provided by the client within the parent scope. + */ + // const findingId = 'abc123' + /** + * Required. The Finding being created. The name and security_marks will be ignored as + * they are both output only fields on this resource. + */ + // const finding = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateFinding() { + // Construct request + const request = { + parent, + findingId, + finding, + }; + + // Run request + const response = await securitycenterClient.createFinding(request); + console.log(response); + } + + callCreateFinding(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_CreateFinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_notification_config.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_notification_config.js new file mode 100644 index 00000000000..5768d3580d4 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_notification_config.js @@ -0,0 +1,75 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, configId, notificationConfig) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_CreateNotificationConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new notification config's parent. Its format is + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + /** + * Required. Unique identifier provided by the client within the parent scope. + * It must be between 1 and 128 characters, and contains alphanumeric + * characters, underscores or hyphens only. + */ + // const configId = 'abc123' + /** + * Required. The notification config being created. The name and the service account + * will be ignored as they are both output only fields on this resource. + */ + // const notificationConfig = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateNotificationConfig() { + // Construct request + const request = { + parent, + configId, + notificationConfig, + }; + + // Run request + const response = await securitycenterClient.createNotificationConfig(request); + console.log(response); + } + + callCreateNotificationConfig(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_CreateNotificationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_source.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_source.js new file mode 100644 index 00000000000..6f5123ca148 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_source.js @@ -0,0 +1,68 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, source) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_CreateSource_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new source's parent. Its format should be + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + /** + * Required. The Source being created, only the display_name and description will be + * used. All other fields will be ignored. + */ + // const source = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateSource() { + // Construct request + const request = { + parent, + source, + }; + + // Run request + const response = await securitycenterClient.createSource(request); + console.log(response); + } + + callCreateSource(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_CreateSource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.delete_notification_config.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.delete_notification_config.js new file mode 100644 index 00000000000..b1d0cb91463 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.delete_notification_config.js @@ -0,0 +1,62 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_DeleteNotificationConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the notification config to delete. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callDeleteNotificationConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.deleteNotificationConfig(request); + console.log(response); + } + + callDeleteNotificationConfig(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_DeleteNotificationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_iam_policy.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_iam_policy.js new file mode 100644 index 00000000000..85423c33d91 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_iam_policy.js @@ -0,0 +1,67 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_GetIamPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + */ + // const options = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await securitycenterClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_GetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_notification_config.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_notification_config.js new file mode 100644 index 00000000000..d72744e6dc5 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_notification_config.js @@ -0,0 +1,62 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_GetNotificationConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the notification config to get. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetNotificationConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getNotificationConfig(request); + console.log(response); + } + + callGetNotificationConfig(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_GetNotificationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_organization_settings.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_organization_settings.js new file mode 100644 index 00000000000..5e2c2ddc9e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_organization_settings.js @@ -0,0 +1,62 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_GetOrganizationSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to get organization settings for. Its format is + * "organizations/[organization_id]/organizationSettings". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetOrganizationSettings() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getOrganizationSettings(request); + console.log(response); + } + + callGetOrganizationSettings(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_GetOrganizationSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_source.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_source.js new file mode 100644 index 00000000000..03fb8bcc620 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_source.js @@ -0,0 +1,62 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_GetSource_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Relative resource name of the source. Its format is + * "organizations/[organization_id]/source/[source_id]". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetSource() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getSource(request); + console.log(response); + } + + callGetSource(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_GetSource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.group_assets.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.group_assets.js new file mode 100644 index 00000000000..be3d0814d8b --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.group_assets.js @@ -0,0 +1,176 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, groupBy) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_GroupAssets_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across assets. + * 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 Asset resource. Examples include: + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * 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. + * The following field and operator combinations are supported: + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_name_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * For example, `resource_properties.size = 100` is a valid filter string. + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + */ + // const filter = 'abc123' + /** + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * The following fields are supported when compare_duration is not set: + * * security_center_properties.resource_project + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * * security_center_properties.resource_parent_display_name + * The following fields are supported when compare_duration is set: + * * security_center_properties.resource_type + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_parent_display_name + */ + // const groupBy = 'abc123' + /** + * When compare_duration is set, the GroupResult's "state_change" property is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * The state change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * Possible "state_change" values when compare_duration is specified: + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * If this field is set then `state_change` must be a specified field in + * `group_by`. + */ + // const compareDuration = {} + /** + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + */ + // const readTime = {} + /** + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGroupAssets() { + // Construct request + const request = { + parent, + groupBy, + }; + + // Run request + const iterable = await securitycenterClient.groupAssetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callGroupAssets(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_GroupAssets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.group_findings.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.group_findings.js new file mode 100644 index 00000000000..c5a599abd19 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.group_findings.js @@ -0,0 +1,172 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, groupBy) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_GroupFindings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]", + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]. To groupBy across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + * or projects/{project_id}/sources/- + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across findings. + * The expression is a list of one 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. Examples include: + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * 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. + * The following field and operator combinations are supported: + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * * severity: `=`, `:` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * For example, `source_properties.size = 100` is a valid filter string. + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + */ + // const filter = 'abc123' + /** + * Required. Expression that defines what assets fields to use for grouping (including + * `state_change`). The string value should follow SQL syntax: comma separated + * list of fields. For example: "parent,resource_name". + * The following fields are supported: + * * resource_name + * * category + * * state + * * parent + * * severity + * The following fields are supported when compare_duration is set: + * * state_change + */ + // const groupBy = 'abc123' + /** + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + */ + // const readTime = {} + /** + * When compare_duration is set, the GroupResult's "state_change" attribute is + * updated to indicate whether the finding had its state changed, the + * finding's state remained unchanged, or if the finding was added during the + * compare_duration period of time that precedes the read_time. This is the + * time between (read_time - compare_duration) and read_time. + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * Possible "state_change" values when compare_duration is specified: + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present + * at read_time. + * If this field is set then `state_change` must be a specified field in + * `group_by`. + */ + // const compareDuration = {} + /** + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGroupFindings() { + // Construct request + const request = { + parent, + groupBy, + }; + + // Run request + const iterable = await securitycenterClient.groupFindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callGroupFindings(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_GroupFindings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_assets.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_assets.js new file mode 100644 index 00000000000..1115296d82a --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_assets.js @@ -0,0 +1,185 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_ListAssets_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across assets. + * 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 Asset resource. Examples include: + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * 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. + * The following are the allowed field and operator combinations: + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * For example, `resource_properties.size = 100` is a valid filter string. + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + */ + // const filter = 'abc123' + /** + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * The following fields are supported: + * name + * update_time + * resource_properties + * security_marks.marks + * security_center_properties.resource_name + * security_center_properties.resource_display_name + * security_center_properties.resource_parent + * security_center_properties.resource_parent_display_name + * security_center_properties.resource_project + * security_center_properties.resource_project_display_name + * security_center_properties.resource_type + */ + // const orderBy = 'abc123' + /** + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + */ + // const readTime = {} + /** + * When compare_duration is set, the ListAssetsResult's "state_change" + * attribute is updated to indicate whether the asset was added, removed, or + * remained present during the compare_duration period of time that precedes + * the read_time. This is the time between (read_time - compare_duration) and + * read_time. + * The state_change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * Possible "state_change" values when compare_duration is specified: + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + */ + // const compareDuration = {} + /** + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + */ + // const fieldMask = {} + /** + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListAssets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listAssetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAssets(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_ListAssets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_findings.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_findings.js new file mode 100644 index 00000000000..7aec1ebd9da --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_findings.js @@ -0,0 +1,181 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_ListFindings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id], + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]". To list across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + * projects/{projects_id}/sources/- + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across findings. + * The expression is a list of one 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. Examples include: + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * 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. + * The following field and operator combinations are supported: + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * * severity: `=`, `:` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * security_marks.marks: `=`, `:` + * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * For example, `source_properties.size = 100` is a valid filter string. + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + */ + // const filter = 'abc123' + /** + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * The following fields are supported: + * name + * parent + * state + * category + * resource_name + * event_time + * source_properties + * security_marks.marks + */ + // const orderBy = 'abc123' + /** + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + */ + // const readTime = {} + /** + * When compare_duration is set, the ListFindingsResult's "state_change" + * attribute is updated to indicate whether the finding had its state changed, + * the finding's state remained unchanged, or if the finding was added in any + * state during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * Possible "state_change" values when compare_duration is specified: + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present at + * read_time. + */ + // const compareDuration = {} + /** + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + */ + // const fieldMask = {} + /** + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListFindings() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listFindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFindings(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_ListFindings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_notification_configs.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_notification_configs.js new file mode 100644 index 00000000000..f5b4a970498 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_notification_configs.js @@ -0,0 +1,75 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_ListNotificationConfigs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to list notification configs. + * Its format is "organizations/[organization_id]". + */ + // const parent = 'abc123' + /** + * The value returned by the last `ListNotificationConfigsResponse`; indicates + * that this is a continuation of a prior `ListNotificationConfigs` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListNotificationConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listNotificationConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListNotificationConfigs(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_ListNotificationConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_sources.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_sources.js new file mode 100644 index 00000000000..62e89a0b967 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_sources.js @@ -0,0 +1,76 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_ListSources_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + */ + // const parent = 'abc123' + /** + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListSources() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listSourcesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSources(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_ListSources_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.run_asset_discovery.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.run_asset_discovery.js new file mode 100644 index 00000000000..753137e4768 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.run_asset_discovery.js @@ -0,0 +1,63 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to run asset discovery for. Its format is + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callRunAssetDiscovery() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await securitycenterClient.runAssetDiscovery(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRunAssetDiscovery(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.set_finding_state.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.set_finding_state.js new file mode 100644 index 00000000000..d3441869f8e --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.set_finding_state.js @@ -0,0 +1,74 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, state, startTime) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_SetFindingState_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the finding. See: + * https://cloud.google.com/apis/design/resource_names#relative_resource_name + * Example: + * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". + */ + // const name = 'abc123' + /** + * Required. The desired State of the finding. + */ + // const state = {} + /** + * Required. The time at which the updated state takes effect. + */ + // const startTime = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callSetFindingState() { + // Construct request + const request = { + name, + state, + startTime, + }; + + // Run request + const response = await securitycenterClient.setFindingState(request); + console.log(response); + } + + callSetFindingState(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_SetFindingState_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.set_iam_policy.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.set_iam_policy.js new file mode 100644 index 00000000000..e131922facc --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.set_iam_policy.js @@ -0,0 +1,77 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource, policy) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_SetIamPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + */ + // const policy = {} + /** + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * `paths: "bindings, etag"` + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await securitycenterClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_SetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.test_iam_permissions.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.test_iam_permissions.js new file mode 100644 index 00000000000..4d9bbb4d4cc --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.test_iam_permissions.js @@ -0,0 +1,70 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource, permissions) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_TestIamPermissions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). + */ + // const permissions = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await securitycenterClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_TestIamPermissions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_finding.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_finding.js new file mode 100644 index 00000000000..119392f721a --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_finding.js @@ -0,0 +1,74 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(finding) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateFinding_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The finding resource to update or create if it does not already exist. + * parent, security_marks, and update_time will be ignored. + * In the case of creation, the finding id portion of the name must be + * alphanumeric and less than or equal to 32 characters and greater than 0 + * characters in length. + */ + // const finding = {} + /** + * The FieldMask to use when updating the finding resource. This field should + * not be specified when creating a finding. + * When updating a finding, an empty mask is treated as updating all mutable + * fields and replacing source_properties. Individual source_properties can + * be added/updated by using "source_properties." in the field + * mask. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateFinding() { + // Construct request + const request = { + finding, + }; + + // Run request + const response = await securitycenterClient.updateFinding(request); + console.log(response); + } + + callUpdateFinding(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateFinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_notification_config.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_notification_config.js new file mode 100644 index 00000000000..27fc14769eb --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_notification_config.js @@ -0,0 +1,66 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(notificationConfig) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateNotificationConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The notification config to update. + */ + // const notificationConfig = {} + /** + * The FieldMask to use when updating the notification config. + * If empty all mutable fields will be updated. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateNotificationConfig() { + // Construct request + const request = { + notificationConfig, + }; + + // Run request + const response = await securitycenterClient.updateNotificationConfig(request); + console.log(response); + } + + callUpdateNotificationConfig(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateNotificationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_organization_settings.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_organization_settings.js new file mode 100644 index 00000000000..c0ce463a1bd --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_organization_settings.js @@ -0,0 +1,66 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(organizationSettings) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The organization settings resource to update. + */ + // const organizationSettings = {} + /** + * The FieldMask to use when updating the settings resource. + * If empty all mutable fields will be updated. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateOrganizationSettings() { + // Construct request + const request = { + organizationSettings, + }; + + // Run request + const response = await securitycenterClient.updateOrganizationSettings(request); + console.log(response); + } + + callUpdateOrganizationSettings(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_security_marks.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_security_marks.js new file mode 100644 index 00000000000..bd99d48ec65 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_security_marks.js @@ -0,0 +1,74 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(securityMarks) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSecurityMarks_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The security marks resource to update. + */ + // const securityMarks = {} + /** + * The FieldMask to use when updating the security marks resource. + * The field mask must not contain duplicate fields. + * If empty or set to "marks", all marks will be replaced. Individual + * marks can be updated using "marks.". + */ + // const updateMask = {} + /** + * The time at which the updated SecurityMarks take effect. + * If not set uses current server time. Updates will be applied to the + * SecurityMarks that are active immediately preceding this time. + */ + // const startTime = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateSecurityMarks() { + // Construct request + const request = { + securityMarks, + }; + + // Run request + const response = await securitycenterClient.updateSecurityMarks(request); + console.log(response); + } + + callUpdateSecurityMarks(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSecurityMarks_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_source.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_source.js new file mode 100644 index 00000000000..c005661cf71 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_source.js @@ -0,0 +1,66 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(source) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSource_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The source resource to update. + */ + // const source = {} + /** + * The FieldMask to use when updating the source resource. + * If empty all mutable fields will be updated. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateSource() { + // Construct request + const request = { + source, + }; + + // Run request + const response = await securitycenterClient.updateSource(request); + console.log(response); + } + + callUpdateSource(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json new file mode 100644 index 00000000000..73ceda373e3 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json @@ -0,0 +1,1123 @@ +{ + "clientLibrary": { + "name": "nodejs-securitycenter", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.securitycenter.v1p1beta1", + "version": "v1p1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_CreateSource_async", + "title": "SecurityCenter createSource Sample", + "origin": "API_DEFINITION", + "description": " Creates a source.", + "canonical": true, + "file": "security_center.create_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSource", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateSource", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "source", + "type": ".google.cloud.securitycenter.v1p1beta1.Source" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.Source", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateSource", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateSource", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_CreateFinding_async", + "title": "SecurityCenter createFinding Sample", + "origin": "API_DEFINITION", + "description": " Creates a finding. The corresponding source must exist for finding creation to succeed.", + "canonical": true, + "file": "security_center.create_finding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFinding", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateFinding", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "finding_id", + "type": "TYPE_STRING" + }, + { + "name": "finding", + "type": ".google.cloud.securitycenter.v1p1beta1.Finding" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateFinding", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateFinding", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_CreateNotificationConfig_async", + "title": "SecurityCenter createNotificationConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a notification config.", + "canonical": true, + "file": "security_center.create_notification_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateNotificationConfig", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateNotificationConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "config_id", + "type": "TYPE_STRING" + }, + { + "name": "notification_config", + "type": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateNotificationConfig", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateNotificationConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_DeleteNotificationConfig_async", + "title": "SecurityCenter deleteNotificationConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes a notification config.", + "canonical": true, + "file": "security_center.delete_notification_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteNotificationConfig", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.DeleteNotificationConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "DeleteNotificationConfig", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.DeleteNotificationConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GetIamPolicy_async", + "title": "SecurityCenter getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the access control policy on the specified Source.", + "canonical": true, + "file": "security_center.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetIamPolicy", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GetNotificationConfig_async", + "title": "SecurityCenter getNotificationConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a notification config.", + "canonical": true, + "file": "security_center.get_notification_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNotificationConfig", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetNotificationConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GetNotificationConfig", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetNotificationConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GetOrganizationSettings_async", + "title": "SecurityCenter getOrganizationSettings Sample", + "origin": "API_DEFINITION", + "description": " Gets the settings for an organization.", + "canonical": true, + "file": "security_center.get_organization_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetOrganizationSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.OrganizationSettings", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GetOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetOrganizationSettings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GetSource_async", + "title": "SecurityCenter getSource Sample", + "origin": "API_DEFINITION", + "description": " Gets a source.", + "canonical": true, + "file": "security_center.get_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSource", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetSource", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.Source", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GetSource", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetSource", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GroupAssets_async", + "title": "SecurityCenter groupAssets Sample", + "origin": "API_DEFINITION", + "description": " Filters an organization's assets and groups them by their specified properties.", + "canonical": true, + "file": "security_center.group_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 168, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GroupAssets", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GroupAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "group_by", + "type": "TYPE_STRING" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.GroupAssetsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GroupAssets", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GroupAssets", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GroupFindings_async", + "title": "SecurityCenter groupFindings Sample", + "origin": "API_DEFINITION", + "description": " Filters an organization or source's findings and groups them by their specified properties. To group across all sources provide a `-` as the source id. Example: /v1/organizations/{organization_id}/sources/-/findings, /v1/folders/{folder_id}/sources/-/findings, /v1/projects/{project_id}/sources/-/findings", + "canonical": true, + "file": "security_center.group_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 164, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GroupFindings", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GroupFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "group_by", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.GroupFindingsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GroupFindings", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GroupFindings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_ListAssets_async", + "title": "SecurityCenter listAssets Sample", + "origin": "API_DEFINITION", + "description": " Lists an organization's assets.", + "canonical": true, + "file": "security_center.list_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 177, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAssets", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.ListAssetsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "ListAssets", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListAssets", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_ListFindings_async", + "title": "SecurityCenter listFindings Sample", + "origin": "API_DEFINITION", + "description": " Lists an organization or source's findings. To list across all sources provide a `-` as the source id. Example: /v1p1beta1/organizations/{organization_id}/sources/-/findings", + "canonical": true, + "file": "security_center.list_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 173, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFindings", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.ListFindingsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "ListFindings", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListFindings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_ListNotificationConfigs_async", + "title": "SecurityCenter listNotificationConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists notification configs.", + "canonical": true, + "file": "security_center.list_notification_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNotificationConfigs", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListNotificationConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "ListNotificationConfigs", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListNotificationConfigs", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_ListSources_async", + "title": "SecurityCenter listSources Sample", + "origin": "API_DEFINITION", + "description": " Lists all sources belonging to an organization.", + "canonical": true, + "file": "security_center.list_sources.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSources", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListSources", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.ListSourcesResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "ListSources", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListSources", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async", + "title": "SecurityCenter runAssetDiscovery Sample", + "origin": "API_DEFINITION", + "description": " Runs asset discovery. The discovery is tracked with a long-running operation. This API can only be called with limited frequency for an organization. If it is called too frequently the caller will receive a TOO_MANY_REQUESTS error.", + "canonical": true, + "file": "security_center.run_asset_discovery.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RunAssetDiscovery", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.RunAssetDiscovery", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "RunAssetDiscovery", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.RunAssetDiscovery", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_SetFindingState_async", + "title": "SecurityCenter setFindingState Sample", + "origin": "API_DEFINITION", + "description": " Updates the state of a finding.", + "canonical": true, + "file": "security_center.set_finding_state.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetFindingState", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.SetFindingState", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "state", + "type": ".google.cloud.securitycenter.v1p1beta1.Finding.State" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "SetFindingState", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.SetFindingState", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_SetIamPolicy_async", + "title": "SecurityCenter setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the access control policy on the specified Source.", + "canonical": true, + "file": "security_center.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.SetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "policy", + "type": ".google.iam.v1.Policy" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.SetIamPolicy", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_TestIamPermissions_async", + "title": "SecurityCenter testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Returns the permissions that a caller has on the specified source.", + "canonical": true, + "file": "security_center.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.TestIamPermissions", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateFinding_async", + "title": "SecurityCenter updateFinding Sample", + "origin": "API_DEFINITION", + "description": " Creates or updates a finding. The corresponding source must exist for a finding creation to succeed.", + "canonical": true, + "file": "security_center.update_finding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFinding", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateFinding", + "async": true, + "parameters": [ + { + "name": "finding", + "type": ".google.cloud.securitycenter.v1p1beta1.Finding" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateFinding", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateFinding", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateNotificationConfig_async", + "title": "SecurityCenter updateNotificationConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates a notification config. The following update fields are allowed: description, pubsub_topic, streaming_config.filter", + "canonical": true, + "file": "security_center.update_notification_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateNotificationConfig", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateNotificationConfig", + "async": true, + "parameters": [ + { + "name": "notification_config", + "type": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateNotificationConfig", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateNotificationConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async", + "title": "SecurityCenter updateOrganizationSettings Sample", + "origin": "API_DEFINITION", + "description": " Updates an organization's settings.", + "canonical": true, + "file": "security_center.update_organization_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateOrganizationSettings", + "async": true, + "parameters": [ + { + "name": "organization_settings", + "type": ".google.cloud.securitycenter.v1p1beta1.OrganizationSettings" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.OrganizationSettings", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateOrganizationSettings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSource_async", + "title": "SecurityCenter updateSource Sample", + "origin": "API_DEFINITION", + "description": " Updates a source.", + "canonical": true, + "file": "security_center.update_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSource", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateSource", + "async": true, + "parameters": [ + { + "name": "source", + "type": ".google.cloud.securitycenter.v1p1beta1.Source" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.Source", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateSource", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateSource", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSecurityMarks_async", + "title": "SecurityCenter updateSecurityMarks Sample", + "origin": "API_DEFINITION", + "description": " Updates security marks.", + "canonical": true, + "file": "security_center.update_security_marks.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSecurityMarks", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateSecurityMarks", + "async": true, + "parameters": [ + { + "name": "security_marks", + "type": ".google.cloud.securitycenter.v1p1beta1.SecurityMarks" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.SecurityMarks", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateSecurityMarks", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateSecurityMarks", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/index.ts b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/index.ts new file mode 100644 index 00000000000..ad859b27d19 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1p1beta1 from './v1p1beta1'; +const SecurityCenterClient = v1p1beta1.SecurityCenterClient; +type SecurityCenterClient = v1p1beta1.SecurityCenterClient; +export {v1p1beta1, SecurityCenterClient}; +export default {v1p1beta1, SecurityCenterClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/gapic_metadata.json new file mode 100644 index 00000000000..c0d8ccc6990 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/gapic_metadata.json @@ -0,0 +1,277 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.securitycenter.v1p1beta1", + "libraryPackage": "@google-cloud/security-center", + "services": { + "SecurityCenter": { + "clients": { + "grpc": { + "libraryClient": "SecurityCenterClient", + "rpcs": { + "CreateSource": { + "methods": [ + "createSource" + ] + }, + "CreateFinding": { + "methods": [ + "createFinding" + ] + }, + "CreateNotificationConfig": { + "methods": [ + "createNotificationConfig" + ] + }, + "DeleteNotificationConfig": { + "methods": [ + "deleteNotificationConfig" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "GetNotificationConfig": { + "methods": [ + "getNotificationConfig" + ] + }, + "GetOrganizationSettings": { + "methods": [ + "getOrganizationSettings" + ] + }, + "GetSource": { + "methods": [ + "getSource" + ] + }, + "SetFindingState": { + "methods": [ + "setFindingState" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "UpdateFinding": { + "methods": [ + "updateFinding" + ] + }, + "UpdateNotificationConfig": { + "methods": [ + "updateNotificationConfig" + ] + }, + "UpdateOrganizationSettings": { + "methods": [ + "updateOrganizationSettings" + ] + }, + "UpdateSource": { + "methods": [ + "updateSource" + ] + }, + "UpdateSecurityMarks": { + "methods": [ + "updateSecurityMarks" + ] + }, + "RunAssetDiscovery": { + "methods": [ + "runAssetDiscovery" + ] + }, + "GroupAssets": { + "methods": [ + "groupAssets", + "groupAssetsStream", + "groupAssetsAsync" + ] + }, + "GroupFindings": { + "methods": [ + "groupFindings", + "groupFindingsStream", + "groupFindingsAsync" + ] + }, + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + }, + "ListNotificationConfigs": { + "methods": [ + "listNotificationConfigs", + "listNotificationConfigsStream", + "listNotificationConfigsAsync" + ] + }, + "ListSources": { + "methods": [ + "listSources", + "listSourcesStream", + "listSourcesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SecurityCenterClient", + "rpcs": { + "CreateSource": { + "methods": [ + "createSource" + ] + }, + "CreateFinding": { + "methods": [ + "createFinding" + ] + }, + "CreateNotificationConfig": { + "methods": [ + "createNotificationConfig" + ] + }, + "DeleteNotificationConfig": { + "methods": [ + "deleteNotificationConfig" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "GetNotificationConfig": { + "methods": [ + "getNotificationConfig" + ] + }, + "GetOrganizationSettings": { + "methods": [ + "getOrganizationSettings" + ] + }, + "GetSource": { + "methods": [ + "getSource" + ] + }, + "SetFindingState": { + "methods": [ + "setFindingState" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "UpdateFinding": { + "methods": [ + "updateFinding" + ] + }, + "UpdateNotificationConfig": { + "methods": [ + "updateNotificationConfig" + ] + }, + "UpdateOrganizationSettings": { + "methods": [ + "updateOrganizationSettings" + ] + }, + "UpdateSource": { + "methods": [ + "updateSource" + ] + }, + "UpdateSecurityMarks": { + "methods": [ + "updateSecurityMarks" + ] + }, + "RunAssetDiscovery": { + "methods": [ + "runAssetDiscovery" + ] + }, + "GroupAssets": { + "methods": [ + "groupAssets", + "groupAssetsStream", + "groupAssetsAsync" + ] + }, + "GroupFindings": { + "methods": [ + "groupFindings", + "groupFindingsStream", + "groupFindingsAsync" + ] + }, + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + }, + "ListNotificationConfigs": { + "methods": [ + "listNotificationConfigs", + "listNotificationConfigsStream", + "listNotificationConfigsAsync" + ] + }, + "ListSources": { + "methods": [ + "listSources", + "listSourcesStream", + "listSourcesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/index.ts b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/index.ts new file mode 100644 index 00000000000..fa3996e6154 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {SecurityCenterClient} from './security_center_client'; diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_client.ts b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_client.ts new file mode 100644 index 00000000000..d56659c1314 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_client.ts @@ -0,0 +1,4943 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1p1beta1/security_center_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './security_center_client_config.json'; +const version = require('../../../package.json').version; + +/** + * V1p1Beta1 APIs for Security Center service. + * @class + * @memberof v1p1beta1 + */ +export class SecurityCenterClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + securityCenterStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SecurityCenterClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SecurityCenterClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SecurityCenterClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + folderAssetPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/assets/{asset}' + ), + folderAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/assets/{asset}/securityMarks' + ), + folderSourcePathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sources/{source}' + ), + folderSourceFindingPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sources/{source}/findings/{finding}' + ), + folderSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sources/{source}/findings/{finding}/securityMarks' + ), + notificationConfigPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationConfigs/{notification_config}' + ), + organizationPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}' + ), + organizationAssetPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/assets/{asset}' + ), + organizationAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/assets/{asset}/securityMarks' + ), + organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/organizationSettings' + ), + organizationSourcePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}' + ), + organizationSourceFindingPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}/findings/{finding}' + ), + organizationSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks' + ), + projectAssetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/assets/{asset}' + ), + projectAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/assets/{asset}/securityMarks' + ), + projectSourcePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sources/{source}' + ), + projectSourceFindingPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sources/{source}/findings/{finding}' + ), + projectSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sources/{source}/findings/{finding}/securityMarks' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + groupAssets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), + groupFindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), + listAssets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listAssetsResults'), + listFindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listFindingsResults'), + listNotificationConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'notificationConfigs'), + listSources: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sources') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1p1beta1/{name=organizations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1p1beta1/{name=organizations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1p1beta1/{name=organizations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1p1beta1/{name=organizations/*/operations}',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const runAssetDiscoveryResponse = protoFilesRoot.lookup( + '.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryResponse') as gax.protobuf.Type; + const runAssetDiscoveryMetadata = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + + this.descriptors.longrunning = { + runAssetDiscovery: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + runAssetDiscoveryResponse.decode.bind(runAssetDiscoveryResponse), + runAssetDiscoveryMetadata.decode.bind(runAssetDiscoveryMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.securitycenter.v1p1beta1.SecurityCenter', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.securityCenterStub) { + return this.securityCenterStub; + } + + // Put together the "service stub" for + // google.cloud.securitycenter.v1p1beta1.SecurityCenter. + this.securityCenterStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.securitycenter.v1p1beta1.SecurityCenter') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.securitycenter.v1p1beta1.SecurityCenter, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const securityCenterStubMethods = + ['createSource', 'createFinding', 'createNotificationConfig', 'deleteNotificationConfig', 'getIamPolicy', 'getNotificationConfig', 'getOrganizationSettings', 'getSource', 'groupAssets', 'groupFindings', 'listAssets', 'listFindings', 'listNotificationConfigs', 'listSources', 'runAssetDiscovery', 'setFindingState', 'setIamPolicy', 'testIamPermissions', 'updateFinding', 'updateNotificationConfig', 'updateOrganizationSettings', 'updateSource', 'updateSecurityMarks']; + for (const methodName of securityCenterStubMethods) { + const callPromise = this.securityCenterStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.securityCenterStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'securitycenter.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'securitycenter.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Creates a source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new source's parent. Its format should be + * "organizations/[organization_id]". + * @param {google.cloud.securitycenter.v1p1beta1.Source} request.source + * Required. The Source being created, only the display_name and description will be + * used. All other fields will be ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.Source | Source}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.create_source.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_CreateSource_async + */ + createSource( + request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|undefined, {}|undefined + ]>; + createSource( + request: protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|null|undefined, + {}|null|undefined>): void; + createSource( + request: protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|null|undefined, + {}|null|undefined>): void; + createSource( + request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createSource(request, options, callback); + } +/** + * Creates a finding. The corresponding source must exist for finding + * creation to succeed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new finding's parent. Its format should be + * "organizations/[organization_id]/sources/[source_id]". + * @param {string} request.findingId + * Required. Unique identifier provided by the client within the parent scope. + * @param {google.cloud.securitycenter.v1p1beta1.Finding} request.finding + * Required. The Finding being created. The name and security_marks will be ignored as + * they are both output only fields on this resource. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.Finding | Finding}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.create_finding.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_CreateFinding_async + */ + createFinding( + request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|undefined, {}|undefined + ]>; + createFinding( + request: protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|null|undefined, + {}|null|undefined>): void; + createFinding( + request: protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|null|undefined, + {}|null|undefined>): void; + createFinding( + request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createFinding(request, options, callback); + } +/** + * Creates a notification config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new notification config's parent. Its format is + * "organizations/[organization_id]". + * @param {string} request.configId + * Required. Unique identifier provided by the client within the parent scope. + * It must be between 1 and 128 characters, and contains alphanumeric + * characters, underscores or hyphens only. + * @param {google.cloud.securitycenter.v1p1beta1.NotificationConfig} request.notificationConfig + * Required. The notification config being created. The name and the service account + * will be ignored as they are both output only fields on this resource. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.NotificationConfig | NotificationConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.create_notification_config.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_CreateNotificationConfig_async + */ + createNotificationConfig( + request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|undefined, {}|undefined + ]>; + createNotificationConfig( + request: protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + createNotificationConfig( + request: protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + createNotificationConfig( + request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createNotificationConfig(request, options, callback); + } +/** + * Deletes a notification config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the notification config to delete. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.protobuf.Empty | Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.delete_notification_config.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_DeleteNotificationConfig_async + */ + deleteNotificationConfig( + request?: protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|undefined, {}|undefined + ]>; + deleteNotificationConfig( + request: protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteNotificationConfig( + request: protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteNotificationConfig( + request?: protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteNotificationConfig(request, options, callback); + } +/** + * Gets the access control policy on the specified Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.GetPolicyOptions} request.options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.get_iam_policy.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GetIamPolicy_async + */ + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource': request.resource ?? '', + }); + this.initialize(); + return this.innerApiCalls.getIamPolicy(request, options, callback); + } +/** + * Gets a notification config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the notification config to get. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.NotificationConfig | NotificationConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.get_notification_config.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GetNotificationConfig_async + */ + getNotificationConfig( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|undefined, {}|undefined + ]>; + getNotificationConfig( + request: protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + getNotificationConfig( + request: protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + getNotificationConfig( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getNotificationConfig(request, options, callback); + } +/** + * Gets the settings for an organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the organization to get organization settings for. Its format is + * "organizations/[organization_id]/organizationSettings". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.OrganizationSettings | OrganizationSettings}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.get_organization_settings.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GetOrganizationSettings_async + */ + getOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|undefined, {}|undefined + ]>; + getOrganizationSettings( + request: protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + getOrganizationSettings( + request: protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + getOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getOrganizationSettings(request, options, callback); + } +/** + * Gets a source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Relative resource name of the source. Its format is + * "organizations/[organization_id]/source/[source_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.Source | Source}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.get_source.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GetSource_async + */ + getSource( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|undefined, {}|undefined + ]>; + getSource( + request: protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|null|undefined, + {}|null|undefined>): void; + getSource( + request: protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|null|undefined, + {}|null|undefined>): void; + getSource( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getSource(request, options, callback); + } +/** + * Updates the state of a finding. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the finding. See: + * https://cloud.google.com/apis/design/resource_names#relative_resource_name + * Example: + * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". + * @param {google.cloud.securitycenter.v1p1beta1.Finding.State} request.state + * Required. The desired State of the finding. + * @param {google.protobuf.Timestamp} request.startTime + * Required. The time at which the updated state takes effect. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.Finding | Finding}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.set_finding_state.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_SetFindingState_async + */ + setFindingState( + request?: protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|undefined, {}|undefined + ]>; + setFindingState( + request: protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>): void; + setFindingState( + request: protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>): void; + setFindingState( + request?: protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.setFindingState(request, options, callback); + } +/** + * Sets the access control policy on the specified Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.Policy} request.policy + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param {google.protobuf.FieldMask} request.updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.set_iam_policy.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_SetIamPolicy_async + */ + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource': request.resource ?? '', + }); + this.initialize(); + return this.innerApiCalls.setIamPolicy(request, options, callback); + } +/** + * Returns the permissions that a caller has on the specified source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.test_iam_permissions.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_TestIamPermissions_async + */ + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource': request.resource ?? '', + }); + this.initialize(); + return this.innerApiCalls.testIamPermissions(request, options, callback); + } +/** + * Creates or updates a finding. The corresponding source must exist for a + * finding creation to succeed. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1p1beta1.Finding} request.finding + * Required. The finding resource to update or create if it does not already exist. + * parent, security_marks, and update_time will be ignored. + * + * In the case of creation, the finding id portion of the name must be + * alphanumeric and less than or equal to 32 characters and greater than 0 + * characters in length. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the finding resource. This field should + * not be specified when creating a finding. + * + * When updating a finding, an empty mask is treated as updating all mutable + * fields and replacing source_properties. Individual source_properties can + * be added/updated by using "source_properties." in the field + * mask. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.Finding | Finding}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.update_finding.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateFinding_async + */ + updateFinding( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|undefined, {}|undefined + ]>; + updateFinding( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>): void; + updateFinding( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>): void; + updateFinding( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'finding.name': request.finding!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFinding(request, options, callback); + } +/** + * Updates a notification config. The following update + * fields are allowed: description, pubsub_topic, streaming_config.filter + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1p1beta1.NotificationConfig} request.notificationConfig + * Required. The notification config to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the notification config. + * + * If empty all mutable fields will be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.NotificationConfig | NotificationConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.update_notification_config.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateNotificationConfig_async + */ + updateNotificationConfig( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|undefined, {}|undefined + ]>; + updateNotificationConfig( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + updateNotificationConfig( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + updateNotificationConfig( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'notification_config.name': request.notificationConfig!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateNotificationConfig(request, options, callback); + } +/** + * Updates an organization's settings. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1p1beta1.OrganizationSettings} request.organizationSettings + * Required. The organization settings resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the settings resource. + * + * If empty all mutable fields will be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.OrganizationSettings | OrganizationSettings}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.update_organization_settings.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async + */ + updateOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|undefined, {}|undefined + ]>; + updateOrganizationSettings( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateOrganizationSettings( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'organization_settings.name': request.organizationSettings!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateOrganizationSettings(request, options, callback); + } +/** + * Updates a source. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1p1beta1.Source} request.source + * Required. The source resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the source resource. + * + * If empty all mutable fields will be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.Source | Source}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.update_source.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSource_async + */ + updateSource( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|undefined, {}|undefined + ]>; + updateSource( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>): void; + updateSource( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>): void; + updateSource( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'source.name': request.source!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSource(request, options, callback); + } +/** + * Updates security marks. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1p1beta1.SecurityMarks} request.securityMarks + * Required. The security marks resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the security marks resource. + * + * The field mask must not contain duplicate fields. + * If empty or set to "marks", all marks will be replaced. Individual + * marks can be updated using "marks.". + * @param {google.protobuf.Timestamp} request.startTime + * The time at which the updated SecurityMarks take effect. + * If not set uses current server time. Updates will be applied to the + * SecurityMarks that are active immediately preceding this time. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.SecurityMarks | SecurityMarks}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.update_security_marks.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSecurityMarks_async + */ + updateSecurityMarks( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|undefined, {}|undefined + ]>; + updateSecurityMarks( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>): void; + updateSecurityMarks( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>): void; + updateSecurityMarks( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'security_marks.name': request.securityMarks!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSecurityMarks(request, options, callback); + } + +/** + * Runs asset discovery. The discovery is tracked with a long-running + * operation. + * + * This API can only be called with limited frequency for an organization. If + * it is called too frequently the caller will receive a TOO_MANY_REQUESTS + * error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to run asset discovery for. Its format is + * "organizations/[organization_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.run_asset_discovery.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async + */ + runAssetDiscovery( + request?: protos.google.cloud.securitycenter.v1p1beta1.IRunAssetDiscoveryRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + runAssetDiscovery( + request: protos.google.cloud.securitycenter.v1p1beta1.IRunAssetDiscoveryRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runAssetDiscovery( + request: protos.google.cloud.securitycenter.v1p1beta1.IRunAssetDiscoveryRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runAssetDiscovery( + request?: protos.google.cloud.securitycenter.v1p1beta1.IRunAssetDiscoveryRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.runAssetDiscovery(request, options, callback); + } +/** + * Check the status of the long running operation returned by `runAssetDiscovery()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.run_asset_discovery.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async + */ + async checkRunAssetDiscoveryProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runAssetDiscovery, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Filters an organization's assets and groups them by their specified + * properties. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * 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 Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_name_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * + * The following fields are supported when compare_duration is not set: + * + * * security_center_properties.resource_project + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * * security_center_properties.resource_parent_display_name + * + * The following fields are supported when compare_duration is set: + * + * * security_center_properties.resource_type + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_parent_display_name + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" property is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1p1beta1.GroupResult | GroupResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `groupAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + groupAssets( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[], + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse + ]>; + groupAssets( + request: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): void; + groupAssets( + request: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): void; + groupAssets( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[], + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.groupAssets(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * 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 Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_name_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * + * The following fields are supported when compare_duration is not set: + * + * * security_center_properties.resource_project + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * * security_center_properties.resource_parent_display_name + * + * The following fields are supported when compare_duration is set: + * + * * security_center_properties.resource_type + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_parent_display_name + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" property is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1p1beta1.GroupResult | GroupResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `groupAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + groupAssetsStream( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['groupAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupAssets.createStream( + this.innerApiCalls.groupAssets as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `groupAssets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * 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 Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_name_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * + * The following fields are supported when compare_duration is not set: + * + * * security_center_properties.resource_project + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * * security_center_properties.resource_parent_display_name + * + * The following fields are supported when compare_duration is set: + * + * * security_center_properties.resource_type + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_parent_display_name + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" property is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1p1beta1.GroupResult | GroupResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.group_assets.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GroupAssets_async + */ + groupAssetsAsync( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['groupAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupAssets.asyncIterate( + this.innerApiCalls['groupAssets'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Filters an organization or source's findings and groups them by their + * specified properties. + * + * To group across all sources provide a `-` as the source id. + * Example: /v1/organizations/{organization_id}/sources/-/findings, + * /v1/folders/{folder_id}/sources/-/findings, + * /v1/projects/{project_id}/sources/-/findings + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]", + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]. To groupBy across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + * or projects/{project_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one 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. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * * severity: `=`, `:` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping (including + * `state_change`). The string value should follow SQL syntax: comma separated + * list of fields. For example: "parent,resource_name". + * + * The following fields are supported: + * + * * resource_name + * * category + * * state + * * parent + * * severity + * + * The following fields are supported when compare_duration is set: + * + * * state_change + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" attribute is + * updated to indicate whether the finding had its state changed, the + * finding's state remained unchanged, or if the finding was added during the + * compare_duration period of time that precedes the read_time. This is the + * time between (read_time - compare_duration) and read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present + * at read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {string} request.pageToken + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1p1beta1.GroupResult | GroupResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `groupFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + groupFindings( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[], + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse + ]>; + groupFindings( + request: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): void; + groupFindings( + request: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): void; + groupFindings( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[], + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.groupFindings(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]", + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]. To groupBy across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + * or projects/{project_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one 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. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * * severity: `=`, `:` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping (including + * `state_change`). The string value should follow SQL syntax: comma separated + * list of fields. For example: "parent,resource_name". + * + * The following fields are supported: + * + * * resource_name + * * category + * * state + * * parent + * * severity + * + * The following fields are supported when compare_duration is set: + * + * * state_change + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" attribute is + * updated to indicate whether the finding had its state changed, the + * finding's state remained unchanged, or if the finding was added during the + * compare_duration period of time that precedes the read_time. This is the + * time between (read_time - compare_duration) and read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present + * at read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {string} request.pageToken + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1p1beta1.GroupResult | GroupResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `groupFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + groupFindingsStream( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['groupFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupFindings.createStream( + this.innerApiCalls.groupFindings as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `groupFindings`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]", + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]. To groupBy across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + * or projects/{project_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one 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. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * * severity: `=`, `:` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping (including + * `state_change`). The string value should follow SQL syntax: comma separated + * list of fields. For example: "parent,resource_name". + * + * The following fields are supported: + * + * * resource_name + * * category + * * state + * * parent + * * severity + * + * The following fields are supported when compare_duration is set: + * + * * state_change + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" attribute is + * updated to indicate whether the finding had its state changed, the + * finding's state remained unchanged, or if the finding was added during the + * compare_duration period of time that precedes the read_time. This is the + * time between (read_time - compare_duration) and read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present + * at read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {string} request.pageToken + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1p1beta1.GroupResult | GroupResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.group_findings.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GroupFindings_async + */ + groupFindingsAsync( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['groupFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupFindings.asyncIterate( + this.innerApiCalls['groupFindings'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists an organization's assets. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * 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 Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following are the allowed field and operator combinations: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * update_time + * resource_properties + * security_marks.marks + * security_center_properties.resource_name + * security_center_properties.resource_display_name + * security_center_properties.resource_parent + * security_center_properties.resource_parent_display_name + * security_center_properties.resource_project + * security_center_properties.resource_project_display_name + * security_center_properties.resource_type + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListAssetsResult's "state_change" + * attribute is updated to indicate whether the asset was added, removed, or + * remained present during the compare_duration period of time that precedes + * the read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult | ListAssetsResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAssets( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[], + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse + ]>; + listAssets( + request: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult>): void; + listAssets( + request: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult>): void; + listAssets( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[], + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listAssets(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * 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 Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following are the allowed field and operator combinations: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * update_time + * resource_properties + * security_marks.marks + * security_center_properties.resource_name + * security_center_properties.resource_display_name + * security_center_properties.resource_parent + * security_center_properties.resource_parent_display_name + * security_center_properties.resource_project + * security_center_properties.resource_project_display_name + * security_center_properties.resource_type + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListAssetsResult's "state_change" + * attribute is updated to indicate whether the asset was added, removed, or + * remained present during the compare_duration period of time that precedes + * the read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult | ListAssetsResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAssetsStream( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssets.createStream( + this.innerApiCalls.listAssets as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAssets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * 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 Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following are the allowed field and operator combinations: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * update_time + * resource_properties + * security_marks.marks + * security_center_properties.resource_name + * security_center_properties.resource_display_name + * security_center_properties.resource_parent + * security_center_properties.resource_parent_display_name + * security_center_properties.resource_project + * security_center_properties.resource_project_display_name + * security_center_properties.resource_type + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListAssetsResult's "state_change" + * attribute is updated to indicate whether the asset was added, removed, or + * remained present during the compare_duration period of time that precedes + * the read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult | ListAssetsResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.list_assets.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_ListAssets_async + */ + listAssetsAsync( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssets.asyncIterate( + this.innerApiCalls['listAssets'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists an organization or source's findings. + * + * To list across all sources provide a `-` as the source id. + * Example: /v1p1beta1/organizations/{organization_id}/sources/-/findings + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id], + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]". To list across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + * projects/{projects_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one 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. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * * severity: `=`, `:` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * security_marks.marks: `=`, `:` + * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * parent + * state + * category + * resource_name + * event_time + * source_properties + * security_marks.marks + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListFindingsResult's "state_change" + * attribute is updated to indicate whether the finding had its state changed, + * the finding's state remained unchanged, or if the finding was added in any + * state during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult | ListFindingsResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFindings( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[], + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse + ]>; + listFindings( + request: protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult>): void; + listFindings( + request: protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult>): void; + listFindings( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[], + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listFindings(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id], + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]". To list across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + * projects/{projects_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one 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. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * * severity: `=`, `:` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * security_marks.marks: `=`, `:` + * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * parent + * state + * category + * resource_name + * event_time + * source_properties + * security_marks.marks + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListFindingsResult's "state_change" + * attribute is updated to indicate whether the finding had its state changed, + * the finding's state remained unchanged, or if the finding was added in any + * state during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult | ListFindingsResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFindingsStream( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFindings.createStream( + this.innerApiCalls.listFindings as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFindings`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id], + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]". To list across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + * projects/{projects_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one 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. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * 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. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * * severity: `=`, `:` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * security_marks.marks: `=`, `:` + * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * parent + * state + * category + * resource_name + * event_time + * source_properties + * security_marks.marks + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListFindingsResult's "state_change" + * attribute is updated to indicate whether the finding had its state changed, + * the finding's state remained unchanged, or if the finding was added in any + * state during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult | ListFindingsResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.list_findings.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_ListFindings_async + */ + listFindingsAsync( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFindings.asyncIterate( + this.innerApiCalls['listFindings'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists notification configs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to list notification configs. + * Its format is "organizations/[organization_id]". + * @param {string} request.pageToken + * The value returned by the last `ListNotificationConfigsResponse`; indicates + * that this is a continuation of a prior `ListNotificationConfigs` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1p1beta1.NotificationConfig | NotificationConfig}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listNotificationConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listNotificationConfigs( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[], + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse + ]>; + listNotificationConfigs( + request: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig>): void; + listNotificationConfigs( + request: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig>): void; + listNotificationConfigs( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[], + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listNotificationConfigs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to list notification configs. + * Its format is "organizations/[organization_id]". + * @param {string} request.pageToken + * The value returned by the last `ListNotificationConfigsResponse`; indicates + * that this is a continuation of a prior `ListNotificationConfigs` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1p1beta1.NotificationConfig | NotificationConfig} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listNotificationConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listNotificationConfigsStream( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listNotificationConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNotificationConfigs.createStream( + this.innerApiCalls.listNotificationConfigs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listNotificationConfigs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to list notification configs. + * Its format is "organizations/[organization_id]". + * @param {string} request.pageToken + * The value returned by the last `ListNotificationConfigsResponse`; indicates + * that this is a continuation of a prior `ListNotificationConfigs` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1p1beta1.NotificationConfig | NotificationConfig}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.list_notification_configs.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_ListNotificationConfigs_async + */ + listNotificationConfigsAsync( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listNotificationConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNotificationConfigs.asyncIterate( + this.innerApiCalls['listNotificationConfigs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all sources belonging to an organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.pageToken + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.securitycenter.v1p1beta1.Source | Source}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSourcesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listSources( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISource[], + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse + ]>; + listSources( + request: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ISource>): void; + listSources( + request: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ISource>): void; + listSources( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ISource>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ISource>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISource[], + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listSources(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.pageToken + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.securitycenter.v1p1beta1.Source | Source} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSourcesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listSourcesStream( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSources.createStream( + this.innerApiCalls.listSources as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSources`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.pageToken + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.securitycenter.v1p1beta1.Source | Source}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.list_sources.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_ListSources_async + */ + listSourcesAsync( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSources.asyncIterate( + this.innerApiCalls['listSources'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified folderAsset resource name string. + * + * @param {string} folder + * @param {string} asset + * @returns {string} Resource name string. + */ + folderAssetPath(folder:string,asset:string) { + return this.pathTemplates.folderAssetPathTemplate.render({ + folder: folder, + asset: asset, + }); + } + + /** + * Parse the folder from FolderAsset resource. + * + * @param {string} folderAssetName + * A fully-qualified path representing folder_asset resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAssetName(folderAssetName: string) { + return this.pathTemplates.folderAssetPathTemplate.match(folderAssetName).folder; + } + + /** + * Parse the asset from FolderAsset resource. + * + * @param {string} folderAssetName + * A fully-qualified path representing folder_asset resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromFolderAssetName(folderAssetName: string) { + return this.pathTemplates.folderAssetPathTemplate.match(folderAssetName).asset; + } + + /** + * Return a fully-qualified folderAssetSecurityMarks resource name string. + * + * @param {string} folder + * @param {string} asset + * @returns {string} Resource name string. + */ + folderAssetSecurityMarksPath(folder:string,asset:string) { + return this.pathTemplates.folderAssetSecurityMarksPathTemplate.render({ + folder: folder, + asset: asset, + }); + } + + /** + * Parse the folder from FolderAssetSecurityMarks resource. + * + * @param {string} folderAssetSecurityMarksName + * A fully-qualified path representing folder_asset_securityMarks resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAssetSecurityMarksName(folderAssetSecurityMarksName: string) { + return this.pathTemplates.folderAssetSecurityMarksPathTemplate.match(folderAssetSecurityMarksName).folder; + } + + /** + * Parse the asset from FolderAssetSecurityMarks resource. + * + * @param {string} folderAssetSecurityMarksName + * A fully-qualified path representing folder_asset_securityMarks resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromFolderAssetSecurityMarksName(folderAssetSecurityMarksName: string) { + return this.pathTemplates.folderAssetSecurityMarksPathTemplate.match(folderAssetSecurityMarksName).asset; + } + + /** + * Return a fully-qualified folderSource resource name string. + * + * @param {string} folder + * @param {string} source + * @returns {string} Resource name string. + */ + folderSourcePath(folder:string,source:string) { + return this.pathTemplates.folderSourcePathTemplate.render({ + folder: folder, + source: source, + }); + } + + /** + * Parse the folder from FolderSource resource. + * + * @param {string} folderSourceName + * A fully-qualified path representing folder_source resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSourceName(folderSourceName: string) { + return this.pathTemplates.folderSourcePathTemplate.match(folderSourceName).folder; + } + + /** + * Parse the source from FolderSource resource. + * + * @param {string} folderSourceName + * A fully-qualified path representing folder_source resource. + * @returns {string} A string representing the source. + */ + matchSourceFromFolderSourceName(folderSourceName: string) { + return this.pathTemplates.folderSourcePathTemplate.match(folderSourceName).source; + } + + /** + * Return a fully-qualified folderSourceFinding resource name string. + * + * @param {string} folder + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + folderSourceFindingPath(folder:string,source:string,finding:string) { + return this.pathTemplates.folderSourceFindingPathTemplate.render({ + folder: folder, + source: source, + finding: finding, + }); + } + + /** + * Parse the folder from FolderSourceFinding resource. + * + * @param {string} folderSourceFindingName + * A fully-qualified path representing folder_source_finding resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSourceFindingName(folderSourceFindingName: string) { + return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).folder; + } + + /** + * Parse the source from FolderSourceFinding resource. + * + * @param {string} folderSourceFindingName + * A fully-qualified path representing folder_source_finding resource. + * @returns {string} A string representing the source. + */ + matchSourceFromFolderSourceFindingName(folderSourceFindingName: string) { + return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).source; + } + + /** + * Parse the finding from FolderSourceFinding resource. + * + * @param {string} folderSourceFindingName + * A fully-qualified path representing folder_source_finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromFolderSourceFindingName(folderSourceFindingName: string) { + return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).finding; + } + + /** + * Return a fully-qualified folderSourceFindingSecurityMarks resource name string. + * + * @param {string} folder + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + folderSourceFindingSecurityMarksPath(folder:string,source:string,finding:string) { + return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render({ + folder: folder, + source: source, + finding: finding, + }); + } + + /** + * Parse the folder from FolderSourceFindingSecurityMarks resource. + * + * @param {string} folderSourceFindingSecurityMarksName + * A fully-qualified path representing folder_source_finding_securityMarks resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { + return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).folder; + } + + /** + * Parse the source from FolderSourceFindingSecurityMarks resource. + * + * @param {string} folderSourceFindingSecurityMarksName + * A fully-qualified path representing folder_source_finding_securityMarks resource. + * @returns {string} A string representing the source. + */ + matchSourceFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { + return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).source; + } + + /** + * Parse the finding from FolderSourceFindingSecurityMarks resource. + * + * @param {string} folderSourceFindingSecurityMarksName + * A fully-qualified path representing folder_source_finding_securityMarks resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { + return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).finding; + } + + /** + * Return a fully-qualified notificationConfig resource name string. + * + * @param {string} organization + * @param {string} notification_config + * @returns {string} Resource name string. + */ + notificationConfigPath(organization:string,notificationConfig:string) { + return this.pathTemplates.notificationConfigPathTemplate.render({ + organization: organization, + notification_config: notificationConfig, + }); + } + + /** + * Parse the organization from NotificationConfig resource. + * + * @param {string} notificationConfigName + * A fully-qualified path representing NotificationConfig resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromNotificationConfigName(notificationConfigName: string) { + return this.pathTemplates.notificationConfigPathTemplate.match(notificationConfigName).organization; + } + + /** + * Parse the notification_config from NotificationConfig resource. + * + * @param {string} notificationConfigName + * A fully-qualified path representing NotificationConfig resource. + * @returns {string} A string representing the notification_config. + */ + matchNotificationConfigFromNotificationConfigName(notificationConfigName: string) { + return this.pathTemplates.notificationConfigPathTemplate.match(notificationConfigName).notification_config; + } + + /** + * Return a fully-qualified organization resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationPath(organization:string) { + return this.pathTemplates.organizationPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from Organization resource. + * + * @param {string} organizationName + * A fully-qualified path representing Organization resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationName(organizationName: string) { + return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; + } + + /** + * Return a fully-qualified organizationAsset resource name string. + * + * @param {string} organization + * @param {string} asset + * @returns {string} Resource name string. + */ + organizationAssetPath(organization:string,asset:string) { + return this.pathTemplates.organizationAssetPathTemplate.render({ + organization: organization, + asset: asset, + }); + } + + /** + * Parse the organization from OrganizationAsset resource. + * + * @param {string} organizationAssetName + * A fully-qualified path representing organization_asset resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAssetName(organizationAssetName: string) { + return this.pathTemplates.organizationAssetPathTemplate.match(organizationAssetName).organization; + } + + /** + * Parse the asset from OrganizationAsset resource. + * + * @param {string} organizationAssetName + * A fully-qualified path representing organization_asset resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromOrganizationAssetName(organizationAssetName: string) { + return this.pathTemplates.organizationAssetPathTemplate.match(organizationAssetName).asset; + } + + /** + * Return a fully-qualified organizationAssetSecurityMarks resource name string. + * + * @param {string} organization + * @param {string} asset + * @returns {string} Resource name string. + */ + organizationAssetSecurityMarksPath(organization:string,asset:string) { + return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.render({ + organization: organization, + asset: asset, + }); + } + + /** + * Parse the organization from OrganizationAssetSecurityMarks resource. + * + * @param {string} organizationAssetSecurityMarksName + * A fully-qualified path representing organization_asset_securityMarks resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { + return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).organization; + } + + /** + * Parse the asset from OrganizationAssetSecurityMarks resource. + * + * @param {string} organizationAssetSecurityMarksName + * A fully-qualified path representing organization_asset_securityMarks resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { + return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).asset; + } + + /** + * Return a fully-qualified organizationSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationSettingsPath(organization:string) { + return this.pathTemplates.organizationSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationSettings resource. + * + * @param {string} organizationSettingsName + * A fully-qualified path representing OrganizationSettings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { + return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; + } + + /** + * Return a fully-qualified organizationSource resource name string. + * + * @param {string} organization + * @param {string} source + * @returns {string} Resource name string. + */ + organizationSourcePath(organization:string,source:string) { + return this.pathTemplates.organizationSourcePathTemplate.render({ + organization: organization, + source: source, + }); + } + + /** + * Parse the organization from OrganizationSource resource. + * + * @param {string} organizationSourceName + * A fully-qualified path representing organization_source resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSourceName(organizationSourceName: string) { + return this.pathTemplates.organizationSourcePathTemplate.match(organizationSourceName).organization; + } + + /** + * Parse the source from OrganizationSource resource. + * + * @param {string} organizationSourceName + * A fully-qualified path representing organization_source resource. + * @returns {string} A string representing the source. + */ + matchSourceFromOrganizationSourceName(organizationSourceName: string) { + return this.pathTemplates.organizationSourcePathTemplate.match(organizationSourceName).source; + } + + /** + * Return a fully-qualified organizationSourceFinding resource name string. + * + * @param {string} organization + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + organizationSourceFindingPath(organization:string,source:string,finding:string) { + return this.pathTemplates.organizationSourceFindingPathTemplate.render({ + organization: organization, + source: source, + finding: finding, + }); + } + + /** + * Parse the organization from OrganizationSourceFinding resource. + * + * @param {string} organizationSourceFindingName + * A fully-qualified path representing organization_source_finding resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSourceFindingName(organizationSourceFindingName: string) { + return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).organization; + } + + /** + * Parse the source from OrganizationSourceFinding resource. + * + * @param {string} organizationSourceFindingName + * A fully-qualified path representing organization_source_finding resource. + * @returns {string} A string representing the source. + */ + matchSourceFromOrganizationSourceFindingName(organizationSourceFindingName: string) { + return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).source; + } + + /** + * Parse the finding from OrganizationSourceFinding resource. + * + * @param {string} organizationSourceFindingName + * A fully-qualified path representing organization_source_finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromOrganizationSourceFindingName(organizationSourceFindingName: string) { + return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).finding; + } + + /** + * Return a fully-qualified organizationSourceFindingSecurityMarks resource name string. + * + * @param {string} organization + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + organizationSourceFindingSecurityMarksPath(organization:string,source:string,finding:string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render({ + organization: organization, + source: source, + finding: finding, + }); + } + + /** + * Parse the organization from OrganizationSourceFindingSecurityMarks resource. + * + * @param {string} organizationSourceFindingSecurityMarksName + * A fully-qualified path representing organization_source_finding_securityMarks resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).organization; + } + + /** + * Parse the source from OrganizationSourceFindingSecurityMarks resource. + * + * @param {string} organizationSourceFindingSecurityMarksName + * A fully-qualified path representing organization_source_finding_securityMarks resource. + * @returns {string} A string representing the source. + */ + matchSourceFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).source; + } + + /** + * Parse the finding from OrganizationSourceFindingSecurityMarks resource. + * + * @param {string} organizationSourceFindingSecurityMarksName + * A fully-qualified path representing organization_source_finding_securityMarks resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).finding; + } + + /** + * Return a fully-qualified projectAsset resource name string. + * + * @param {string} project + * @param {string} asset + * @returns {string} Resource name string. + */ + projectAssetPath(project:string,asset:string) { + return this.pathTemplates.projectAssetPathTemplate.render({ + project: project, + asset: asset, + }); + } + + /** + * Parse the project from ProjectAsset resource. + * + * @param {string} projectAssetName + * A fully-qualified path representing project_asset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAssetName(projectAssetName: string) { + return this.pathTemplates.projectAssetPathTemplate.match(projectAssetName).project; + } + + /** + * Parse the asset from ProjectAsset resource. + * + * @param {string} projectAssetName + * A fully-qualified path representing project_asset resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromProjectAssetName(projectAssetName: string) { + return this.pathTemplates.projectAssetPathTemplate.match(projectAssetName).asset; + } + + /** + * Return a fully-qualified projectAssetSecurityMarks resource name string. + * + * @param {string} project + * @param {string} asset + * @returns {string} Resource name string. + */ + projectAssetSecurityMarksPath(project:string,asset:string) { + return this.pathTemplates.projectAssetSecurityMarksPathTemplate.render({ + project: project, + asset: asset, + }); + } + + /** + * Parse the project from ProjectAssetSecurityMarks resource. + * + * @param {string} projectAssetSecurityMarksName + * A fully-qualified path representing project_asset_securityMarks resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAssetSecurityMarksName(projectAssetSecurityMarksName: string) { + return this.pathTemplates.projectAssetSecurityMarksPathTemplate.match(projectAssetSecurityMarksName).project; + } + + /** + * Parse the asset from ProjectAssetSecurityMarks resource. + * + * @param {string} projectAssetSecurityMarksName + * A fully-qualified path representing project_asset_securityMarks resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromProjectAssetSecurityMarksName(projectAssetSecurityMarksName: string) { + return this.pathTemplates.projectAssetSecurityMarksPathTemplate.match(projectAssetSecurityMarksName).asset; + } + + /** + * Return a fully-qualified projectSource resource name string. + * + * @param {string} project + * @param {string} source + * @returns {string} Resource name string. + */ + projectSourcePath(project:string,source:string) { + return this.pathTemplates.projectSourcePathTemplate.render({ + project: project, + source: source, + }); + } + + /** + * Parse the project from ProjectSource resource. + * + * @param {string} projectSourceName + * A fully-qualified path representing project_source resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSourceName(projectSourceName: string) { + return this.pathTemplates.projectSourcePathTemplate.match(projectSourceName).project; + } + + /** + * Parse the source from ProjectSource resource. + * + * @param {string} projectSourceName + * A fully-qualified path representing project_source resource. + * @returns {string} A string representing the source. + */ + matchSourceFromProjectSourceName(projectSourceName: string) { + return this.pathTemplates.projectSourcePathTemplate.match(projectSourceName).source; + } + + /** + * Return a fully-qualified projectSourceFinding resource name string. + * + * @param {string} project + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + projectSourceFindingPath(project:string,source:string,finding:string) { + return this.pathTemplates.projectSourceFindingPathTemplate.render({ + project: project, + source: source, + finding: finding, + }); + } + + /** + * Parse the project from ProjectSourceFinding resource. + * + * @param {string} projectSourceFindingName + * A fully-qualified path representing project_source_finding resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSourceFindingName(projectSourceFindingName: string) { + return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).project; + } + + /** + * Parse the source from ProjectSourceFinding resource. + * + * @param {string} projectSourceFindingName + * A fully-qualified path representing project_source_finding resource. + * @returns {string} A string representing the source. + */ + matchSourceFromProjectSourceFindingName(projectSourceFindingName: string) { + return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).source; + } + + /** + * Parse the finding from ProjectSourceFinding resource. + * + * @param {string} projectSourceFindingName + * A fully-qualified path representing project_source_finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromProjectSourceFindingName(projectSourceFindingName: string) { + return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).finding; + } + + /** + * Return a fully-qualified projectSourceFindingSecurityMarks resource name string. + * + * @param {string} project + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + projectSourceFindingSecurityMarksPath(project:string,source:string,finding:string) { + return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render({ + project: project, + source: source, + finding: finding, + }); + } + + /** + * Parse the project from ProjectSourceFindingSecurityMarks resource. + * + * @param {string} projectSourceFindingSecurityMarksName + * A fully-qualified path representing project_source_finding_securityMarks resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { + return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).project; + } + + /** + * Parse the source from ProjectSourceFindingSecurityMarks resource. + * + * @param {string} projectSourceFindingSecurityMarksName + * A fully-qualified path representing project_source_finding_securityMarks resource. + * @returns {string} A string representing the source. + */ + matchSourceFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { + return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).source; + } + + /** + * Parse the finding from ProjectSourceFindingSecurityMarks resource. + * + * @param {string} projectSourceFindingSecurityMarksName + * A fully-qualified path representing project_source_finding_securityMarks resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { + return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).finding; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.securityCenterStub && !this._terminated) { + return this.securityCenterStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_client_config.json b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_client_config.json new file mode 100644 index 00000000000..b8821e07010 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_client_config.json @@ -0,0 +1,141 @@ +{ + "interfaces": { + "google.cloud.securitycenter.v1p1beta1.SecurityCenter": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateSource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFinding": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateNotificationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteNotificationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetNotificationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetOrganizationSettings": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetSource": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GroupAssets": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GroupFindings": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListAssets": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindings": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListNotificationConfigs": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListSources": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RunAssetDiscovery": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetFindingState": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateFinding": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateNotificationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateOrganizationSettings": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSecurityMarks": { + "timeout_millis": 480000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_proto_list.json b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_proto_list.json new file mode 100644 index 00000000000..dcb821bf6e0 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_proto_list.json @@ -0,0 +1,13 @@ +[ + "../../protos/google/cloud/securitycenter/v1p1beta1/asset.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/finding.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/folder.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/resource.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/source.proto" +] diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..ca4c3d3425f --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const securitycenter = require('@google-cloud/security-center'); + +function main() { + const securityCenterClient = new securitycenter.SecurityCenterClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..323502f7e2f --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {SecurityCenterClient} from '@google-cloud/security-center'; + +// check that the client class type name can be used +function doStuffWithSecurityCenterClient(client: SecurityCenterClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const securityCenterClient = new SecurityCenterClient(); + doStuffWithSecurityCenterClient(securityCenterClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/test/gapic_security_center_v1p1beta1.ts b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/test/gapic_security_center_v1p1beta1.ts new file mode 100644 index 00000000000..1afa97ffaec --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/test/gapic_security_center_v1p1beta1.ts @@ -0,0 +1,4304 @@ +// Copyright 2023 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as securitycenterModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1p1beta1.SecurityCenterClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = securitycenterModule.v1p1beta1.SecurityCenterClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = securitycenterModule.v1p1beta1.SecurityCenterClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = securitycenterModule.v1p1beta1.SecurityCenterClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.securityCenterStub, undefined); + await client.initialize(); + assert(client.securityCenterStub); + }); + + it('has close method for the initialized client', done => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.securityCenterStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.securityCenterStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('createSource', () => { + it('invokes createSource without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.Source() + ); + client.innerApiCalls.createSource = stubSimpleCall(expectedResponse); + const [response] = await client.createSource(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSource without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.Source() + ); + client.innerApiCalls.createSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSource( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSource with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSource(request), expectedError); + const actualRequest = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSource with closed client', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSource(request), expectedError); + }); + }); + + describe('createFinding', () => { + it('invokes createFinding without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.Finding() + ); + client.innerApiCalls.createFinding = stubSimpleCall(expectedResponse); + const [response] = await client.createFinding(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFinding without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.Finding() + ); + client.innerApiCalls.createFinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFinding( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFinding with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createFinding(request), expectedError); + const actualRequest = (client.innerApiCalls.createFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFinding with closed client', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createFinding(request), expectedError); + }); + }); + + describe('createNotificationConfig', () => { + it('invokes createNotificationConfig without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig() + ); + client.innerApiCalls.createNotificationConfig = stubSimpleCall(expectedResponse); + const [response] = await client.createNotificationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNotificationConfig without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig() + ); + client.innerApiCalls.createNotificationConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNotificationConfig( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNotificationConfig with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNotificationConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createNotificationConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.createNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNotificationConfig with closed client', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createNotificationConfig(request), expectedError); + }); + }); + + describe('deleteNotificationConfig', () => { + it('invokes deleteNotificationConfig without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteNotificationConfig = stubSimpleCall(expectedResponse); + const [response] = await client.deleteNotificationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNotificationConfig without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteNotificationConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteNotificationConfig( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNotificationConfig with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNotificationConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteNotificationConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNotificationConfig with closed client', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteNotificationConfig(request), expectedError); + }); + }); + + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIamPolicy without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIamPolicy with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIamPolicy with closed client', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIamPolicy(request), expectedError); + }); + }); + + describe('getNotificationConfig', () => { + it('invokes getNotificationConfig without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig() + ); + client.innerApiCalls.getNotificationConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getNotificationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNotificationConfig without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig() + ); + client.innerApiCalls.getNotificationConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNotificationConfig( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNotificationConfig with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNotificationConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getNotificationConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.getNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNotificationConfig with closed client', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getNotificationConfig(request), expectedError); + }); + }); + + describe('getOrganizationSettings', () => { + it('invokes getOrganizationSettings without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.OrganizationSettings() + ); + client.innerApiCalls.getOrganizationSettings = stubSimpleCall(expectedResponse); + const [response] = await client.getOrganizationSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOrganizationSettings without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.OrganizationSettings() + ); + client.innerApiCalls.getOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getOrganizationSettings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOrganizationSettings with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getOrganizationSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getOrganizationSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getOrganizationSettings with closed client', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getOrganizationSettings(request), expectedError); + }); + }); + + describe('getSource', () => { + it('invokes getSource without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GetSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetSourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.Source() + ); + client.innerApiCalls.getSource = stubSimpleCall(expectedResponse); + const [response] = await client.getSource(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSource without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GetSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetSourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.Source() + ); + client.innerApiCalls.getSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSource( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSource with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GetSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetSourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSource(request), expectedError); + const actualRequest = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSource with closed client', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GetSourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetSourceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSource(request), expectedError); + }); + }); + + describe('setFindingState', () => { + it('invokes setFindingState without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.Finding() + ); + client.innerApiCalls.setFindingState = stubSimpleCall(expectedResponse); + const [response] = await client.setFindingState(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setFindingState without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.Finding() + ); + client.innerApiCalls.setFindingState = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setFindingState( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setFindingState with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setFindingState = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setFindingState(request), expectedError); + const actualRequest = (client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setFindingState with closed client', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setFindingState(request), expectedError); + }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setIamPolicy without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setIamPolicy with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setIamPolicy with closed client', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setIamPolicy(request), expectedError); + }); + }); + + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsResponse() + ); + client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes testIamPermissions without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsResponse() + ); + client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes testIamPermissions with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request), expectedError); + const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes testIamPermissions with closed client', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.testIamPermissions(request), expectedError); + }); + }); + + describe('updateFinding', () => { + it('invokes updateFinding without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest() + ); + request.finding ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest', ['finding', 'name']); + request.finding.name = defaultValue1; + const expectedHeaderRequestParams = `finding.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.Finding() + ); + client.innerApiCalls.updateFinding = stubSimpleCall(expectedResponse); + const [response] = await client.updateFinding(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFinding without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest() + ); + request.finding ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest', ['finding', 'name']); + request.finding.name = defaultValue1; + const expectedHeaderRequestParams = `finding.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.Finding() + ); + client.innerApiCalls.updateFinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFinding( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFinding with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest() + ); + request.finding ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest', ['finding', 'name']); + request.finding.name = defaultValue1; + const expectedHeaderRequestParams = `finding.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateFinding(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFinding with closed client', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest() + ); + request.finding ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest', ['finding', 'name']); + request.finding.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateFinding(request), expectedError); + }); + }); + + describe('updateNotificationConfig', () => { + it('invokes updateNotificationConfig without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest() + ); + request.notificationConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest', ['notificationConfig', 'name']); + request.notificationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `notification_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig() + ); + client.innerApiCalls.updateNotificationConfig = stubSimpleCall(expectedResponse); + const [response] = await client.updateNotificationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNotificationConfig without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest() + ); + request.notificationConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest', ['notificationConfig', 'name']); + request.notificationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `notification_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig() + ); + client.innerApiCalls.updateNotificationConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateNotificationConfig( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNotificationConfig with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest() + ); + request.notificationConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest', ['notificationConfig', 'name']); + request.notificationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `notification_config.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNotificationConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateNotificationConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.updateNotificationConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNotificationConfig with closed client', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest() + ); + request.notificationConfig ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest', ['notificationConfig', 'name']); + request.notificationConfig.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateNotificationConfig(request), expectedError); + }); + }); + + describe('updateOrganizationSettings', () => { + it('invokes updateOrganizationSettings without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest() + ); + request.organizationSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); + request.organizationSettings.name = defaultValue1; + const expectedHeaderRequestParams = `organization_settings.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.OrganizationSettings() + ); + client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(expectedResponse); + const [response] = await client.updateOrganizationSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateOrganizationSettings without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest() + ); + request.organizationSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); + request.organizationSettings.name = defaultValue1; + const expectedHeaderRequestParams = `organization_settings.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.OrganizationSettings() + ); + client.innerApiCalls.updateOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateOrganizationSettings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateOrganizationSettings with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest() + ); + request.organizationSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); + request.organizationSettings.name = defaultValue1; + const expectedHeaderRequestParams = `organization_settings.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateOrganizationSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateOrganizationSettings with closed client', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest() + ); + request.organizationSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); + request.organizationSettings.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateOrganizationSettings(request), expectedError); + }); + }); + + describe('updateSource', () => { + it('invokes updateSource without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest() + ); + request.source ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest', ['source', 'name']); + request.source.name = defaultValue1; + const expectedHeaderRequestParams = `source.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.Source() + ); + client.innerApiCalls.updateSource = stubSimpleCall(expectedResponse); + const [response] = await client.updateSource(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSource without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest() + ); + request.source ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest', ['source', 'name']); + request.source.name = defaultValue1; + const expectedHeaderRequestParams = `source.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.Source() + ); + client.innerApiCalls.updateSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSource( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSource with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest() + ); + request.source ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest', ['source', 'name']); + request.source.name = defaultValue1; + const expectedHeaderRequestParams = `source.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSource(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSource with closed client', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest() + ); + request.source ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest', ['source', 'name']); + request.source.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSource(request), expectedError); + }); + }); + + describe('updateSecurityMarks', () => { + it('invokes updateSecurityMarks without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest() + ); + request.securityMarks ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); + request.securityMarks.name = defaultValue1; + const expectedHeaderRequestParams = `security_marks.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.SecurityMarks() + ); + client.innerApiCalls.updateSecurityMarks = stubSimpleCall(expectedResponse); + const [response] = await client.updateSecurityMarks(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSecurityMarks without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest() + ); + request.securityMarks ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); + request.securityMarks.name = defaultValue1; + const expectedHeaderRequestParams = `security_marks.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.SecurityMarks() + ); + client.innerApiCalls.updateSecurityMarks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSecurityMarks( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSecurityMarks with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest() + ); + request.securityMarks ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); + request.securityMarks.name = defaultValue1; + const expectedHeaderRequestParams = `security_marks.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityMarks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSecurityMarks(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSecurityMarks with closed client', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest() + ); + request.securityMarks ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); + request.securityMarks.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSecurityMarks(request), expectedError); + }); + }); + + describe('runAssetDiscovery', () => { + it('invokes runAssetDiscovery without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(expectedResponse); + const [operation] = await client.runAssetDiscovery(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runAssetDiscovery without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.runAssetDiscovery( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runAssetDiscovery with call error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.runAssetDiscovery(request), expectedError); + const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runAssetDiscovery with LRO error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.runAssetDiscovery(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRunAssetDiscoveryProgress without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRunAssetDiscoveryProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRunAssetDiscoveryProgress with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRunAssetDiscoveryProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('groupAssets', () => { + it('invokes groupAssets without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + ]; + client.innerApiCalls.groupAssets = stubSimpleCall(expectedResponse); + const [response] = await client.groupAssets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes groupAssets without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + ]; + client.innerApiCalls.groupAssets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.groupAssets( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes groupAssets with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.groupAssets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.groupAssets(request), expectedError); + const actualRequest = (client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes groupAssetsStream without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + ]; + client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.groupAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.GroupResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); + assert( + (client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes groupAssetsStream with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.groupAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.GroupResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); + assert( + (client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with groupAssets without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + ]; + client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[] = []; + const iterable = client.groupAssetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with groupAssets with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.groupAssetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('groupFindings', () => { + it('invokes groupFindings without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + ]; + client.innerApiCalls.groupFindings = stubSimpleCall(expectedResponse); + const [response] = await client.groupFindings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes groupFindings without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + ]; + client.innerApiCalls.groupFindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.groupFindings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes groupFindings with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.groupFindings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.groupFindings(request), expectedError); + const actualRequest = (client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes groupFindingsStream without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + ]; + client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.groupFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.GroupResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); + assert( + (client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes groupFindingsStream with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.groupFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.GroupResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); + assert( + (client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with groupFindings without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + ]; + client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[] = []; + const iterable = client.groupFindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with groupFindings with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.groupFindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listAssets', () => { + it('invokes listAssets without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + ]; + client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); + const [response] = await client.listAssets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssets without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + ]; + client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAssets( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssets with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAssets(request), expectedError); + const actualRequest = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssetsStream without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + ]; + client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); + assert( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAssetsStream with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); + assert( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAssets without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + ]; + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[] = []; + const iterable = client.listAssetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAssets with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAssetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listFindings', () => { + it('invokes listFindings without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + ]; + client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); + const [response] = await client.listFindings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindings without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + ]; + client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindings with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFindings(request), expectedError); + const actualRequest = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingsStream without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + ]; + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFindingsStream with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFindings without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + ]; + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[] = []; + const iterable = client.listFindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFindings with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listNotificationConfigs', () => { + it('invokes listNotificationConfigs without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + ]; + client.innerApiCalls.listNotificationConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listNotificationConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNotificationConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNotificationConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNotificationConfigs without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + ]; + client.innerApiCalls.listNotificationConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNotificationConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNotificationConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNotificationConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNotificationConfigs with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNotificationConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNotificationConfigs(request), expectedError); + const actualRequest = (client.innerApiCalls.listNotificationConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNotificationConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNotificationConfigsStream without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + ]; + client.descriptors.page.listNotificationConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listNotificationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listNotificationConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNotificationConfigs, request)); + assert( + (client.descriptors.page.listNotificationConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listNotificationConfigsStream with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNotificationConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listNotificationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listNotificationConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNotificationConfigs, request)); + assert( + (client.descriptors.page.listNotificationConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNotificationConfigs without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + ]; + client.descriptors.page.listNotificationConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[] = []; + const iterable = client.listNotificationConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNotificationConfigs with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNotificationConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNotificationConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listSources', () => { + it('invokes listSources without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + ]; + client.innerApiCalls.listSources = stubSimpleCall(expectedResponse); + const [response] = await client.listSources(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSources without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + ]; + client.innerApiCalls.listSources = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSources( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISource[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSources with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSources = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSources(request), expectedError); + const actualRequest = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSourcesStream without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + ]; + client.descriptors.page.listSources.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.Source[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.Source) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSources, request)); + assert( + (client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listSourcesStream with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSources.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.Source[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.Source) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSources, request)); + assert( + (client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSources without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + ]; + client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1p1beta1.ISource[] = []; + const iterable = client.listSourcesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSources with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSourcesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.ISource[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('folderAsset', () => { + const fakePath = "/rendered/path/folderAsset"; + const expectedParameters = { + folder: "folderValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAssetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderAssetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderAssetPath', () => { + const result = client.folderAssetPath("folderValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderAssetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderAssetName', () => { + const result = client.matchFolderFromFolderAssetName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromFolderAssetName', () => { + const result = client.matchAssetFromFolderAssetName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.folderAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderAssetSecurityMarks', () => { + const fakePath = "/rendered/path/folderAssetSecurityMarks"; + const expectedParameters = { + folder: "folderValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAssetSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderAssetSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderAssetSecurityMarksPath', () => { + const result = client.folderAssetSecurityMarksPath("folderValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderAssetSecurityMarksName', () => { + const result = client.matchFolderFromFolderAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromFolderAssetSecurityMarksName', () => { + const result = client.matchAssetFromFolderAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSource', () => { + const fakePath = "/rendered/path/folderSource"; + const expectedParameters = { + folder: "folderValue", + source: "sourceValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSourcePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSourcePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSourcePath', () => { + const result = client.folderSourcePath("folderValue", "sourceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSourcePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSourceName', () => { + const result = client.matchFolderFromFolderSourceName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromFolderSourceName', () => { + const result = client.matchSourceFromFolderSourceName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.folderSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSourceFinding', () => { + const fakePath = "/rendered/path/folderSourceFinding"; + const expectedParameters = { + folder: "folderValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSourceFindingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSourceFindingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSourceFindingPath', () => { + const result = client.folderSourceFindingPath("folderValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSourceFindingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSourceFindingName', () => { + const result = client.matchFolderFromFolderSourceFindingName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromFolderSourceFindingName', () => { + const result = client.matchSourceFromFolderSourceFindingName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromFolderSourceFindingName', () => { + const result = client.matchFindingFromFolderSourceFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSourceFindingSecurityMarks', () => { + const fakePath = "/rendered/path/folderSourceFindingSecurityMarks"; + const expectedParameters = { + folder: "folderValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSourceFindingSecurityMarksPath', () => { + const result = client.folderSourceFindingSecurityMarksPath("folderValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSourceFindingSecurityMarksName', () => { + const result = client.matchFolderFromFolderSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromFolderSourceFindingSecurityMarksName', () => { + const result = client.matchSourceFromFolderSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromFolderSourceFindingSecurityMarksName', () => { + const result = client.matchFindingFromFolderSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('notificationConfig', () => { + const fakePath = "/rendered/path/notificationConfig"; + const expectedParameters = { + organization: "organizationValue", + notification_config: "notificationConfigValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.notificationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.notificationConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('notificationConfigPath', () => { + const result = client.notificationConfigPath("organizationValue", "notificationConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.notificationConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromNotificationConfigName', () => { + const result = client.matchOrganizationFromNotificationConfigName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.notificationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNotificationConfigFromNotificationConfigName', () => { + const result = client.matchNotificationConfigFromNotificationConfigName(fakePath); + assert.strictEqual(result, "notificationConfigValue"); + assert((client.pathTemplates.notificationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organization', () => { + const fakePath = "/rendered/path/organization"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationPath', () => { + const result = client.organizationPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationName', () => { + const result = client.matchOrganizationFromOrganizationName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationAsset', () => { + const fakePath = "/rendered/path/organizationAsset"; + const expectedParameters = { + organization: "organizationValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAssetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAssetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAssetPath', () => { + const result = client.organizationAssetPath("organizationValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationAssetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationAssetName', () => { + const result = client.matchOrganizationFromOrganizationAssetName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromOrganizationAssetName', () => { + const result = client.matchAssetFromOrganizationAssetName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.organizationAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationAssetSecurityMarks', () => { + const fakePath = "/rendered/path/organizationAssetSecurityMarks"; + const expectedParameters = { + organization: "organizationValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAssetSecurityMarksPath', () => { + const result = client.organizationAssetSecurityMarksPath("organizationValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationAssetSecurityMarksName', () => { + const result = client.matchOrganizationFromOrganizationAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromOrganizationAssetSecurityMarksName', () => { + const result = client.matchAssetFromOrganizationAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSettings', () => { + const fakePath = "/rendered/path/organizationSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSettingsPath', () => { + const result = client.organizationSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSettingsName', () => { + const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSource', () => { + const fakePath = "/rendered/path/organizationSource"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSourcePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSourcePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSourcePath', () => { + const result = client.organizationSourcePath("organizationValue", "sourceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSourcePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSourceName', () => { + const result = client.matchOrganizationFromOrganizationSourceName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromOrganizationSourceName', () => { + const result = client.matchSourceFromOrganizationSourceName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.organizationSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSourceFinding', () => { + const fakePath = "/rendered/path/organizationSourceFinding"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSourceFindingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSourceFindingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSourceFindingPath', () => { + const result = client.organizationSourceFindingPath("organizationValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSourceFindingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSourceFindingName', () => { + const result = client.matchOrganizationFromOrganizationSourceFindingName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromOrganizationSourceFindingName', () => { + const result = client.matchSourceFromOrganizationSourceFindingName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromOrganizationSourceFindingName', () => { + const result = client.matchFindingFromOrganizationSourceFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSourceFindingSecurityMarks', () => { + const fakePath = "/rendered/path/organizationSourceFindingSecurityMarks"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSourceFindingSecurityMarksPath', () => { + const result = client.organizationSourceFindingSecurityMarksPath("organizationValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSourceFindingSecurityMarksName', () => { + const result = client.matchOrganizationFromOrganizationSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromOrganizationSourceFindingSecurityMarksName', () => { + const result = client.matchSourceFromOrganizationSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromOrganizationSourceFindingSecurityMarksName', () => { + const result = client.matchFindingFromOrganizationSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAsset', () => { + const fakePath = "/rendered/path/projectAsset"; + const expectedParameters = { + project: "projectValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAssetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAssetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAssetPath', () => { + const result = client.projectAssetPath("projectValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAssetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAssetName', () => { + const result = client.matchProjectFromProjectAssetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromProjectAssetName', () => { + const result = client.matchAssetFromProjectAssetName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.projectAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAssetSecurityMarks', () => { + const fakePath = "/rendered/path/projectAssetSecurityMarks"; + const expectedParameters = { + project: "projectValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAssetSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAssetSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAssetSecurityMarksPath', () => { + const result = client.projectAssetSecurityMarksPath("projectValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAssetSecurityMarksName', () => { + const result = client.matchProjectFromProjectAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromProjectAssetSecurityMarksName', () => { + const result = client.matchAssetFromProjectAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSource', () => { + const fakePath = "/rendered/path/projectSource"; + const expectedParameters = { + project: "projectValue", + source: "sourceValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSourcePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSourcePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSourcePath', () => { + const result = client.projectSourcePath("projectValue", "sourceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSourcePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSourceName', () => { + const result = client.matchProjectFromProjectSourceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromProjectSourceName', () => { + const result = client.matchSourceFromProjectSourceName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.projectSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSourceFinding', () => { + const fakePath = "/rendered/path/projectSourceFinding"; + const expectedParameters = { + project: "projectValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSourceFindingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSourceFindingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSourceFindingPath', () => { + const result = client.projectSourceFindingPath("projectValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSourceFindingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSourceFindingName', () => { + const result = client.matchProjectFromProjectSourceFindingName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromProjectSourceFindingName', () => { + const result = client.matchSourceFromProjectSourceFindingName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromProjectSourceFindingName', () => { + const result = client.matchFindingFromProjectSourceFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSourceFindingSecurityMarks', () => { + const fakePath = "/rendered/path/projectSourceFindingSecurityMarks"; + const expectedParameters = { + project: "projectValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSourceFindingSecurityMarksPath', () => { + const result = client.projectSourceFindingSecurityMarksPath("projectValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSourceFindingSecurityMarksName', () => { + const result = client.matchProjectFromProjectSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromProjectSourceFindingSecurityMarksName', () => { + const result = client.matchSourceFromProjectSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromProjectSourceFindingSecurityMarksName', () => { + const result = client.matchFindingFromProjectSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/tsconfig.json b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/webpack.config.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/webpack.config.js new file mode 100644 index 00000000000..4aeca8bf63a --- /dev/null +++ b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 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 +// +// https://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. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'SecurityCenter', + filename: './security-center.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; From 25f56daa0c4ede65432c147e55ca1971cfde7995 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 20 Apr 2023 20:10:13 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .../v1/.eslintignore | 7 - .../v1/.eslintrc.json | 3 - .../google-cloud-securitycenter/v1/.gitignore | 14 - .../google-cloud-securitycenter/v1/.jsdoc.js | 55 - .../v1/.mocharc.js | 33 - .../v1/.prettierrc.js | 22 - .../google-cloud-securitycenter/v1/README.md | 1 - .../v1/linkinator.config.json | 16 - .../v1/package.json | 64 - .../cloud/securitycenter/v1/access.proto | 108 - .../cloud/securitycenter/v1/asset.proto | 134 - .../securitycenter/v1/bigquery_export.proto | 101 - .../cloud/securitycenter/v1/compliance.proto | 39 - .../cloud/securitycenter/v1/connection.proto | 66 - .../securitycenter/v1/contact_details.proto | 37 - .../cloud/securitycenter/v1/container.proto | 45 - .../cloud/securitycenter/v1/database.proto | 52 - ...urity_health_analytics_custom_module.proto | 81 - .../securitycenter/v1/exfiltration.proto | 52 - .../securitycenter/v1/external_system.proto | 58 - .../google/cloud/securitycenter/v1/file.proto | 52 - .../cloud/securitycenter/v1/finding.proto | 362 - .../cloud/securitycenter/v1/folder.proto | 36 - .../cloud/securitycenter/v1/iam_binding.proto | 52 - .../cloud/securitycenter/v1/indicator.proto | 83 - .../securitycenter/v1/kernel_rootkit.proto | 62 - .../cloud/securitycenter/v1/kubernetes.proto | 181 - .../cloud/securitycenter/v1/label.proto | 35 - .../securitycenter/v1/mitre_attack.proto | 211 - .../cloud/securitycenter/v1/mute_config.proto | 91 - .../v1/notification_config.proto | 99 - .../v1/notification_message.proto | 44 - .../v1/organization_settings.proto | 85 - .../cloud/securitycenter/v1/process.proto | 74 - .../cloud/securitycenter/v1/resource.proto | 58 - .../v1/run_asset_discovery_response.proto | 51 - ...urity_health_analytics_custom_config.proto | 101 - ...urity_health_analytics_custom_module.proto | 110 - .../securitycenter/v1/security_marks.proto | 69 - .../v1/securitycenter_service.proto | 2215 ----- .../cloud/securitycenter/v1/source.proto | 69 - .../securitycenter/v1/vulnerability.proto | 216 - .../v1/security_center.bulk_mute_findings.js | 87 - ...security_center.create_big_query_export.js | 76 - .../v1/security_center.create_finding.js | 75 - .../v1/security_center.create_mute_config.js | 76 - ...urity_center.create_notification_config.js | 78 - ...security_health_analytics_custom_module.js | 71 - .../v1/security_center.create_source.js | 68 - ...security_center.delete_big_query_export.js | 64 - .../v1/security_center.delete_mute_config.js | 64 - ...urity_center.delete_notification_config.js | 64 - ...security_health_analytics_custom_module.js | 65 - .../security_center.get_big_query_export.js | 64 - ...security_health_analytics_custom_module.js | 65 - .../v1/security_center.get_iam_policy.js | 67 - .../v1/security_center.get_mute_config.js | 64 - ...security_center.get_notification_config.js | 64 - ...curity_center.get_organization_settings.js | 62 - ...security_health_analytics_custom_module.js | 65 - .../v1/security_center.get_source.js | 62 - .../v1/security_center.group_assets.js | 176 - .../v1/security_center.group_findings.js | 180 - .../v1/security_center.list_assets.js | 187 - .../security_center.list_big_query_exports.js | 79 - ...ecurity_health_analytics_custom_modules.js | 75 - ...ecurity_health_analytics_custom_modules.js | 75 - .../v1/security_center.list_findings.js | 191 - .../v1/security_center.list_mute_configs.js | 79 - ...curity_center.list_notification_configs.js | 76 - ...ecurity_health_analytics_custom_modules.js | 75 - .../v1/security_center.list_sources.js | 76 - .../v1/security_center.run_asset_discovery.js | 63 - .../v1/security_center.set_finding_state.js | 76 - .../v1/security_center.set_iam_policy.js | 77 - .../generated/v1/security_center.set_mute.js | 71 - .../security_center.test_iam_permissions.js | 70 - ...security_center.update_big_query_export.js | 66 - .../security_center.update_external_system.js | 66 - .../v1/security_center.update_finding.js | 74 - .../v1/security_center.update_mute_config.js | 66 - ...urity_center.update_notification_config.js | 66 - ...ity_center.update_organization_settings.js | 66 - ...security_health_analytics_custom_module.js | 65 - .../security_center.update_security_marks.js | 75 - .../v1/security_center.update_source.js | 66 - ...tadata.google.cloud.securitycenter.v1.json | 2051 ---- .../v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 507 - .../v1/src/v1/index.ts | 19 - .../v1/src/v1/security_center_client.ts | 8207 ---------------- .../src/v1/security_center_client_config.json | 233 - .../v1/src/v1/security_center_proto_list.json | 37 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../v1/test/gapic_security_center_v1.ts | 8298 ----------------- .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v1beta1/.eslintignore | 7 - .../v1beta1/.eslintrc.json | 3 - .../v1beta1/.gitignore | 14 - .../v1beta1/.jsdoc.js | 55 - .../v1beta1/.mocharc.js | 33 - .../v1beta1/.prettierrc.js | 22 - .../v1beta1/README.md | 1 - .../v1beta1/linkinator.config.json | 16 - .../v1beta1/package.json | 64 - .../cloud/securitycenter/v1beta1/asset.proto | 92 - .../securitycenter/v1beta1/finding.proto | 109 - .../v1beta1/organization_settings.proto | 78 - .../run_asset_discovery_response.proto | 48 - .../v1beta1/security_marks.proto | 52 - .../v1beta1/securitycenter_service.proto | 823 -- .../cloud/securitycenter/v1beta1/source.proto | 55 - .../v1beta1/security_center.create_finding.js | 75 - .../v1beta1/security_center.create_source.js | 68 - .../v1beta1/security_center.get_iam_policy.js | 67 - ...curity_center.get_organization_settings.js | 62 - .../v1beta1/security_center.get_source.js | 62 - .../v1beta1/security_center.group_assets.js | 139 - .../v1beta1/security_center.group_findings.js | 118 - .../v1beta1/security_center.list_assets.js | 144 - .../v1beta1/security_center.list_findings.js | 121 - .../v1beta1/security_center.list_sources.js | 75 - .../security_center.run_asset_discovery.js | 63 - .../security_center.set_finding_state.js | 74 - .../v1beta1/security_center.set_iam_policy.js | 77 - .../security_center.test_iam_permissions.js | 70 - .../v1beta1/security_center.update_finding.js | 70 - ...ity_center.update_organization_settings.js | 65 - .../security_center.update_security_marks.js | 69 - .../v1beta1/security_center.update_source.js | 65 - ...a.google.cloud.securitycenter.v1beta1.json | 895 -- .../v1beta1/src/index.ts | 25 - .../v1beta1/src/v1beta1/gapic_metadata.json | 223 - .../v1beta1/src/v1beta1/index.ts | 19 - .../src/v1beta1/security_center_client.ts | 3268 ------- .../security_center_client_config.json | 116 - .../v1beta1/security_center_proto_list.json | 9 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1beta1/system-test/install.ts | 49 - .../test/gapic_security_center_v1beta1.ts | 3173 ------- .../v1beta1/tsconfig.json | 19 - .../v1beta1/webpack.config.js | 64 - .../v1p1beta1/.eslintignore | 7 - .../v1p1beta1/.eslintrc.json | 3 - .../v1p1beta1/.gitignore | 14 - .../v1p1beta1/.jsdoc.js | 55 - .../v1p1beta1/.mocharc.js | 33 - .../v1p1beta1/.prettierrc.js | 22 - .../v1p1beta1/README.md | 1 - .../v1p1beta1/linkinator.config.json | 16 - .../v1p1beta1/package.json | 64 - .../securitycenter/v1p1beta1/asset.proto | 134 - .../securitycenter/v1p1beta1/finding.proto | 145 - .../securitycenter/v1p1beta1/folder.proto | 37 - .../v1p1beta1/notification_config.proto | 107 - .../v1p1beta1/notification_message.proto | 43 - .../v1p1beta1/organization_settings.proto | 85 - .../securitycenter/v1p1beta1/resource.proto | 52 - .../run_asset_discovery_response.proto | 51 - .../v1p1beta1/security_marks.proto | 69 - .../v1p1beta1/securitycenter_service.proto | 1351 --- .../securitycenter/v1p1beta1/source.proto | 68 - .../security_center.create_finding.js | 73 - ...urity_center.create_notification_config.js | 75 - .../security_center.create_source.js | 68 - ...urity_center.delete_notification_config.js | 62 - .../security_center.get_iam_policy.js | 67 - ...security_center.get_notification_config.js | 62 - ...curity_center.get_organization_settings.js | 62 - .../v1p1beta1/security_center.get_source.js | 62 - .../v1p1beta1/security_center.group_assets.js | 176 - .../security_center.group_findings.js | 172 - .../v1p1beta1/security_center.list_assets.js | 185 - .../security_center.list_findings.js | 181 - ...curity_center.list_notification_configs.js | 75 - .../v1p1beta1/security_center.list_sources.js | 76 - .../security_center.run_asset_discovery.js | 63 - .../security_center.set_finding_state.js | 74 - .../security_center.set_iam_policy.js | 77 - .../security_center.test_iam_permissions.js | 70 - .../security_center.update_finding.js | 74 - ...urity_center.update_notification_config.js | 66 - ...ity_center.update_organization_settings.js | 66 - .../security_center.update_security_marks.js | 74 - .../security_center.update_source.js | 66 - ...google.cloud.securitycenter.v1p1beta1.json | 1123 --- .../v1p1beta1/src/index.ts | 25 - .../src/v1p1beta1/gapic_metadata.json | 277 - .../v1p1beta1/src/v1p1beta1/index.ts | 19 - .../src/v1p1beta1/security_center_client.ts | 4943 ---------- .../security_center_client_config.json | 141 - .../v1p1beta1/security_center_proto_list.json | 13 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1p1beta1/system-test/install.ts | 49 - .../test/gapic_security_center_v1p1beta1.ts | 4304 --------- .../v1p1beta1/tsconfig.json | 19 - .../v1p1beta1/webpack.config.js | 64 - .../cloud/securitycenter/v1/access.proto | 57 +- .../v1/cloud_dlp_data_profile.proto | 0 .../v1/cloud_dlp_inspection.proto | 0 .../cloud/securitycenter/v1/finding.proto | 53 +- .../v1/securitycenter_service.proto | 24 +- .../protos/protos.d.ts | 224 + .../protos/protos.js | 546 ++ .../protos/protos.json | 42 + ...tadata.google.cloud.securitycenter.v1.json | 4 +- ...a.google.cloud.securitycenter.v1beta1.json | 2 +- ...google.cloud.securitycenter.v1p1beta1.json | 2 +- .../src/v1/security_center_client.ts | 2 +- .../src/v1/security_center_proto_list.json | 2 + 215 files changed, 891 insertions(+), 54810 deletions(-) delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/access.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/asset.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/bigquery_export.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/compliance.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/connection.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/contact_details.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/container.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/database.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/effective_security_health_analytics_custom_module.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/exfiltration.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/external_system.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/file.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/finding.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/folder.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/iam_binding.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/indicator.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/kernel_rootkit.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/kubernetes.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/label.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/mitre_attack.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/mute_config.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/notification_config.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/notification_message.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/organization_settings.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/process.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/resource.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_health_analytics_custom_config.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_health_analytics_custom_module.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_marks.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/securitycenter_service.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/source.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/vulnerability.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.bulk_mute_findings.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_big_query_export.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_finding.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_mute_config.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_notification_config.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_security_health_analytics_custom_module.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_source.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_big_query_export.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_mute_config.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_notification_config.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_security_health_analytics_custom_module.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_big_query_export.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_effective_security_health_analytics_custom_module.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_iam_policy.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_mute_config.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_notification_config.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_organization_settings.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_security_health_analytics_custom_module.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_source.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.group_assets.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.group_findings.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_assets.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_big_query_exports.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_descendant_security_health_analytics_custom_modules.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_effective_security_health_analytics_custom_modules.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_findings.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_mute_configs.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_notification_configs.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_security_health_analytics_custom_modules.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_sources.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.run_asset_discovery.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_finding_state.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_iam_policy.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_mute.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.test_iam_permissions.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_big_query_export.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_external_system.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_finding.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_mute_config.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_notification_config.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_organization_settings.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_security_health_analytics_custom_module.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_security_marks.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_source.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_client.ts delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_client_config.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/test/gapic_security_center_v1.ts delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/README.md delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/package.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/asset.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/finding.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/organization_settings.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/security_marks.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/source.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.create_finding.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.create_source.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_iam_policy.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_organization_settings.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_source.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.group_assets.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.group_findings.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_assets.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_findings.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_sources.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.run_asset_discovery.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.set_finding_state.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.set_iam_policy.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.test_iam_permissions.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_finding.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_organization_settings.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_security_marks.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_source.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/index.ts delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_client.ts delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_client_config.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/test/gapic_security_center_v1beta1.ts delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1beta1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/README.md delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/package.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/asset.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/finding.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/folder.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/resource.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/source.proto delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_finding.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_notification_config.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_source.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.delete_notification_config.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_iam_policy.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_notification_config.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_organization_settings.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_source.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.group_assets.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.group_findings.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_assets.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_findings.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_notification_configs.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_sources.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.run_asset_discovery.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.set_finding_state.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.set_iam_policy.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.test_iam_permissions.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_finding.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_notification_config.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_organization_settings.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_security_marks.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_source.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/index.ts delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_client.ts delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_client_config.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/test/gapic_security_center_v1p1beta1.ts delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-securitycenter/v1p1beta1/webpack.config.js rename {owl-bot-staging/google-cloud-securitycenter/v1 => packages/google-cloud-securitycenter}/protos/google/cloud/securitycenter/v1/cloud_dlp_data_profile.proto (100%) rename {owl-bot-staging/google-cloud-securitycenter/v1 => packages/google-cloud-securitycenter}/protos/google/cloud/securitycenter/v1/cloud_dlp_inspection.proto (100%) diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/.eslintignore b/owl-bot-staging/google-cloud-securitycenter/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/.eslintrc.json b/owl-bot-staging/google-cloud-securitycenter/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/.gitignore b/owl-bot-staging/google-cloud-securitycenter/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/.jsdoc.js b/owl-bot-staging/google-cloud-securitycenter/v1/.jsdoc.js deleted file mode 100644 index 4d5ad9781e7..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2023 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/security-center', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/.mocharc.js b/owl-bot-staging/google-cloud-securitycenter/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/.prettierrc.js b/owl-bot-staging/google-cloud-securitycenter/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/README.md b/owl-bot-staging/google-cloud-securitycenter/v1/README.md deleted file mode 100644 index 73f34764a12..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Securitycenter: Nodejs Client diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/linkinator.config.json b/owl-bot-staging/google-cloud-securitycenter/v1/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/package.json b/owl-bot-staging/google-cloud-securitycenter/v1/package.json deleted file mode 100644 index efcfeb4e7ad..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/security-center", - "version": "0.1.0", - "description": "Securitycenter client for Node.js", - "repository": "googleapis/nodejs-securitycenter", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google securitycenter", - "securitycenter", - "security center" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.5.7" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^4.0.0", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.1.2", - "mocha": "^10.2.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.0.1", - "ts-loader": "^8.4.0", - "typescript": "^4.8.4", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/access.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/access.proto deleted file mode 100644 index d30e670f5a6..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/access.proto +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "AccessProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Represents an access event. -message Access { - // Associated email, such as "foo@google.com". - // - // The email address of the authenticated user or a service account acting on - // behalf of a third party principal making the request. For third party - // identity callers, the `principal_subject` field is populated instead of - // this field. For privacy reasons, the principal email address is sometimes - // redacted. For more information, see [Caller identities in audit - // logs](https://cloud.google.com/logging/docs/audit#user-id). - string principal_email = 1; - - // Caller's IP address, such as "1.1.1.1". - string caller_ip = 2; - - // The caller IP's geolocation, which identifies where the call came from. - Geolocation caller_ip_geo = 3; - - // Type of user agent associated with the finding. For example, an operating - // system shell or an embedded or standalone application. - string user_agent_family = 4; - - // This is the API service that the service account made a call to, e.g. - // "iam.googleapis.com" - string service_name = 5; - - // The method that the service account called, e.g. "SetIamPolicy". - string method_name = 6; - - // A string that represents the principal_subject that is associated with the - // identity. Unlike `principal_email`, `principal_subject` supports principals - // that aren't associated with email addresses, such as third party - // principals. For most identities, the format is - // `principal://iam.googleapis.com/{identity pool name}/subject/{subject}`. - // Some GKE identities, such as GKE_WORKLOAD, FREEFORM, and GKE_HUB_WORKLOAD, - // still use the legacy format `serviceAccount:{identity pool - // name}[{subject}]`. - string principal_subject = 7; - - // The name of the service account key that was used to create or exchange - // credentials when authenticating the service account that made the request. - // This is a scheme-less URI full resource name. For example: - // - // "//iam.googleapis.com/projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}". - // - string service_account_key_name = 8; - - // The identity delegation history of an authenticated service account that - // made the request. The `serviceAccountDelegationInfo[]` object contains - // information about the real authorities that try to access Google Cloud - // resources by delegating on a service account. When multiple authorities are - // present, they are guaranteed to be sorted based on the original ordering of - // the identity delegation events. - repeated ServiceAccountDelegationInfo service_account_delegation_info = 9; - - // A string that represents a username. The username provided depends on the - // type of the finding and is likely not an IAM principal. For example, this - // can be a system username if the finding is related to a virtual machine, or - // it can be an application login username. - string user_name = 11; -} - -// Identity delegation history of an authenticated service account. -message ServiceAccountDelegationInfo { - // The email address of a Google account. - string principal_email = 1; - - // A string representing the principal_subject associated with the identity. - // As compared to `principal_email`, supports principals that aren't - // associated with email addresses, such as third party principals. For most - // identities, the format will be `principal://iam.googleapis.com/{identity - // pool name}/subjects/{subject}` except for some GKE identities - // (GKE_WORKLOAD, FREEFORM, GKE_HUB_WORKLOAD) that are still in the legacy - // format `serviceAccount:{identity pool name}[{subject}]` - string principal_subject = 2; -} - -// Represents a geographical location for a given access. -message Geolocation { - // A CLDR. - string region_code = 1; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/asset.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/asset.proto deleted file mode 100644 index 01462175af3..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/asset.proto +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1/folder.proto"; -import "google/cloud/securitycenter/v1/security_marks.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Security Command Center representation of a Google Cloud -// resource. -// -// The Asset is a Security Command Center resource that captures information -// about a single Google Cloud resource. All modifications to an Asset are only -// within the context of Security Command Center and don't affect the referenced -// Google Cloud resource. -message Asset { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/Asset" - pattern: "organizations/{organization}/assets/{asset}" - pattern: "folders/{folder}/assets/{asset}" - pattern: "projects/{project}/assets/{asset}" - }; - - // Security Command Center managed properties. These properties are managed by - // Security Command Center and cannot be modified by the user. - message SecurityCenterProperties { - // The full resource name of the Google Cloud resource this asset - // represents. This field is immutable after create time. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_name = 1; - - // The type of the Google Cloud resource. Examples include: APPLICATION, - // PROJECT, and ORGANIZATION. This is a case insensitive field defined by - // Security Command Center and/or the producer of the resource and is - // immutable after create time. - string resource_type = 2; - - // The full resource name of the immediate parent of the resource. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_parent = 3; - - // The full resource name of the project the resource belongs to. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_project = 4; - - // Owners of the Google Cloud resource. - repeated string resource_owners = 5; - - // The user defined display name for this resource. - string resource_display_name = 6; - - // The user defined display name for the parent of this resource. - string resource_parent_display_name = 7; - - // The user defined display name for the project of this resource. - string resource_project_display_name = 8; - - // Contains a Folder message for each folder in the assets ancestry. - // The first folder is the deepest nested folder, and the last folder is the - // folder directly under the Organization. - repeated Folder folders = 10; - } - - // Cloud IAM Policy information associated with the Google Cloud resource - // described by the Security Command Center asset. This information is managed - // and defined by the Google Cloud resource and cannot be modified by the - // user. - message IamPolicy { - // The JSON representation of the Policy associated with the asset. - // See https://cloud.google.com/iam/reference/rest/v1/Policy for format - // details. - string policy_blob = 1; - } - - // The relative resource name of this asset. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/assets/{asset_id}". - string name = 1; - - // Security Command Center managed properties. These properties are managed by - // Security Command Center and cannot be modified by the user. - SecurityCenterProperties security_center_properties = 2; - - // Resource managed properties. These properties are managed and defined by - // the Google Cloud resource and cannot be modified by the user. - map resource_properties = 7; - - // User specified security marks. These marks are entirely managed by the user - // and come from the SecurityMarks resource that belongs to the asset. - SecurityMarks security_marks = 8; - - // The time at which the asset was created in Security Command Center. - google.protobuf.Timestamp create_time = 9; - - // The time at which the asset was last updated or added in Cloud SCC. - google.protobuf.Timestamp update_time = 10; - - // Cloud IAM Policy information associated with the Google Cloud resource - // described by the Security Command Center asset. This information is managed - // and defined by the Google Cloud resource and cannot be modified by the - // user. - IamPolicy iam_policy = 11; - - // The canonical name of the resource. It's either - // "organizations/{organization_id}/assets/{asset_id}", - // "folders/{folder_id}/assets/{asset_id}" or - // "projects/{project_number}/assets/{asset_id}", depending on the closest CRM - // ancestor of the resource. - string canonical_name = 13; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/bigquery_export.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/bigquery_export.proto deleted file mode 100644 index 8299f05e49f..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/bigquery_export.proto +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "BigQueryExportProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Configures how to deliver Findings to BigQuery Instance. -message BigQueryExport { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/BigQueryExport" - pattern: "organizations/{organization}/bigQueryExports/{export}" - pattern: "folders/{folder}/bigQueryExports/{export}" - pattern: "projects/{project}/bigQueryExports/{export}" - }; - - // 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. - string name = 1; - - // The description of the export (max of 1024 characters). - string description = 2; - - // 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. - string filter = 3; - - // 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 (_). - string dataset = 4; - - // Output only. The time at which the BigQuery export was created. - // This field is set by the server and will be ignored if provided on export - // on creation. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The most recent time at which the BigQuery export was updated. - // This field is set by the server and will be ignored if provided on export - // creation or update. - google.protobuf.Timestamp update_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Email address of the user who last edited the BigQuery export. - // This field is set by the server and will be ignored if provided on export - // creation or update. - string most_recent_editor = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The service account that needs permission to create table and - // upload data to the BigQuery dataset. - string principal = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/compliance.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/compliance.proto deleted file mode 100644 index bc183bb5e37..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/compliance.proto +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "ComplianceProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Contains compliance information about a security standard indicating unmet -// recommendations. -message Compliance { - // Refers to industry wide standards or benchmarks e.g. "cis", "pci", "owasp", - // etc. - string standard = 1; - - // Version of the standard/benchmark e.g. 1.1 - string version = 2; - - // Policies within the standard/benchmark e.g. A.12.4.1 - repeated string ids = 3; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/connection.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/connection.proto deleted file mode 100644 index 43a2115674c..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/connection.proto +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "ConnectionProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Contains information about the IP connection associated with the finding. -message Connection { - // IANA Internet Protocol Number such as TCP(6) and UDP(17). - enum Protocol { - // Unspecified protocol (not HOPOPT). - PROTOCOL_UNSPECIFIED = 0; - - // Internet Control Message Protocol. - ICMP = 1; - - // Transmission Control Protocol. - TCP = 6; - - // User Datagram Protocol. - UDP = 17; - - // Generic Routing Encapsulation. - GRE = 47; - - // Encap Security Payload. - ESP = 50; - } - - // Destination IP address. Not present for sockets that are listening and not - // connected. - string destination_ip = 1; - - // Destination port. Not present for sockets that are listening and not - // connected. - int32 destination_port = 2; - - // Source IP address. - string source_ip = 3; - - // Source port. - int32 source_port = 4; - - // IANA Internet Protocol Number such as TCP(6) and UDP(17). - Protocol protocol = 5; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/contact_details.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/contact_details.proto deleted file mode 100644 index 741ad8fae1d..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/contact_details.proto +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "ContactDetailsProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// The details pertaining to specific contacts -message ContactDetails { - // A list of contacts - repeated Contact contacts = 1; -} - -// The email address of a contact. -message Contact { - // An email address. For example, "`person123@company.com`". - string email = 1; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/container.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/container.proto deleted file mode 100644 index c90168991f6..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/container.proto +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/cloud/securitycenter/v1/label.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "ContainerProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Container associated with the finding. -message Container { - // Container name. - string name = 1; - - // Container image URI provided when configuring a pod/container. - // May identify a container image version using mutable tags. - string uri = 2; - - // Optional container image id, when provided by the container runtime. - // Uniquely identifies the container image launched using a container image - // digest. - string image_id = 3; - - // Container labels, as provided by the container runtime. - repeated Label labels = 4; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/database.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/database.proto deleted file mode 100644 index 70bf3516103..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/database.proto +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "DatabaseProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Represents database access information, such as queries. -// A database may be a sub-resource of an instance (as in the case of CloudSQL -// instances or Cloud Spanner instances), or the database instance itself. -// Some database resources may not have the full resource name populated -// because these resource types are not yet supported by Cloud Asset Inventory -// (e.g. CloudSQL databases). In these cases only the display name will be -// provided. -message Database { - // The full resource name of the database the user connected to, if it is - // supported by CAI. (https://google.aip.dev/122#full-resource-names) - string name = 1; - - // The human readable name of the database the user connected to. - string display_name = 2; - - // The username used to connect to the DB. This may not necessarily be an IAM - // principal, and has no required format. - string user_name = 3; - - // The SQL statement associated with the relevant access. - string query = 4; - - // The target usernames/roles/groups of a SQL privilege grant (not an IAM - // policy change). - repeated string grantees = 5; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/effective_security_health_analytics_custom_module.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/effective_security_health_analytics_custom_module.proto deleted file mode 100644 index 3c5cc8af3b0..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/effective_security_health_analytics_custom_module.proto +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1/security_health_analytics_custom_config.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "EffectiveSecurityHealthAnalyticsCustomModuleProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// An EffectiveSecurityHealthAnalyticsCustomModule is the representation of -// a Security Health Analytics custom module at a specified level of the -// resource hierarchy: organization, folder, or project. If a custom module is -// inherited from a parent organization or folder, the value of the -// `enablementState` property in EffectiveSecurityHealthAnalyticsCustomModule is -// set to the value that is effective in the parent, instead of `INHERITED`. -// For example, if the module is enabled in a parent organization or folder, the -// effective enablement_state for the module in all child folders or projects is -// also `enabled`. EffectiveSecurityHealthAnalyticsCustomModule is read-only. -message EffectiveSecurityHealthAnalyticsCustomModule { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/EffectiveSecurityHealthAnalyticsCustomModule" - pattern: "organizations/{organization}/securityHealthAnalyticsSettings/effectiveCustomModules/{effective_custom_module}" - pattern: "folders/{folder}/securityHealthAnalyticsSettings/effectiveCustomModules/{effective_custom_module}" - pattern: "projects/{project}/securityHealthAnalyticsSettings/effectiveCustomModules/{effective_custom_module}" - }; - - // The enablement state of the module. - enum EnablementState { - // Unspecified enablement state. - ENABLEMENT_STATE_UNSPECIFIED = 0; - - // The module is enabled at the given level. - ENABLED = 1; - - // The module is disabled at the given level. - DISABLED = 2; - } - - // Output only. The resource name of the custom module. - // Its format is - // "organizations/{organization}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}", - // or - // "folders/{folder}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}", - // or - // "projects/{project}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}" - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The user-specified configuration for the module. - CustomConfig custom_config = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The effective state of enablement for the module at the given - // level of the hierarchy. - EnablementState enablement_state = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The display name for the custom module. The name must be - // between 1 and 128 characters, start with a lowercase letter, and contain - // alphanumeric characters or underscores only. - string display_name = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/exfiltration.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/exfiltration.proto deleted file mode 100644 index 4c3735dedf2..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/exfiltration.proto +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "ExfiltrationProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Exfiltration represents a data exfiltration attempt of one or more -// sources to one or more targets. Sources represent the source -// of data that is exfiltrated, and Targets represents the destination the -// data was copied to. -message Exfiltration { - // If there are multiple sources, then the data is considered "joined" between - // them. For instance, BigQuery can join multiple tables, and each - // table would be considered a source. - repeated ExfilResource sources = 1; - - // If there are multiple targets, each target would get a complete copy of the - // "joined" source data. - repeated ExfilResource targets = 2; -} - -// Resource that has been exfiltrated or exfiltrated_to. -message ExfilResource { - // Resource's URI (https://google.aip.dev/122#full-resource-names) - string name = 1; - - // Subcomponents of the asset that is exfiltrated - these could be - // URIs used during exfiltration, table names, databases, filenames, etc. - // For example, multiple tables may be exfiltrated from the same CloudSQL - // instance, or multiple files from the same Cloud Storage bucket. - repeated string components = 2; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/external_system.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/external_system.proto deleted file mode 100644 index 0e23d6a675f..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/external_system.proto +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "ExternalSystemProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Representation of third party SIEM/SOAR fields within SCC. -message ExternalSystem { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/ExternalSystem" - pattern: "organizations/{organization}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}" - pattern: "folders/{folder}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}" - pattern: "projects/{project}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}" - }; - - // Full resource name of the external system, for example: - // "organizations/1234/sources/5678/findings/123456/externalSystems/jira", - // "folders/1234/sources/5678/findings/123456/externalSystems/jira", - // "projects/1234/sources/5678/findings/123456/externalSystems/jira" - string name = 1; - - // References primary/secondary etc assignees in the external system. - repeated string assignees = 2; - - // Identifier that's used to track the given finding in the external system. - string external_uid = 3; - - // Most recent status of the corresponding finding's ticket/tracker in the - // external system. - string status = 4; - - // The most recent time when the corresponding finding's ticket/tracker was - // updated in the external system. - google.protobuf.Timestamp external_system_update_time = 5; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/file.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/file.proto deleted file mode 100644 index 4d7a459590c..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/file.proto +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "FileProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// File information about the related binary/library used by an executable, or -// the script used by a script interpreter -message File { - // Absolute path of the file as a JSON encoded string. - string path = 1; - - // Size of the file in bytes. - int64 size = 2; - - // SHA256 hash of the first hashed_size bytes of the file encoded as a - // hex string. If hashed_size == size, sha256 represents the SHA256 hash - // of the entire file. - string sha256 = 3; - - // The length in bytes of the file prefix that was hashed. If - // hashed_size == size, any hashes reported represent the entire - // file. - int64 hashed_size = 4; - - // True when the hash covers only a prefix of the file. - bool partially_hashed = 5; - - // Prefix of the file contents as a JSON encoded string. - // (Currently only populated for Malicious Script Executed findings.) - string contents = 6; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/finding.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/finding.proto deleted file mode 100644 index b57b7be4e7a..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/finding.proto +++ /dev/null @@ -1,362 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1/access.proto"; -import "google/cloud/securitycenter/v1/cloud_dlp_data_profile.proto"; -import "google/cloud/securitycenter/v1/cloud_dlp_inspection.proto"; -import "google/cloud/securitycenter/v1/compliance.proto"; -import "google/cloud/securitycenter/v1/connection.proto"; -import "google/cloud/securitycenter/v1/contact_details.proto"; -import "google/cloud/securitycenter/v1/container.proto"; -import "google/cloud/securitycenter/v1/database.proto"; -import "google/cloud/securitycenter/v1/exfiltration.proto"; -import "google/cloud/securitycenter/v1/external_system.proto"; -import "google/cloud/securitycenter/v1/file.proto"; -import "google/cloud/securitycenter/v1/iam_binding.proto"; -import "google/cloud/securitycenter/v1/indicator.proto"; -import "google/cloud/securitycenter/v1/kernel_rootkit.proto"; -import "google/cloud/securitycenter/v1/kubernetes.proto"; -import "google/cloud/securitycenter/v1/mitre_attack.proto"; -import "google/cloud/securitycenter/v1/process.proto"; -import "google/cloud/securitycenter/v1/security_marks.proto"; -import "google/cloud/securitycenter/v1/vulnerability.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Security Command Center finding. -// -// A finding is a record of assessment data like security, risk, health, or -// privacy, that is ingested into Security Command Center for presentation, -// notification, analysis, policy testing, and enforcement. For example, a -// cross-site scripting (XSS) vulnerability in an App Engine application is a -// finding. -message Finding { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/Finding" - pattern: "organizations/{organization}/sources/{source}/findings/{finding}" - pattern: "folders/{folder}/sources/{source}/findings/{finding}" - pattern: "projects/{project}/sources/{source}/findings/{finding}" - }; - - // The state of the finding. - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // The finding requires attention and has not been addressed yet. - ACTIVE = 1; - - // The finding has been fixed, triaged as a non-issue or otherwise addressed - // and is no longer active. - INACTIVE = 2; - } - - // The severity of the finding. - enum Severity { - // This value is used for findings when a source doesn't write a severity - // value. - SEVERITY_UNSPECIFIED = 0; - - // Vulnerability: - // A critical vulnerability is easily discoverable by an external actor, - // exploitable, and results in the direct ability to execute arbitrary code, - // exfiltrate data, and otherwise gain additional access and privileges to - // cloud resources and workloads. Examples include publicly accessible - // unprotected user data and public SSH access with weak or no - // passwords. - // - // Threat: - // Indicates a threat that is able to access, modify, or delete data or - // execute unauthorized code within existing resources. - CRITICAL = 1; - - // Vulnerability: - // A high risk vulnerability can be easily discovered and exploited in - // combination with other vulnerabilities in order to gain direct access and - // the ability to execute arbitrary code, exfiltrate data, and otherwise - // gain additional access and privileges to cloud resources and workloads. - // An example is a database with weak or no passwords that is only - // accessible internally. This database could easily be compromised by an - // actor that had access to the internal network. - // - // Threat: - // Indicates a threat that is able to create new computational resources in - // an environment but not able to access data or execute code in existing - // resources. - HIGH = 2; - - // Vulnerability: - // A medium risk vulnerability could be used by an actor to gain access to - // resources or privileges that enable them to eventually (through multiple - // steps or a complex exploit) gain access and the ability to execute - // arbitrary code or exfiltrate data. An example is a service account with - // access to more projects than it should have. If an actor gains access to - // the service account, they could potentially use that access to manipulate - // a project the service account was not intended to. - // - // Threat: - // Indicates a threat that is able to cause operational impact but may not - // access data or execute unauthorized code. - MEDIUM = 3; - - // Vulnerability: - // A low risk vulnerability hampers a security organization's ability to - // detect vulnerabilities or active threats in their deployment, or prevents - // the root cause investigation of security issues. An example is monitoring - // and logs being disabled for resource configurations and access. - // - // Threat: - // Indicates a threat that has obtained minimal access to an environment but - // is not able to access data, execute code, or create resources. - LOW = 4; - } - - // Mute state a finding can be in. - enum Mute { - // Unspecified. - MUTE_UNSPECIFIED = 0; - - // Finding has been muted. - MUTED = 1; - - // Finding has been unmuted. - UNMUTED = 2; - - // Finding has never been muted/unmuted. - UNDEFINED = 4; - } - - // Represents what kind of Finding it is. - enum FindingClass { - // Unspecified finding class. - FINDING_CLASS_UNSPECIFIED = 0; - - // Describes unwanted or malicious activity. - THREAT = 1; - - // Describes a potential weakness in software that increases risk to - // Confidentiality & Integrity & Availability. - VULNERABILITY = 2; - - // Describes a potential weakness in cloud resource/asset configuration that - // increases risk. - MISCONFIGURATION = 3; - - // Describes a security observation that is for informational purposes. - OBSERVATION = 4; - - // Describes an error that prevents some SCC functionality. - SCC_ERROR = 5; - } - - // The [relative resource - // name](https://cloud.google.com/apis/design/resource_names#relative_resource_name) - // of the finding. Example: - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", - // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}", - // "projects/{project_id}/sources/{source_id}/findings/{finding_id}". - string name = 1; - - // The relative resource name of the source the finding belongs to. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // This field is immutable after creation time. - // For example: - // "organizations/{organization_id}/sources/{source_id}" - string parent = 2; - - // For findings on Google Cloud resources, the full resource - // name of the Google Cloud resource this finding is for. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - // When the finding is for a non-Google Cloud resource, the resourceName can - // be a customer or partner defined string. This field is immutable after - // creation time. - string resource_name = 3; - - // The state of the finding. - State state = 4; - - // The additional taxonomy group within findings from a given source. - // This field is immutable after creation time. - // Example: "XSS_FLASH_INJECTION" - string category = 5; - - // The URI that, if available, points to a web page outside of Security - // Command Center where additional information about the finding can be found. - // This field is guaranteed to be either empty or a well formed URL. - string external_uri = 6; - - // Source specific properties. These properties are managed by the source - // that writes the finding. The key names in the source_properties map must be - // between 1 and 255 characters, and must start with a letter and contain - // alphanumeric characters or underscores only. - map source_properties = 7; - - // Output only. User specified security marks. These marks are entirely - // managed by the user and come from the SecurityMarks resource that belongs - // to the finding. - SecurityMarks security_marks = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The time the finding was first detected. If an existing finding is updated, - // then this is the time the update occurred. - // For example, if the finding represents an open firewall, this property - // captures the time the detector believes the firewall became open. The - // accuracy is determined by the detector. If the finding is later resolved, - // then this time reflects when the finding was resolved. This must not - // be set to a value greater than the current timestamp. - google.protobuf.Timestamp event_time = 9; - - // The time at which the finding was created in Security Command Center. - google.protobuf.Timestamp create_time = 10; - - // The severity of the finding. This field is managed by the source that - // writes the finding. - Severity severity = 12; - - // The canonical name of the finding. It's either - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", - // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}" or - // "projects/{project_number}/sources/{source_id}/findings/{finding_id}", - // depending on the closest CRM ancestor of the resource associated with the - // finding. - string canonical_name = 14; - - // Indicates the mute state of a finding (either muted, unmuted - // or undefined). Unlike other attributes of a finding, a finding provider - // shouldn't set the value of mute. - Mute mute = 15; - - // The class of the finding. - FindingClass finding_class = 17; - - // Represents what's commonly known as an *indicator of compromise* (IoC) in - // computer forensics. This is an artifact observed on a network or in an - // operating system that, with high confidence, indicates a computer - // intrusion. For more information, see [Indicator of - // compromise](https://en.wikipedia.org/wiki/Indicator_of_compromise). - Indicator indicator = 18; - - // Represents vulnerability-specific fields like CVE and CVSS scores. - // CVE stands for Common Vulnerabilities and Exposures - // (https://cve.mitre.org/about/) - Vulnerability vulnerability = 20; - - // Output only. The most recent time this finding was muted or unmuted. - google.protobuf.Timestamp mute_update_time = 21 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Third party SIEM/SOAR fields within SCC, contains external - // system information and external system finding fields. - map external_systems = 22 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // MITRE ATT&CK tactics and techniques related to this finding. - // See: https://attack.mitre.org - MitreAttack mitre_attack = 25; - - // Access details associated with the finding, such as more information on the - // caller, which method was accessed, and from where. - Access access = 26; - - // Contains information about the IP connection associated with the finding. - repeated Connection connections = 31; - - // Records additional information about the mute operation, for example, the - // [mute configuration](/security-command-center/docs/how-to-mute-findings) - // that muted the finding and the user who muted the finding. - string mute_initiator = 28; - - // Represents operating system processes associated with the Finding. - repeated Process processes = 30; - - // Output only. Map containing the points of contact for the given finding. - // The key represents the type of contact, while the value contains a list of - // all the contacts that pertain. Please refer to: - // https://cloud.google.com/resource-manager/docs/managing-notification-contacts#notification-categories - // - // { - // "security": { - // "contacts": [ - // { - // "email": "person1@company.com" - // }, - // { - // "email": "person2@company.com" - // } - // ] - // } - // } - map contacts = 33 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Contains compliance information for security standards associated to the - // finding. - repeated Compliance compliances = 34; - - // Output only. The human readable display name of the finding source such as - // "Event Threat Detection" or "Security Health Analytics". - string parent_display_name = 36 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Contains more details about the finding. - string description = 37; - - // Represents exfiltrations associated with the finding. - Exfiltration exfiltration = 38; - - // Represents IAM bindings associated with the finding. - repeated IamBinding iam_bindings = 39; - - // Steps to address the finding. - string next_steps = 40; - - // Unique identifier of the module which generated the finding. - // Example: - // folders/598186756061/securityHealthAnalyticsSettings/customModules/56799441161885 - string module_name = 41; - - // Containers associated with the finding. This field provides information for - // both Kubernetes and non-Kubernetes containers. - repeated Container containers = 42; - - // Kubernetes resources associated with the finding. - Kubernetes kubernetes = 43; - - // Database associated with the finding. - Database database = 44; - - // File associated with the finding. - repeated File files = 46; - - // Cloud Data Loss Prevention (Cloud DLP) inspection results that are - // associated with the finding. - CloudDlpInspection cloud_dlp_inspection = 48; - - // Cloud DLP data profile that is associated with the finding. - CloudDlpDataProfile cloud_dlp_data_profile = 49; - - // Signature of the kernel rootkit. - KernelRootkit kernel_rootkit = 50; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/folder.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/folder.proto deleted file mode 100644 index e809154231c..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/folder.proto +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "FolderProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Message that contains the resource name and display name of a folder -// resource. -message Folder { - // Full resource name of this folder. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_folder = 1; - - // The user defined display name for this folder. - string resource_folder_display_name = 2; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/iam_binding.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/iam_binding.proto deleted file mode 100644 index 533ac4bdadc..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/iam_binding.proto +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "IamBindingProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Represents a particular IAM binding, which captures a member's role addition, -// removal, or state. -message IamBinding { - // The type of action performed on a Binding in a policy. - enum Action { - // Unspecified. - ACTION_UNSPECIFIED = 0; - - // Addition of a Binding. - ADD = 1; - - // Removal of a Binding. - REMOVE = 2; - } - - // The action that was performed on a Binding. - Action action = 1; - - // Role that is assigned to "members". - // For example, "roles/viewer", "roles/editor", or "roles/owner". - string role = 2; - - // A single identity requesting access for a Cloud Platform resource, - // e.g. "foo@google.com". - string member = 3; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/indicator.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/indicator.proto deleted file mode 100644 index f36e8b4872d..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/indicator.proto +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "IndicatorProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Represents what's commonly known as an _indicator of compromise_ (IoC) in -// computer forensics. This is an artifact observed on a network or in an -// operating system that, with high confidence, indicates a computer intrusion. -// For more information, see [Indicator of -// compromise](https://en.wikipedia.org/wiki/Indicator_of_compromise). -message Indicator { - // Indicates what signature matched this process. - message ProcessSignature { - // A signature corresponding to memory page hashes. - message MemoryHashSignature { - // Memory hash detection contributing to the binary family match. - message Detection { - // The name of the binary associated with the memory hash - // signature detection. - string binary = 2; - - // The percentage of memory page hashes in the signature - // that were matched. - double percent_pages_matched = 3; - } - - // The binary family. - string binary_family = 1; - - // The list of memory hash detections contributing to the binary family - // match. - repeated Detection detections = 4; - } - - // A signature corresponding to a YARA rule. - message YaraRuleSignature { - // The name of the YARA rule. - string yara_rule = 5; - } - - oneof signature { - // Signature indicating that a binary family was matched. - MemoryHashSignature memory_hash_signature = 6; - - // Signature indicating that a YARA rule was matched. - YaraRuleSignature yara_rule_signature = 7; - } - } - - // The list of IP addresses that are associated with the finding. - repeated string ip_addresses = 1; - - // List of domains associated to the Finding. - repeated string domains = 2; - - // The list of matched signatures indicating that the given - // process is present in the environment. - repeated ProcessSignature signatures = 3; - - // The list of URIs associated to the Findings. - repeated string uris = 4; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/kernel_rootkit.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/kernel_rootkit.proto deleted file mode 100644 index 6af2840bf06..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/kernel_rootkit.proto +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "KernelRootkitProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Kernel mode rootkit signatures. -message KernelRootkit { - // Rootkit name when available. - string name = 1; - - // True when unexpected modifications of kernel code memory are present. - bool unexpected_code_modification = 2; - - // True when unexpected modifications of kernel read-only data memory are - // present. - bool unexpected_read_only_data_modification = 3; - - // True when `ftrace` points are present with callbacks pointing to regions - // that are not in the expected kernel or module code range. - bool unexpected_ftrace_handler = 4; - - // True when `kprobe` points are present with callbacks pointing to regions - // that are not in the expected kernel or module code range. - bool unexpected_kprobe_handler = 5; - - // True when kernel code pages that are not in the expected kernel or module - // code regions are present. - bool unexpected_kernel_code_pages = 6; - - // True when system call handlers that are are not in the expected kernel or - // module code regions are present. - bool unexpected_system_call_handler = 7; - - // True when interrupt handlers that are are not in the expected kernel or - // module code regions are present. - bool unexpected_interrupt_handler = 8; - - // True when unexpected processes in the scheduler run queue are present. Such - // processes are in the run queue, but not in the process task list. - bool unexpected_processes_in_runqueue = 9; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/kubernetes.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/kubernetes.proto deleted file mode 100644 index ac1df835116..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/kubernetes.proto +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/cloud/securitycenter/v1/container.proto"; -import "google/cloud/securitycenter/v1/label.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "KubernetesProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Kubernetes-related attributes. -message Kubernetes { - // Kubernetes Pod. - message Pod { - // Kubernetes Pod namespace. - string ns = 1; - - // Kubernetes Pod name. - string name = 2; - - // Pod labels. For Kubernetes containers, these are applied to the - // container. - repeated Label labels = 3; - - // Pod containers associated with this finding, if any. - repeated Container containers = 4; - } - - // Kubernetes Nodes associated with the finding. - message Node { - // Full Resource name of the Compute Engine VM running the - // cluster node. - string name = 1; - } - - // Provides GKE Node Pool information. - message NodePool { - // Kubernetes Node pool name. - string name = 1; - - // Nodes associated with the finding. - repeated Node nodes = 2; - } - - // Kubernetes Role or ClusterRole. - message Role { - // Types of Kubernetes roles. - enum Kind { - // Role type is not specified. - KIND_UNSPECIFIED = 0; - - // Kubernetes Role. - ROLE = 1; - - // Kubernetes ClusterRole. - CLUSTER_ROLE = 2; - } - - // Role type. - Kind kind = 1; - - // Role namespace. - string ns = 2; - - // Role name. - string name = 3; - } - - // Represents a Kubernetes RoleBinding or ClusterRoleBinding. - message Binding { - // Namespace for binding. - string ns = 1; - - // Name for binding. - string name = 2; - - // The Role or ClusterRole referenced by the binding. - Role role = 3; - - // Represents one or more subjects that are bound to the role. Not always - // available for PATCH requests. - repeated Subject subjects = 4; - } - - // Represents a Kubernetes Subject. - message Subject { - // Auth types that can be used for Subject's kind field. - enum AuthType { - // Authentication is not specified. - AUTH_TYPE_UNSPECIFIED = 0; - - // User with valid certificate. - USER = 1; - - // Users managed by Kubernetes API with credentials stored as Secrets. - SERVICEACCOUNT = 2; - - // Collection of users. - GROUP = 3; - } - - // Authentication type for subject. - AuthType kind = 1; - - // Namespace for subject. - string ns = 2; - - // Name for subject. - string name = 3; - } - - // Conveys information about a Kubernetes access review (e.g. kubectl auth - // can-i ...) that was involved in a finding. - message AccessReview { - // Group is the API Group of the Resource. "*" means all. - string group = 1; - - // Namespace of the action being requested. Currently, there is no - // distinction between no namespace and all namespaces. Both - // are represented by "" (empty). - string ns = 2; - - // Name is the name of the resource being requested. Empty means all. - string name = 3; - - // Resource is the optional resource type requested. "*" means all. - string resource = 4; - - // Subresource is the optional subresource type. - string subresource = 5; - - // Verb is a Kubernetes resource API verb, like: get, list, watch, create, - // update, delete, proxy. "*" means all. - string verb = 6; - - // Version is the API Version of the Resource. "*" means all. - string version = 7; - } - - // Kubernetes Pods associated with the finding. This field will contain Pod - // records for each container that is owned by a Pod. - repeated Pod pods = 1; - - // Provides Kubernetes Node information. - repeated Node nodes = 2; - - // GKE Node Pools associated with the finding. This field will - // contain NodePool information for each Node, when it is available. - repeated NodePool node_pools = 3; - - // Provides Kubernetes role information for findings that involve - // Roles or ClusterRoles. - repeated Role roles = 4; - - // Provides Kubernetes role binding information for findings that involve - // RoleBindings or ClusterRoleBindings. - repeated Binding bindings = 5; - - // Provides information on any Kubernetes access reviews (i.e. privilege - // checks) relevant to the finding. - repeated AccessReview access_reviews = 6; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/label.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/label.proto deleted file mode 100644 index 0760c82d840..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/label.proto +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "LabelProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Label represents a generic name=value label. Label has separate name and -// value fields to support filtering with contains(). -message Label { - // Label name. - string name = 1; - - // Label value. - string value = 2; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/mitre_attack.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/mitre_attack.proto deleted file mode 100644 index 79425d2c60d..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/mitre_attack.proto +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "MitreAttackProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// MITRE ATT&CK tactics and techniques related to this finding. -// See: https://attack.mitre.org -message MitreAttack { - // MITRE ATT&CK tactics that can be referenced by SCC findings. - // See: https://attack.mitre.org/tactics/enterprise/ - enum Tactic { - // Unspecified value. - TACTIC_UNSPECIFIED = 0; - - // TA0043 - RECONNAISSANCE = 1; - - // TA0042 - RESOURCE_DEVELOPMENT = 2; - - // TA0001 - INITIAL_ACCESS = 5; - - // TA0002 - EXECUTION = 3; - - // TA0003 - PERSISTENCE = 6; - - // TA0004 - PRIVILEGE_ESCALATION = 8; - - // TA0005 - DEFENSE_EVASION = 7; - - // TA0006 - CREDENTIAL_ACCESS = 9; - - // TA0007 - DISCOVERY = 10; - - // TA0008 - LATERAL_MOVEMENT = 11; - - // TA0009 - COLLECTION = 12; - - // TA0011 - COMMAND_AND_CONTROL = 4; - - // TA0010 - EXFILTRATION = 13; - - // TA0040 - IMPACT = 14; - } - - // MITRE ATT&CK techniques that can be referenced by SCC findings. - // See: https://attack.mitre.org/techniques/enterprise/ - enum Technique { - // Unspecified value. - TECHNIQUE_UNSPECIFIED = 0; - - // T1595 - ACTIVE_SCANNING = 1; - - // T1595.001 - SCANNING_IP_BLOCKS = 2; - - // T1105 - INGRESS_TOOL_TRANSFER = 3; - - // T1106 - NATIVE_API = 4; - - // T1129 - SHARED_MODULES = 5; - - // T1059 - COMMAND_AND_SCRIPTING_INTERPRETER = 6; - - // T1059.004 - UNIX_SHELL = 7; - - // T1496 - RESOURCE_HIJACKING = 8; - - // T1090 - PROXY = 9; - - // T1090.002 - EXTERNAL_PROXY = 10; - - // T1090.003 - MULTI_HOP_PROXY = 11; - - // T1568 - DYNAMIC_RESOLUTION = 12; - - // T1552 - UNSECURED_CREDENTIALS = 13; - - // T1078 - VALID_ACCOUNTS = 14; - - // T1078.003 - LOCAL_ACCOUNTS = 15; - - // T1078.004 - CLOUD_ACCOUNTS = 16; - - // T1498 - NETWORK_DENIAL_OF_SERVICE = 17; - - // T1069 - PERMISSION_GROUPS_DISCOVERY = 18; - - // T1069.003 - CLOUD_GROUPS = 19; - - // T1567 - EXFILTRATION_OVER_WEB_SERVICE = 20; - - // T1567.002 - EXFILTRATION_TO_CLOUD_STORAGE = 21; - - // T1098 - ACCOUNT_MANIPULATION = 22; - - // T1098.004 - SSH_AUTHORIZED_KEYS = 23; - - // T1543 - CREATE_OR_MODIFY_SYSTEM_PROCESS = 24; - - // T1539 - STEAL_WEB_SESSION_COOKIE = 25; - - // T1578 - MODIFY_CLOUD_COMPUTE_INFRASTRUCTURE = 26; - - // T1190 - EXPLOIT_PUBLIC_FACING_APPLICATION = 27; - - // T1556 - MODIFY_AUTHENTICATION_PROCESS = 28; - - // T1485 - DATA_DESTRUCTION = 29; - - // T1484 - DOMAIN_POLICY_MODIFICATION = 30; - - // T1562 - IMPAIR_DEFENSES = 31; - - // T1046 - NETWORK_SERVICE_DISCOVERY = 32; - - // T1134 - ACCESS_TOKEN_MANIPULATION = 33; - - // T1548 - ABUSE_ELEVATION_CONTROL_MECHANISM = 34; - - // T1078.001 - DEFAULT_ACCOUNTS = 35; - } - - // The MITRE ATT&CK tactic most closely represented by this finding, if any. - Tactic primary_tactic = 1; - - // 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`). - repeated Technique primary_techniques = 2; - - // Additional MITRE ATT&CK tactics related to this finding, if any. - repeated Tactic additional_tactics = 3; - - // Additional MITRE ATT&CK techniques related to this finding, if any, along - // with any of their respective parent techniques. - repeated Technique additional_techniques = 4; - - // The MITRE ATT&CK version referenced by the above fields. E.g. "8". - string version = 5; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/mute_config.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/mute_config.proto deleted file mode 100644 index d2a8db68499..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/mute_config.proto +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "MuteConfigProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// A mute config is a Cloud SCC resource that contains the configuration -// to mute create/update events of findings. -message MuteConfig { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/MuteConfig" - pattern: "organizations/{organization}/muteConfigs/{mute_config}" - pattern: "folders/{folder}/muteConfigs/{mute_config}" - pattern: "projects/{project}/muteConfigs/{mute_config}" - }; - - // This field will be ignored if provided on config creation. Format - // "organizations/{organization}/muteConfigs/{mute_config}" - // "folders/{folder}/muteConfigs/{mute_config}" - // "projects/{project}/muteConfigs/{mute_config}" - string name = 1; - - // The human readable name to be displayed for the mute config. - string display_name = 2 [deprecated = true]; - - // A description of the mute config. - string description = 3; - - // Required. An expression that defines the filter to apply across - // create/update events of findings. While creating a filter string, be - // mindful of the scope in which the mute configuration is being created. - // E.g., If a filter contains project = X but is created under the project = Y - // scope, it might not match any findings. - // - // The following field and operator combinations are supported: - // - // * severity: `=`, `:` - // * category: `=`, `:` - // * resource.name: `=`, `:` - // * resource.project_name: `=`, `:` - // * resource.project_display_name: `=`, `:` - // * resource.folders.resource_folder: `=`, `:` - // * resource.parent_name: `=`, `:` - // * resource.parent_display_name: `=`, `:` - // * resource.type: `=`, `:` - // * finding_class: `=`, `:` - // * indicator.ip_addresses: `=`, `:` - // * indicator.domains: `=`, `:` - string filter = 4 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The time at which the mute config was created. - // This field is set by the server and will be ignored if provided on config - // creation. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The most recent time at which the mute config was updated. - // This field is set by the server and will be ignored if provided on config - // creation or update. - google.protobuf.Timestamp update_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Email address of the user who last edited the mute config. - // This field is set by the server and will be ignored if provided on config - // creation or update. - string most_recent_editor = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/notification_config.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/notification_config.proto deleted file mode 100644 index de2a88b6bb1..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/notification_config.proto +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "NotificationConfigProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; -option (google.api.resource_definition) = { - type: "pubsub.googleapis.com/Topic" - pattern: "projects/{project}/topics/{topic}" -}; - -// Cloud Security Command Center (Cloud SCC) notification configs. -// -// A notification config is a Cloud SCC resource that contains the configuration -// to send notifications for create/update events of findings, assets and etc. -message NotificationConfig { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/NotificationConfig" - pattern: "organizations/{organization}/notificationConfigs/{notification_config}" - pattern: "folders/{folder}/notificationConfigs/{notification_config}" - pattern: "projects/{project}/notificationConfigs/{notification_config}" - }; - - // The config for streaming-based notifications, which send each event as soon - // as it is detected. - message StreamingConfig { - // Expression that defines the filter to apply across create/update events - // of assets or findings as specified by the event type. 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. - string filter = 1; - } - - // The relative resource name of this notification config. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/notificationConfigs/notify_public_bucket", - // "folders/{folder_id}/notificationConfigs/notify_public_bucket", - // or "projects/{project_id}/notificationConfigs/notify_public_bucket". - string name = 1; - - // The description of the notification config (max of 1024 characters). - string description = 2; - - // The Pub/Sub topic to send notifications to. Its format is - // "projects/[project_id]/topics/[topic]". - string pubsub_topic = 3 [ - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // Output only. The service account that needs "pubsub.topics.publish" - // permission to publish to the Pub/Sub topic. - string service_account = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The config for triggering notifications. - oneof notify_config { - // The config for triggering streaming-based notifications. - StreamingConfig streaming_config = 5; - } -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/notification_message.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/notification_message.proto deleted file mode 100644 index 59841d92ede..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/notification_message.proto +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/cloud/securitycenter/v1/finding.proto"; -import "google/cloud/securitycenter/v1/resource.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "NotificationMessageProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Cloud SCC's Notification -message NotificationMessage { - // Name of the notification config that generated current notification. - string notification_config_name = 1; - - // Notification Event. - oneof event { - // If it's a Finding based notification config, this field will be - // populated. - Finding finding = 2; - } - - // The Cloud resource tied to this notification's Finding. - Resource resource = 3; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/organization_settings.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/organization_settings.proto deleted file mode 100644 index 66880a17c63..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/organization_settings.proto +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/resource.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// User specified settings that are attached to the Security Command -// Center organization. -message OrganizationSettings { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/OrganizationSettings" - pattern: "organizations/{organization}/organizationSettings" - }; - - // The configuration used for Asset Discovery runs. - message AssetDiscoveryConfig { - // The mode of inclusion when running Asset Discovery. - // Asset discovery can be limited by explicitly identifying projects to be - // included or excluded. If INCLUDE_ONLY is set, then only those projects - // within the organization and their children are discovered during asset - // discovery. If EXCLUDE is set, then projects that don't match those - // projects are discovered during asset discovery. If neither are set, then - // all projects within the organization are discovered during asset - // discovery. - enum InclusionMode { - // Unspecified. Setting the mode with this value will disable - // inclusion/exclusion filtering for Asset Discovery. - INCLUSION_MODE_UNSPECIFIED = 0; - - // Asset Discovery will capture only the resources within the projects - // specified. All other resources will be ignored. - INCLUDE_ONLY = 1; - - // Asset Discovery will ignore all resources under the projects specified. - // All other resources will be retrieved. - EXCLUDE = 2; - } - - // The project ids to use for filtering asset discovery. - repeated string project_ids = 1; - - // The mode to use for filtering asset discovery. - InclusionMode inclusion_mode = 2; - - // The folder ids to use for filtering asset discovery. - // It consists of only digits, e.g., 756619654966. - repeated string folder_ids = 3; - } - - // The relative resource name of the settings. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/organizationSettings". - string name = 1; - - // A flag that indicates if Asset Discovery should be enabled. If the flag is - // set to `true`, then discovery of assets will occur. If it is set to `false, - // all historical assets will remain, but discovery of future assets will not - // occur. - bool enable_asset_discovery = 2; - - // The configuration used for Asset Discovery runs. - AssetDiscoveryConfig asset_discovery_config = 3; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/process.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/process.proto deleted file mode 100644 index 3ec0a5c29f1..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/process.proto +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/cloud/securitycenter/v1/file.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "ProcessProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Represents an operating system process. -message Process { - // The process name visible in utilities like `top` and `ps`; it can - // be accessed via `/proc/[pid]/comm` and changed with `prctl(PR_SET_NAME)`. - string name = 12; - - // File information for the process executable. - File binary = 3; - - // File information for libraries loaded by the process. - repeated File libraries = 4; - - // When the process represents the invocation of a script, - // `binary` provides information about the interpreter while `script` - // provides information about the script file provided to the - // interpreter. - File script = 5; - - // Process arguments as JSON encoded strings. - repeated string args = 6; - - // True if `args` is incomplete. - bool arguments_truncated = 7; - - // Process environment variables. - repeated EnvironmentVariable env_variables = 8; - - // True if `env_variables` is incomplete. - bool env_variables_truncated = 9; - - // The process id. - int64 pid = 10; - - // The parent process id. - int64 parent_pid = 11; -} - -// EnvironmentVariable is a name-value pair to store environment variables for -// Process. -message EnvironmentVariable { - // Environment variable name as a JSON encoded string. - string name = 1; - - // Environment variable value as a JSON encoded string. - string val = 2; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/resource.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/resource.proto deleted file mode 100644 index 626974ea962..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/resource.proto +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/field_behavior.proto"; -import "google/cloud/securitycenter/v1/folder.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "ResourceProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Information related to the Google Cloud resource. -message Resource { - // The full resource name of the resource. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string name = 1; - - // The human readable name of the resource. - string display_name = 8; - - // The full resource type of the resource. - string type = 6; - - // The full resource name of project that the resource belongs to. - string project = 2; - - // The project ID that the resource belongs to. - string project_display_name = 3; - - // The full resource name of resource's parent. - string parent = 4; - - // The human readable name of resource's parent. - string parent_display_name = 5; - - // Output only. Contains a Folder message for each folder in the assets - // ancestry. The first folder is the deepest nested folder, and the last - // folder is the folder directly under the Organization. - repeated Folder folders = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto deleted file mode 100644 index f331fb9ec78..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/protobuf/duration.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Response of asset discovery run -message RunAssetDiscoveryResponse { - // The state of an asset discovery run. - enum State { - // Asset discovery run state was unspecified. - STATE_UNSPECIFIED = 0; - - // Asset discovery run completed successfully. - COMPLETED = 1; - - // Asset discovery run was cancelled with tasks still pending, as another - // run for the same organization was started with a higher priority. - SUPERSEDED = 2; - - // Asset discovery run was killed and terminated. - TERMINATED = 3; - } - - // The state of an asset discovery run. - State state = 1; - - // The duration between asset discovery run start and end - google.protobuf.Duration duration = 2; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_health_analytics_custom_config.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_health_analytics_custom_config.proto deleted file mode 100644 index 337f0a3bb3f..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_health_analytics_custom_config.proto +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/type/expr.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "SecurityHealthAnalyticsCustomConfigProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Defines the properties in a custom module configuration for Security -// Health Analytics. Use the custom module configuration to create custom -// detectors that generate custom findings for resources that you specify. -message CustomConfig { - // A set of optional name-value pairs that define custom source properties to - // return with each finding that is generated by the custom module. The custom - // source properties that are defined here are included in the finding JSON - // under `sourceProperties`. - message CustomOutputSpec { - // An individual name-value pair that defines a custom source property. - message Property { - // Name of the property for the custom output. - string name = 1; - - // The CEL expression for the custom output. A resource property can be - // specified to return the value of the property or a text string enclosed - // in quotation marks. - google.type.Expr value_expression = 2; - } - - // A list of custom output properties to add to the finding. - repeated Property properties = 1; - } - - // Resource for selecting resource type. - message ResourceSelector { - // The resource types to run the detector on. - repeated string resource_types = 1; - } - - // Defines the valid value options for the severity of a finding. - enum Severity { - // Unspecified severity. - SEVERITY_UNSPECIFIED = 0; - - // Critical severity. - CRITICAL = 1; - - // High severity. - HIGH = 2; - - // Medium severity. - MEDIUM = 3; - - // Low severity. - LOW = 4; - } - - // The CEL expression to evaluate to produce findings. When the expression - // evaluates to true against a resource, a finding is generated. - google.type.Expr predicate = 1; - - // Custom output properties. - CustomOutputSpec custom_output = 2; - - // The resource types that the custom module operates on. Each custom module - // can specify up to 5 resource types. - ResourceSelector resource_selector = 3; - - // The severity to assign to findings generated by the module. - Severity severity = 4; - - // Text that describes the vulnerability or misconfiguration that the custom - // module detects. This explanation is returned with each finding instance to - // help investigators understand the detected issue. The text must be enclosed - // in quotation marks. - string description = 5; - - // An explanation of the recommended steps that security teams can take to - // resolve the detected issue. This explanation is returned with each finding - // generated by this module in the `nextSteps` property of the finding JSON. - string recommendation = 6; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_health_analytics_custom_module.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_health_analytics_custom_module.proto deleted file mode 100644 index 7e7343d064f..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_health_analytics_custom_module.proto +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1/security_health_analytics_custom_config.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "SecurityHealthAnalyticsCustomModuleProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; -option (google.api.resource_definition) = { - type: "securitycenter.googleapis.com/SecurityHealthAnalyticsSettings" - pattern: "organizations/{organization}/securityHealthAnalyticsSettings" - pattern: "folders/{folder}/securityHealthAnalyticsSettings" - pattern: "projects/{project}/securityHealthAnalyticsSettings" -}; - -// Represents an instance of a Security Health Analytics custom module, -// including its full module name, display name, enablement state, and last -// updated time. You can create a custom module at the organization, folder, or -// project level. Custom modules that you create at the organization or folder -// level are inherited by the child folders and projects. -message SecurityHealthAnalyticsCustomModule { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/SecurityHealthAnalyticsCustomModule" - pattern: "organizations/{organization}/securityHealthAnalyticsSettings/customModules/{custom_module}" - pattern: "folders/{folder}/securityHealthAnalyticsSettings/customModules/{custom_module}" - pattern: "projects/{project}/securityHealthAnalyticsSettings/customModules/{custom_module}" - }; - - // Possible enablement states of a custom module. - enum EnablementState { - // Unspecified enablement state. - ENABLEMENT_STATE_UNSPECIFIED = 0; - - // The module is enabled at the given CRM resource. - ENABLED = 1; - - // The module is disabled at the given CRM resource. - DISABLED = 2; - - // State is inherited from an ancestor module. The module will either - // be effectively ENABLED or DISABLED based on its closest non-inherited - // ancestor module in the CRM hierarchy. - INHERITED = 3; - } - - // Immutable. The resource name of the custom module. - // Its format is - // "organizations/{organization}/securityHealthAnalyticsSettings/customModules/{customModule}", - // or - // "folders/{folder}/securityHealthAnalyticsSettings/customModules/{customModule}", - // or - // "projects/{project}/securityHealthAnalyticsSettings/customModules/{customModule}" - // - // The id {customModule} is server-generated and is not user settable. - // It will be a numeric id containing 1-20 digits. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // The display name of the Security Health Analytics custom module. This - // display name becomes the finding category for all findings that are - // returned by this custom module. The display name must be between 1 and - // 128 characters, start with a lowercase letter, and contain alphanumeric - // characters or underscores only. - string display_name = 2; - - // The enablement state of the custom module. - EnablementState enablement_state = 4; - - // Output only. The time at which the custom module was last updated. - google.protobuf.Timestamp update_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The editor that last updated the custom module. - string last_editor = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If empty, indicates that the custom module was created in the - // organization, folder, or project in which you are viewing the custom - // module. Otherwise, `ancestor_module` specifies the organization or folder - // from which the custom module is inherited. - string ancestor_module = 7 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/SecurityHealthAnalyticsCustomModule" - } - ]; - - // The user specified custom configuration for the module. - CustomConfig custom_config = 8; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_marks.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_marks.proto deleted file mode 100644 index 74c641dea83..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/security_marks.proto +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/resource.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// User specified security marks that are attached to the parent Security -// Command Center resource. Security marks are scoped within a Security Command -// Center organization -- they can be modified and viewed by all users who have -// proper permissions on the organization. -message SecurityMarks { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/SecurityMarks" - pattern: "organizations/{organization}/assets/{asset}/securityMarks" - pattern: "organizations/{organization}/sources/{source}/findings/{finding}/securityMarks" - pattern: "folders/{folder}/assets/{asset}/securityMarks" - pattern: "projects/{project}/assets/{asset}/securityMarks" - pattern: "folders/{folder}/sources/{source}/findings/{finding}/securityMarks" - pattern: "projects/{project}/sources/{source}/findings/{finding}/securityMarks" - }; - - // The relative resource name of the SecurityMarks. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Examples: - // "organizations/{organization_id}/assets/{asset_id}/securityMarks" - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks". - string name = 1; - - // Mutable user specified security marks belonging to the parent resource. - // Constraints are as follows: - // - // * Keys and values are treated as case insensitive - // * Keys must be between 1 - 256 characters (inclusive) - // * Keys must be letters, numbers, underscores, or dashes - // * Values have leading and trailing whitespace trimmed, remaining - // characters must be between 1 - 4096 characters (inclusive) - map marks = 2; - - // The canonical name of the marks. - // Examples: - // "organizations/{organization_id}/assets/{asset_id}/securityMarks" - // "folders/{folder_id}/assets/{asset_id}/securityMarks" - // "projects/{project_number}/assets/{asset_id}/securityMarks" - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks" - // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}/securityMarks" - // "projects/{project_number}/sources/{source_id}/findings/{finding_id}/securityMarks" - string canonical_name = 3; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/securitycenter_service.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/securitycenter_service.proto deleted file mode 100644 index 052c9cebccb..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/securitycenter_service.proto +++ /dev/null @@ -1,2215 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1/asset.proto"; -import "google/cloud/securitycenter/v1/bigquery_export.proto"; -import "google/cloud/securitycenter/v1/effective_security_health_analytics_custom_module.proto"; -import "google/cloud/securitycenter/v1/external_system.proto"; -import "google/cloud/securitycenter/v1/finding.proto"; -import "google/cloud/securitycenter/v1/folder.proto"; -import "google/cloud/securitycenter/v1/mute_config.proto"; -import "google/cloud/securitycenter/v1/notification_config.proto"; -import "google/cloud/securitycenter/v1/organization_settings.proto"; -import "google/cloud/securitycenter/v1/run_asset_discovery_response.proto"; -import "google/cloud/securitycenter/v1/security_health_analytics_custom_module.proto"; -import "google/cloud/securitycenter/v1/security_marks.proto"; -import "google/cloud/securitycenter/v1/source.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// V1 APIs for Security Center service. -service SecurityCenter { - option (google.api.default_host) = "securitycenter.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Kicks off an LRO to bulk mute findings for a parent based on a filter. The - // parent can be either an organization, folder or project. The findings - // matched by the filter will be muted after the LRO is done. - rpc BulkMuteFindings(BulkMuteFindingsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*}/findings:bulkMute" - body: "*" - additional_bindings { - post: "/v1/{parent=folders/*}/findings:bulkMute" - body: "*" - } - additional_bindings { - post: "/v1/{parent=projects/*}/findings:bulkMute" - body: "*" - } - }; - option (google.api.method_signature) = "parent"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.securitycenter.v1.BulkMuteFindingsResponse" - metadata_type: "google.protobuf.Empty" - }; - } - - // Creates a resident SecurityHealthAnalyticsCustomModule at the scope of the - // given CRM parent, and also creates inherited - // SecurityHealthAnalyticsCustomModules for all CRM descendants of the given - // parent. These modules are enabled by default. - rpc CreateSecurityHealthAnalyticsCustomModule( - CreateSecurityHealthAnalyticsCustomModuleRequest) - returns (SecurityHealthAnalyticsCustomModule) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*/securityHealthAnalyticsSettings}/customModules" - body: "security_health_analytics_custom_module" - additional_bindings { - post: "/v1/{parent=folders/*/securityHealthAnalyticsSettings}/customModules" - body: "security_health_analytics_custom_module" - } - additional_bindings { - post: "/v1/{parent=projects/*/securityHealthAnalyticsSettings}/customModules" - body: "security_health_analytics_custom_module" - } - }; - option (google.api.method_signature) = - "parent,security_health_analytics_custom_module"; - } - - // Creates a source. - rpc CreateSource(CreateSourceRequest) returns (Source) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*}/sources" - body: "source" - }; - option (google.api.method_signature) = "parent,source"; - } - - // Creates a finding. The corresponding source must exist for finding creation - // to succeed. - rpc CreateFinding(CreateFindingRequest) returns (Finding) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*/sources/*}/findings" - body: "finding" - }; - option (google.api.method_signature) = "parent,finding_id,finding"; - } - - // Creates a mute config. - rpc CreateMuteConfig(CreateMuteConfigRequest) returns (MuteConfig) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*}/muteConfigs" - body: "mute_config" - additional_bindings { - post: "/v1/{parent=folders/*}/muteConfigs" - body: "mute_config" - } - additional_bindings { - post: "/v1/{parent=projects/*}/muteConfigs" - body: "mute_config" - } - }; - option (google.api.method_signature) = "parent,mute_config"; - option (google.api.method_signature) = "parent,mute_config,mute_config_id"; - } - - // Creates a notification config. - rpc CreateNotificationConfig(CreateNotificationConfigRequest) - returns (NotificationConfig) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*}/notificationConfigs" - body: "notification_config" - additional_bindings { - post: "/v1/{parent=folders/*}/notificationConfigs" - body: "notification_config" - } - additional_bindings { - post: "/v1/{parent=projects/*}/notificationConfigs" - body: "notification_config" - } - }; - option (google.api.method_signature) = - "parent,config_id,notification_config"; - option (google.api.method_signature) = "parent,notification_config"; - } - - // Deletes an existing mute config. - rpc DeleteMuteConfig(DeleteMuteConfigRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=organizations/*/muteConfigs/*}" - additional_bindings { delete: "/v1/{name=folders/*/muteConfigs/*}" } - additional_bindings { delete: "/v1/{name=projects/*/muteConfigs/*}" } - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a notification config. - rpc DeleteNotificationConfig(DeleteNotificationConfigRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=organizations/*/notificationConfigs/*}" - additional_bindings { - delete: "/v1/{name=folders/*/notificationConfigs/*}" - } - additional_bindings { - delete: "/v1/{name=projects/*/notificationConfigs/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Deletes the specified SecurityHealthAnalyticsCustomModule and all of its - // descendants in the CRM hierarchy. This method is only supported for - // resident custom modules. - rpc DeleteSecurityHealthAnalyticsCustomModule( - DeleteSecurityHealthAnalyticsCustomModuleRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=organizations/*/securityHealthAnalyticsSettings/customModules/*}" - additional_bindings { - delete: "/v1/{name=folders/*/securityHealthAnalyticsSettings/customModules/*}" - } - additional_bindings { - delete: "/v1/{name=projects/*/securityHealthAnalyticsSettings/customModules/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Gets a BigQuery export. - rpc GetBigQueryExport(GetBigQueryExportRequest) returns (BigQueryExport) { - option (google.api.http) = { - get: "/v1/{name=organizations/*/bigQueryExports/*}" - additional_bindings { get: "/v1/{name=folders/*/bigQueryExports/*}" } - additional_bindings { get: "/v1/{name=projects/*/bigQueryExports/*}" } - }; - option (google.api.method_signature) = "name"; - } - - // Gets the access control policy on the specified Source. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) - returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1/{resource=organizations/*/sources/*}:getIamPolicy" - body: "*" - }; - option (google.api.method_signature) = "resource"; - } - - // Gets a mute config. - rpc GetMuteConfig(GetMuteConfigRequest) returns (MuteConfig) { - option (google.api.http) = { - get: "/v1/{name=organizations/*/muteConfigs/*}" - additional_bindings { get: "/v1/{name=folders/*/muteConfigs/*}" } - additional_bindings { get: "/v1/{name=projects/*/muteConfigs/*}" } - }; - option (google.api.method_signature) = "name"; - } - - // Gets a notification config. - rpc GetNotificationConfig(GetNotificationConfigRequest) - returns (NotificationConfig) { - option (google.api.http) = { - get: "/v1/{name=organizations/*/notificationConfigs/*}" - additional_bindings { get: "/v1/{name=folders/*/notificationConfigs/*}" } - additional_bindings { get: "/v1/{name=projects/*/notificationConfigs/*}" } - }; - option (google.api.method_signature) = "name"; - } - - // Gets the settings for an organization. - rpc GetOrganizationSettings(GetOrganizationSettingsRequest) - returns (OrganizationSettings) { - option (google.api.http) = { - get: "/v1/{name=organizations/*/organizationSettings}" - }; - option (google.api.method_signature) = "name"; - } - - // Retrieves an EffectiveSecurityHealthAnalyticsCustomModule. - rpc GetEffectiveSecurityHealthAnalyticsCustomModule( - GetEffectiveSecurityHealthAnalyticsCustomModuleRequest) - returns (EffectiveSecurityHealthAnalyticsCustomModule) { - option (google.api.http) = { - get: "/v1/{name=organizations/*/securityHealthAnalyticsSettings/effectiveCustomModules/*}" - additional_bindings { - get: "/v1/{name=folders/*/securityHealthAnalyticsSettings/effectiveCustomModules/*}" - } - additional_bindings { - get: "/v1/{name=projects/*/securityHealthAnalyticsSettings/effectiveCustomModules/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Retrieves a SecurityHealthAnalyticsCustomModule. - rpc GetSecurityHealthAnalyticsCustomModule( - GetSecurityHealthAnalyticsCustomModuleRequest) - returns (SecurityHealthAnalyticsCustomModule) { - option (google.api.http) = { - get: "/v1/{name=organizations/*/securityHealthAnalyticsSettings/customModules/*}" - additional_bindings { - get: "/v1/{name=folders/*/securityHealthAnalyticsSettings/customModules/*}" - } - additional_bindings { - get: "/v1/{name=projects/*/securityHealthAnalyticsSettings/customModules/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Gets a source. - rpc GetSource(GetSourceRequest) returns (Source) { - option (google.api.http) = { - get: "/v1/{name=organizations/*/sources/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Filters an organization's assets and groups them by their specified - // properties. - rpc GroupAssets(GroupAssetsRequest) returns (GroupAssetsResponse) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*}/assets:group" - body: "*" - additional_bindings { - post: "/v1/{parent=folders/*}/assets:group" - body: "*" - } - additional_bindings { - post: "/v1/{parent=projects/*}/assets:group" - body: "*" - } - }; - } - - // Filters an organization or source's findings and groups them by their - // specified properties. - // - // To group across all sources provide a `-` as the source id. - // Example: /v1/organizations/{organization_id}/sources/-/findings, - // /v1/folders/{folder_id}/sources/-/findings, - // /v1/projects/{project_id}/sources/-/findings - rpc GroupFindings(GroupFindingsRequest) returns (GroupFindingsResponse) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*/sources/*}/findings:group" - body: "*" - additional_bindings { - post: "/v1/{parent=folders/*/sources/*}/findings:group" - body: "*" - } - additional_bindings { - post: "/v1/{parent=projects/*/sources/*}/findings:group" - body: "*" - } - }; - option (google.api.method_signature) = "parent,group_by"; - } - - // Lists an organization's assets. - rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { - option (google.api.http) = { - get: "/v1/{parent=organizations/*}/assets" - additional_bindings { get: "/v1/{parent=folders/*}/assets" } - additional_bindings { get: "/v1/{parent=projects/*}/assets" } - }; - } - - // Returns a list of all resident SecurityHealthAnalyticsCustomModules under - // the given CRM parent and all of the parent’s CRM descendants. - rpc ListDescendantSecurityHealthAnalyticsCustomModules( - ListDescendantSecurityHealthAnalyticsCustomModulesRequest) - returns (ListDescendantSecurityHealthAnalyticsCustomModulesResponse) { - option (google.api.http) = { - get: "/v1/{parent=organizations/*/securityHealthAnalyticsSettings}/customModules:listDescendant" - additional_bindings { - get: "/v1/{parent=folders/*/securityHealthAnalyticsSettings}/customModules:listDescendant" - } - additional_bindings { - get: "/v1/{parent=projects/*/securityHealthAnalyticsSettings}/customModules:listDescendant" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Lists an organization or source's findings. - // - // To list across all sources provide a `-` as the source id. - // Example: /v1/organizations/{organization_id}/sources/-/findings - rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { - option (google.api.http) = { - get: "/v1/{parent=organizations/*/sources/*}/findings" - additional_bindings { get: "/v1/{parent=folders/*/sources/*}/findings" } - additional_bindings { get: "/v1/{parent=projects/*/sources/*}/findings" } - }; - } - - // Lists mute configs. - rpc ListMuteConfigs(ListMuteConfigsRequest) - returns (ListMuteConfigsResponse) { - option (google.api.http) = { - get: "/v1/{parent=organizations/*}/muteConfigs" - additional_bindings { get: "/v1/{parent=folders/*}/muteConfigs" } - additional_bindings { get: "/v1/{parent=projects/*}/muteConfigs" } - }; - option (google.api.method_signature) = "parent"; - } - - // Lists notification configs. - rpc ListNotificationConfigs(ListNotificationConfigsRequest) - returns (ListNotificationConfigsResponse) { - option (google.api.http) = { - get: "/v1/{parent=organizations/*}/notificationConfigs" - additional_bindings { get: "/v1/{parent=folders/*}/notificationConfigs" } - additional_bindings { get: "/v1/{parent=projects/*}/notificationConfigs" } - }; - option (google.api.method_signature) = "parent"; - } - - // Returns a list of all EffectiveSecurityHealthAnalyticsCustomModules for the - // given parent. This includes resident modules defined at the scope of the - // parent, and inherited modules, inherited from CRM ancestors. - rpc ListEffectiveSecurityHealthAnalyticsCustomModules( - ListEffectiveSecurityHealthAnalyticsCustomModulesRequest) - returns (ListEffectiveSecurityHealthAnalyticsCustomModulesResponse) { - option (google.api.http) = { - get: "/v1/{parent=organizations/*/securityHealthAnalyticsSettings}/effectiveCustomModules" - additional_bindings { - get: "/v1/{parent=folders/*/securityHealthAnalyticsSettings}/effectiveCustomModules" - } - additional_bindings { - get: "/v1/{parent=projects/*/securityHealthAnalyticsSettings}/effectiveCustomModules" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Returns a list of all SecurityHealthAnalyticsCustomModules for the given - // parent. This includes resident modules defined at the scope of the parent, - // and inherited modules, inherited from CRM ancestors. - rpc ListSecurityHealthAnalyticsCustomModules( - ListSecurityHealthAnalyticsCustomModulesRequest) - returns (ListSecurityHealthAnalyticsCustomModulesResponse) { - option (google.api.http) = { - get: "/v1/{parent=organizations/*/securityHealthAnalyticsSettings}/customModules" - additional_bindings { - get: "/v1/{parent=folders/*/securityHealthAnalyticsSettings}/customModules" - } - additional_bindings { - get: "/v1/{parent=projects/*/securityHealthAnalyticsSettings}/customModules" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Lists all sources belonging to an organization. - rpc ListSources(ListSourcesRequest) returns (ListSourcesResponse) { - option (google.api.http) = { - get: "/v1/{parent=organizations/*}/sources" - additional_bindings { get: "/v1/{parent=folders/*}/sources" } - additional_bindings { get: "/v1/{parent=projects/*}/sources" } - }; - option (google.api.method_signature) = "parent"; - } - - // Runs asset discovery. The discovery is tracked with a long-running - // operation. - // - // This API can only be called with limited frequency for an organization. If - // it is called too frequently the caller will receive a TOO_MANY_REQUESTS - // error. - rpc RunAssetDiscovery(RunAssetDiscoveryRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*}/assets:runDiscovery" - body: "*" - }; - option (google.api.method_signature) = "parent"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.securitycenter.v1.RunAssetDiscoveryResponse" - metadata_type: "google.protobuf.Empty" - }; - } - - // Updates the state of a finding. - rpc SetFindingState(SetFindingStateRequest) returns (Finding) { - option (google.api.http) = { - post: "/v1/{name=organizations/*/sources/*/findings/*}:setState" - body: "*" - additional_bindings { - post: "/v1/{name=folders/*/sources/*/findings/*}:setState" - body: "*" - } - additional_bindings { - post: "/v1/{name=projects/*/sources/*/findings/*}:setState" - body: "*" - } - }; - option (google.api.method_signature) = "name,state,start_time"; - } - - // Updates the mute state of a finding. - rpc SetMute(SetMuteRequest) returns (Finding) { - option (google.api.http) = { - post: "/v1/{name=organizations/*/sources/*/findings/*}:setMute" - body: "*" - additional_bindings { - post: "/v1/{name=folders/*/sources/*/findings/*}:setMute" - body: "*" - } - additional_bindings { - post: "/v1/{name=projects/*/sources/*/findings/*}:setMute" - body: "*" - } - }; - option (google.api.method_signature) = "name,mute"; - } - - // Sets the access control policy on the specified Source. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) - returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1/{resource=organizations/*/sources/*}:setIamPolicy" - body: "*" - }; - option (google.api.method_signature) = "resource,policy"; - } - - // Returns the permissions that a caller has on the specified source. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) - returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1/{resource=organizations/*/sources/*}:testIamPermissions" - body: "*" - }; - option (google.api.method_signature) = "resource,permissions"; - } - - // Updates external system. This is for a given finding. - rpc UpdateExternalSystem(UpdateExternalSystemRequest) - returns (ExternalSystem) { - option (google.api.http) = { - patch: "/v1/{external_system.name=organizations/*/sources/*/findings/*/externalSystems/*}" - body: "external_system" - additional_bindings { - patch: "/v1/{external_system.name=folders/*/sources/*/findings/*/externalSystems/*}" - body: "external_system" - } - additional_bindings { - patch: "/v1/{external_system.name=projects/*/sources/*/findings/*/externalSystems/*}" - body: "external_system" - } - }; - option (google.api.method_signature) = "external_system,update_mask"; - } - - // Creates or updates a finding. The corresponding source must exist for a - // finding creation to succeed. - rpc UpdateFinding(UpdateFindingRequest) returns (Finding) { - option (google.api.http) = { - patch: "/v1/{finding.name=organizations/*/sources/*/findings/*}" - body: "finding" - additional_bindings { - patch: "/v1/{finding.name=folders/*/sources/*/findings/*}" - body: "finding" - } - additional_bindings { - patch: "/v1/{finding.name=projects/*/sources/*/findings/*}" - body: "finding" - } - }; - option (google.api.method_signature) = "finding"; - } - - // Updates a mute config. - rpc UpdateMuteConfig(UpdateMuteConfigRequest) returns (MuteConfig) { - option (google.api.http) = { - patch: "/v1/{mute_config.name=organizations/*/muteConfigs/*}" - body: "mute_config" - additional_bindings { - patch: "/v1/{mute_config.name=folders/*/muteConfigs/*}" - body: "mute_config" - } - additional_bindings { - patch: "/v1/{mute_config.name=projects/*/muteConfigs/*}" - body: "mute_config" - } - }; - option (google.api.method_signature) = "mute_config,update_mask"; - } - - // - // Updates a notification config. The following update - // fields are allowed: description, pubsub_topic, streaming_config.filter - rpc UpdateNotificationConfig(UpdateNotificationConfigRequest) - returns (NotificationConfig) { - option (google.api.http) = { - patch: "/v1/{notification_config.name=organizations/*/notificationConfigs/*}" - body: "notification_config" - additional_bindings { - patch: "/v1/{notification_config.name=folders/*/notificationConfigs/*}" - body: "notification_config" - } - additional_bindings { - patch: "/v1/{notification_config.name=projects/*/notificationConfigs/*}" - body: "notification_config" - } - }; - option (google.api.method_signature) = "notification_config"; - option (google.api.method_signature) = "notification_config,update_mask"; - } - - // Updates an organization's settings. - rpc UpdateOrganizationSettings(UpdateOrganizationSettingsRequest) - returns (OrganizationSettings) { - option (google.api.http) = { - patch: "/v1/{organization_settings.name=organizations/*/organizationSettings}" - body: "organization_settings" - }; - option (google.api.method_signature) = "organization_settings"; - } - - // Updates the SecurityHealthAnalyticsCustomModule under the given name based - // on the given update mask. Updating the enablement state is supported on - // both resident and inherited modules (though resident modules cannot have an - // enablement state of "inherited"). Updating the display name and custom - // config of a module is supported on resident modules only. - rpc UpdateSecurityHealthAnalyticsCustomModule( - UpdateSecurityHealthAnalyticsCustomModuleRequest) - returns (SecurityHealthAnalyticsCustomModule) { - option (google.api.http) = { - patch: "/v1/{security_health_analytics_custom_module.name=organizations/*/securityHealthAnalyticsSettings/customModules/*}" - body: "security_health_analytics_custom_module" - additional_bindings { - patch: "/v1/{security_health_analytics_custom_module.name=folders/*/securityHealthAnalyticsSettings/customModules/*}" - body: "security_health_analytics_custom_module" - } - additional_bindings { - patch: "/v1/{security_health_analytics_custom_module.name=projects/*/securityHealthAnalyticsSettings/customModules/*}" - body: "security_health_analytics_custom_module" - } - }; - option (google.api.method_signature) = - "security_health_analytics_custom_module,update_mask"; - } - - // Updates a source. - rpc UpdateSource(UpdateSourceRequest) returns (Source) { - option (google.api.http) = { - patch: "/v1/{source.name=organizations/*/sources/*}" - body: "source" - }; - option (google.api.method_signature) = "source"; - } - - // Updates security marks. - rpc UpdateSecurityMarks(UpdateSecurityMarksRequest) returns (SecurityMarks) { - option (google.api.http) = { - patch: "/v1/{security_marks.name=organizations/*/assets/*/securityMarks}" - body: "security_marks" - additional_bindings { - patch: "/v1/{security_marks.name=folders/*/assets/*/securityMarks}" - body: "security_marks" - } - additional_bindings { - patch: "/v1/{security_marks.name=projects/*/assets/*/securityMarks}" - body: "security_marks" - } - additional_bindings { - patch: "/v1/{security_marks.name=organizations/*/sources/*/findings/*/securityMarks}" - body: "security_marks" - } - additional_bindings { - patch: "/v1/{security_marks.name=folders/*/sources/*/findings/*/securityMarks}" - body: "security_marks" - } - additional_bindings { - patch: "/v1/{security_marks.name=projects/*/sources/*/findings/*/securityMarks}" - body: "security_marks" - } - }; - option (google.api.method_signature) = "security_marks"; - } - - // Creates a BigQuery export. - rpc CreateBigQueryExport(CreateBigQueryExportRequest) - returns (BigQueryExport) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*}/bigQueryExports" - body: "big_query_export" - additional_bindings { - post: "/v1/{parent=folders/*}/bigQueryExports" - body: "big_query_export" - } - additional_bindings { - post: "/v1/{parent=projects/*}/bigQueryExports" - body: "big_query_export" - } - }; - option (google.api.method_signature) = - "parent,big_query_export,big_query_export_id"; - } - - // Deletes an existing BigQuery export. - rpc DeleteBigQueryExport(DeleteBigQueryExportRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=organizations/*/bigQueryExports/*}" - additional_bindings { delete: "/v1/{name=folders/*/bigQueryExports/*}" } - additional_bindings { delete: "/v1/{name=projects/*/bigQueryExports/*}" } - }; - option (google.api.method_signature) = "name"; - } - - // Updates a BigQuery export. - rpc UpdateBigQueryExport(UpdateBigQueryExportRequest) - returns (BigQueryExport) { - option (google.api.http) = { - patch: "/v1/{big_query_export.name=organizations/*/bigQueryExports/*}" - body: "big_query_export" - additional_bindings { - patch: "/v1/{big_query_export.name=folders/*/bigQueryExports/*}" - body: "big_query_export" - } - additional_bindings { - patch: "/v1/{big_query_export.name=projects/*/bigQueryExports/*}" - body: "big_query_export" - } - }; - option (google.api.method_signature) = "big_query_export,update_mask"; - } - - // 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. - rpc ListBigQueryExports(ListBigQueryExportsRequest) - returns (ListBigQueryExportsResponse) { - option (google.api.http) = { - get: "/v1/{parent=organizations/*}/bigQueryExports" - additional_bindings { get: "/v1/{parent=folders/*}/bigQueryExports" } - additional_bindings { get: "/v1/{parent=projects/*}/bigQueryExports" } - }; - option (google.api.method_signature) = "parent"; - } -} - -// Request message for bulk findings update. -// -// Note: -// 1. If multiple bulk update requests match the same resource, the order in -// which they get executed is not defined. -// 2. Once a bulk operation is started, there is no way to stop it. -message BulkMuteFindingsRequest { - // Required. The parent, at which bulk action needs to be applied. Its format - // is "organizations/[organization_id]", "folders/[folder_id]", - // "projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "*" } - ]; - - // Expression that identifies findings that should be updated. - // 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. - string filter = 2; - - // This can be a mute configuration name or any identifier for mute/unmute - // of findings based on the filter. - string mute_annotation = 3 [deprecated = true]; -} - -// The response to a BulkMute request. Contains the LRO information. -message BulkMuteFindingsResponse {} - -// Request message for creating a finding. -message CreateFindingRequest { - // Required. Resource name of the new finding's parent. Its format should be - // "organizations/[organization_id]/sources/[source_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; - - // Required. Unique identifier provided by the client within the parent scope. - // It must be alphanumeric and less than or equal to 32 characters and - // greater than 0 characters in length. - string finding_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Finding being created. The name and security_marks will be - // ignored as they are both output only fields on this resource. - Finding finding = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for creating a mute config. -message CreateMuteConfigRequest { - // Required. Resource name of the new mute configs's parent. Its format is - // "organizations/[organization_id]", "folders/[folder_id]", or - // "projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/MuteConfig" - } - ]; - - // Required. The mute config being created. - MuteConfig mute_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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. - string mute_config_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for creating a notification config. -message CreateNotificationConfigRequest { - // Required. Resource name of the new notification config's parent. Its format - // is "organizations/[organization_id]", "folders/[folder_id]", or - // "projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/NotificationConfig" - } - ]; - - // Required. - // Unique identifier provided by the client within the parent scope. - // It must be between 1 and 128 characters and contain alphanumeric - // characters, underscores, or hyphens only. - string config_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The notification config being created. The name and the service - // account will be ignored as they are both output only fields on this - // resource. - NotificationConfig notification_config = 3 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for creating Security Health Analytics custom modules. -message CreateSecurityHealthAnalyticsCustomModuleRequest { - // Required. Resource name of the new custom module's parent. Its format is - // "organizations/{organization}/securityHealthAnalyticsSettings", - // "folders/{folder}/securityHealthAnalyticsSettings", or - // "projects/{project}/securityHealthAnalyticsSettings" - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/SecurityHealthAnalyticsCustomModule" - } - ]; - - // Required. SecurityHealthAnalytics custom module to create. The provided - // name is ignored and reset with provided parent information and - // server-generated ID. - SecurityHealthAnalyticsCustomModule security_health_analytics_custom_module = - 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for creating a source. -message CreateSourceRequest { - // Required. Resource name of the new source's parent. Its format should be - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // Required. The Source being created, only the display_name and description - // will be used. All other fields will be ignored. - Source source = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for deleting a mute config. -message DeleteMuteConfigRequest { - // Required. Name of the mute config to delete. Its format is - // organizations/{organization}/muteConfigs/{config_id}, - // folders/{folder}/muteConfigs/{config_id}, or - // projects/{project}/muteConfigs/{config_id} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/MuteConfig" - } - ]; -} - -// Request message for deleting a notification config. -message DeleteNotificationConfigRequest { - // Required. Name of the notification config to delete. Its format is - // "organizations/[organization_id]/notificationConfigs/[config_id]", - // "folders/[folder_id]/notificationConfigs/[config_id]", - // or "projects/[project_id]/notificationConfigs/[config_id]". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/NotificationConfig" - } - ]; -} - -// Request message for deleting Security Health Analytics custom modules. -message DeleteSecurityHealthAnalyticsCustomModuleRequest { - // Required. Name of the custom module to delete. Its format is - // "organizations/{organization}/securityHealthAnalyticsSettings/customModules/{customModule}", - // "folders/{folder}/securityHealthAnalyticsSettings/customModules/{customModule}", - // or - // "projects/{project}/securityHealthAnalyticsSettings/customModules/{customModule}" - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/SecurityHealthAnalyticsCustomModule" - } - ]; -} - -// Request message for retrieving a BigQuery export. -message GetBigQueryExportRequest { - // Required. Name of the BigQuery export to retrieve. Its format is - // organizations/{organization}/bigQueryExports/{export_id}, - // folders/{folder}/bigQueryExports/{export_id}, or - // projects/{project}/bigQueryExports/{export_id} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/BigQueryExport" - } - ]; -} - -// Request message for retrieving a mute config. -message GetMuteConfigRequest { - // Required. Name of the mute config to retrieve. Its format is - // organizations/{organization}/muteConfigs/{config_id}, - // folders/{folder}/muteConfigs/{config_id}, or - // projects/{project}/muteConfigs/{config_id} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/MuteConfig" - } - ]; -} - -// Request message for getting a notification config. -message GetNotificationConfigRequest { - // Required. Name of the notification config to get. Its format is - // "organizations/[organization_id]/notificationConfigs/[config_id]", - // "folders/[folder_id]/notificationConfigs/[config_id]", - // or "projects/[project_id]/notificationConfigs/[config_id]". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/NotificationConfig" - } - ]; -} - -// Request message for getting organization settings. -message GetOrganizationSettingsRequest { - // Required. Name of the organization to get organization settings for. Its - // format is "organizations/[organization_id]/organizationSettings". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/OrganizationSettings" - } - ]; -} - -// Request message for getting effective Security Health Analytics custom -// modules. -message GetEffectiveSecurityHealthAnalyticsCustomModuleRequest { - // Required. Name of the effective custom module to get. Its format is - // "organizations/{organization}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}", - // "folders/{folder}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}", - // or - // "projects/{project}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}" - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/EffectiveSecurityHealthAnalyticsCustomModule" - } - ]; -} - -// Request message for getting Security Health Analytics custom modules. -message GetSecurityHealthAnalyticsCustomModuleRequest { - // Required. Name of the custom module to get. Its format is - // "organizations/{organization}/securityHealthAnalyticsSettings/customModules/{customModule}", - // "folders/{folder}/securityHealthAnalyticsSettings/customModules/{customModule}", - // or - // "projects/{project}/securityHealthAnalyticsSettings/customModules/{customModule}" - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/SecurityHealthAnalyticsCustomModule" - } - ]; -} - -// Request message for getting a source. -message GetSourceRequest { - // Required. Relative resource name of the source. Its format is - // "organizations/[organization_id]/source/[source_id]". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; -} - -// Request message for grouping by assets. -message GroupAssetsRequest { - // Required. The name of the parent to group the assets by. Its format is - // "organizations/[organization_id]", "folders/[folder_id]", or - // "projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/Asset" - } - ]; - - // Expression that defines the filter to apply across assets. - // 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 Asset resource. Examples include: - // - // * name - // * security_center_properties.resource_name - // * resource_properties.a_property - // * security_marks.marks.marka - // - // 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. - // - // The following field and operator combinations are supported: - // - // * name: `=` - // * update_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `update_time = "2019-06-10T16:07:18-07:00"` - // `update_time = 1560208038000` - // - // * create_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `create_time = "2019-06-10T16:07:18-07:00"` - // `create_time = 1560208038000` - // - // * iam_policy.policy_blob: `=`, `:` - // * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - // * security_marks.marks: `=`, `:` - // * security_center_properties.resource_name: `=`, `:` - // * security_center_properties.resource_display_name: `=`, `:` - // * security_center_properties.resource_type: `=`, `:` - // * security_center_properties.resource_parent: `=`, `:` - // * security_center_properties.resource_parent_display_name: `=`, `:` - // * security_center_properties.resource_project: `=`, `:` - // * security_center_properties.resource_project_display_name: `=`, `:` - // * security_center_properties.resource_owners: `=`, `:` - // - // For example, `resource_properties.size = 100` is a valid filter string. - // - // Use a partial match on the empty string to filter based on a property - // existing: `resource_properties.my_property : ""` - // - // Use a negated partial match on the empty string to filter based on a - // property not existing: `-resource_properties.my_property : ""` - string filter = 2; - - // Required. Expression that defines what assets fields to use for grouping. - // The string value should follow SQL syntax: comma separated list of fields. - // For example: - // "security_center_properties.resource_project,security_center_properties.project". - // - // The following fields are supported when compare_duration is not set: - // - // * security_center_properties.resource_project - // * security_center_properties.resource_project_display_name - // * security_center_properties.resource_type - // * security_center_properties.resource_parent - // * security_center_properties.resource_parent_display_name - // - // The following fields are supported when compare_duration is set: - // - // * security_center_properties.resource_type - // * security_center_properties.resource_project_display_name - // * security_center_properties.resource_parent_display_name - string group_by = 3 [(google.api.field_behavior) = REQUIRED]; - - // When compare_duration is set, the GroupResult's "state_change" property is - // updated to indicate whether the asset was added, removed, or remained - // present during the compare_duration period of time that precedes the - // read_time. This is the time between (read_time - compare_duration) and - // read_time. - // - // The state change value is derived based on the presence of the asset at the - // two points in time. Intermediate state changes between the two times don't - // affect the result. For example, the results aren't affected if the asset is - // removed and re-created again. - // - // Possible "state_change" values when compare_duration is specified: - // - // * "ADDED": indicates that the asset was not present at the start of - // compare_duration, but present at reference_time. - // * "REMOVED": indicates that the asset was present at the start of - // compare_duration, but not present at reference_time. - // * "ACTIVE": indicates that the asset was present at both the - // start and the end of the time period defined by - // compare_duration and reference_time. - // - // If compare_duration is not specified, then the only possible state_change - // is "UNUSED", which will be the state_change set for all assets present at - // read_time. - // - // If this field is set then `state_change` must be a specified field in - // `group_by`. - google.protobuf.Duration compare_duration = 4; - - // Time used as a reference point when filtering assets. The filter is limited - // to assets existing at the supplied time and their values are those at that - // specific time. Absence of this field will default to the API's version of - // NOW. - google.protobuf.Timestamp read_time = 5; - - // The value returned by the last `GroupAssetsResponse`; indicates - // that this is a continuation of a prior `GroupAssets` call, and that the - // system should return the next page of data. - string page_token = 7; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 8; -} - -// Response message for grouping by assets. -message GroupAssetsResponse { - // Group results. There exists an element for each existing unique - // combination of property/values. The element contains a count for the number - // of times those specific property/values appear. - repeated GroupResult group_by_results = 1; - - // Time used for executing the groupBy request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of results matching the query. - int32 total_size = 4; -} - -// Request message for grouping by findings. -message GroupFindingsRequest { - // Required. Name of the source to groupBy. Its format is - // "organizations/[organization_id]/sources/[source_id]", - // folders/[folder_id]/sources/[source_id], or - // projects/[project_id]/sources/[source_id]. To groupBy across all sources - // provide a source_id of `-`. For example: - // organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - // or projects/{project_id}/sources/- - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; - - // Expression that defines the filter to apply across findings. - // The expression is a list of one 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. Examples include: - // - // * name - // * source_properties.a_property - // * security_marks.marks.marka - // - // 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. - // - // The following field and operator combinations are supported: - // - // * name: `=` - // * parent: `=`, `:` - // * resource_name: `=`, `:` - // * state: `=`, `:` - // * category: `=`, `:` - // * external_uri: `=`, `:` - // * event_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `event_time = "2019-06-10T16:07:18-07:00"` - // `event_time = 1560208038000` - // - // * severity: `=`, `:` - // * workflow_state: `=`, `:` - // * security_marks.marks: `=`, `:` - // * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - // - // For example, `source_properties.size = 100` is a valid filter string. - // - // Use a partial match on the empty string to filter based on a property - // existing: `source_properties.my_property : ""` - // - // Use a negated partial match on the empty string to filter based on a - // property not existing: `-source_properties.my_property : ""` - // - // * resource: - // * resource.name: `=`, `:` - // * resource.parent_name: `=`, `:` - // * resource.parent_display_name: `=`, `:` - // * resource.project_name: `=`, `:` - // * resource.project_display_name: `=`, `:` - // * resource.type: `=`, `:` - string filter = 2; - - // Required. Expression that defines what assets fields to use for grouping - // (including `state_change`). The string value should follow SQL syntax: - // comma separated list of fields. For example: "parent,resource_name". - // - // The following fields are supported: - // - // * resource_name - // * category - // * state - // * parent - // * severity - // - // The following fields are supported when compare_duration is set: - // - // * state_change - string group_by = 3 [(google.api.field_behavior) = REQUIRED]; - - // Time used as a reference point when filtering findings. The filter is - // limited to findings existing at the supplied time and their values are - // those at that specific time. Absence of this field will default to the - // API's version of NOW. - google.protobuf.Timestamp read_time = 4; - - // When compare_duration is set, the GroupResult's "state_change" attribute is - // updated to indicate whether the finding had its state changed, the - // finding's state remained unchanged, or if the finding was added during the - // compare_duration period of time that precedes the read_time. This is the - // time between (read_time - compare_duration) and read_time. - // - // The state_change value is derived based on the presence and state of the - // finding at the two points in time. Intermediate state changes between the - // two times don't affect the result. For example, the results aren't affected - // if the finding is made inactive and then active again. - // - // Possible "state_change" values when compare_duration is specified: - // - // * "CHANGED": indicates that the finding was present and matched the given - // filter at the start of compare_duration, but changed its - // state at read_time. - // * "UNCHANGED": indicates that the finding was present and matched the given - // filter at the start of compare_duration and did not change - // state at read_time. - // * "ADDED": indicates that the finding did not match the given filter or - // was not present at the start of compare_duration, but was - // present at read_time. - // * "REMOVED": indicates that the finding was present and matched the - // filter at the start of compare_duration, but did not match - // the filter at read_time. - // - // If compare_duration is not specified, then the only possible state_change - // is "UNUSED", which will be the state_change set for all findings present - // at read_time. - // - // If this field is set then `state_change` must be a specified field in - // `group_by`. - google.protobuf.Duration compare_duration = 5; - - // The value returned by the last `GroupFindingsResponse`; indicates - // that this is a continuation of a prior `GroupFindings` call, and - // that the system should return the next page of data. - string page_token = 7; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 8; -} - -// Response message for group by findings. -message GroupFindingsResponse { - // Group results. There exists an element for each existing unique - // combination of property/values. The element contains a count for the number - // of times those specific property/values appear. - repeated GroupResult group_by_results = 1; - - // Time used for executing the groupBy request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of results matching the query. - int32 total_size = 4; -} - -// Result containing the properties and count of a groupBy request. -message GroupResult { - // Properties matching the groupBy fields in the request. - map properties = 1; - - // Total count of resources for the given properties. - int64 count = 2; -} - -// Request message for listing descendant Security Health Analytics custom -// modules. -message ListDescendantSecurityHealthAnalyticsCustomModulesRequest { - // Required. Name of parent to list descendant custom modules. Its format is - // "organizations/{organization}/securityHealthAnalyticsSettings", - // "folders/{folder}/securityHealthAnalyticsSettings", or - // "projects/{project}/securityHealthAnalyticsSettings" - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/SecurityHealthAnalyticsCustomModule" - } - ]; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 2; - - // The value returned by the last call indicating a continuation - string page_token = 3; -} - -// Response message for listing descendant Security Health Analytics custom -// modules. -message ListDescendantSecurityHealthAnalyticsCustomModulesResponse { - // Custom modules belonging to the requested parent and its descendants. - repeated SecurityHealthAnalyticsCustomModule - security_health_analytics_custom_modules = 1; - - // If not empty, indicates that there may be more custom modules to be - // returned. - string next_page_token = 2; -} - -// Request message for listing mute configs at a given scope e.g. organization, -// folder or project. -message ListMuteConfigsRequest { - // Required. The parent, which owns the collection of mute configs. Its format - // is "organizations/[organization_id]", "folders/[folder_id]", - // "projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/MuteConfig" - } - ]; - - // 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. - int32 page_size = 2; - - // A page token, received from a previous `ListMuteConfigs` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListMuteConfigs` must - // match the call that provided the page token. - string page_token = 3; -} - -// Response message for listing mute configs. -message ListMuteConfigsResponse { - // The mute configs from the specified parent. - repeated MuteConfig mute_configs = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for listing notification configs. -message ListNotificationConfigsRequest { - // Required. The name of the parent in which to list the notification - // configurations. Its format is "organizations/[organization_id]", - // "folders/[folder_id]", or "projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/NotificationConfig" - } - ]; - - // The value returned by the last `ListNotificationConfigsResponse`; indicates - // that this is a continuation of a prior `ListNotificationConfigs` call, and - // that the system should return the next page of data. - string page_token = 2; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 3; -} - -// Response message for listing notification configs. -message ListNotificationConfigsResponse { - // Notification configs belonging to the requested parent. - repeated NotificationConfig notification_configs = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 2; -} - -// Request message for listing effective Security Health Analytics custom -// modules. -message ListEffectiveSecurityHealthAnalyticsCustomModulesRequest { - // Required. Name of parent to list effective custom modules. Its format is - // "organizations/{organization}/securityHealthAnalyticsSettings", - // "folders/{folder}/securityHealthAnalyticsSettings", or - // "projects/{project}/securityHealthAnalyticsSettings" - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/SecurityHealthAnalyticsCustomModule" - } - ]; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 2; - - // The value returned by the last call indicating a continuation - string page_token = 3; -} - -// Response message for listing effective Security Health Analytics custom -// modules. -message ListEffectiveSecurityHealthAnalyticsCustomModulesResponse { - // Effective custom modules belonging to the requested parent. - repeated EffectiveSecurityHealthAnalyticsCustomModule - effective_security_health_analytics_custom_modules = 1; - - // If not empty, indicates that there may be more effective custom modules to - // be returned. - string next_page_token = 2; -} - -// Request message for listing Security Health Analytics custom modules. -message ListSecurityHealthAnalyticsCustomModulesRequest { - // Required. Name of parent to list custom modules. Its format is - // "organizations/{organization}/securityHealthAnalyticsSettings", - // "folders/{folder}/securityHealthAnalyticsSettings", or - // "projects/{project}/securityHealthAnalyticsSettings" - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/SecurityHealthAnalyticsCustomModule" - } - ]; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 2; - - // The value returned by the last call indicating a continuation - string page_token = 3; -} - -// Response message for listing Security Health Analytics custom modules. -message ListSecurityHealthAnalyticsCustomModulesResponse { - // Custom modules belonging to the requested parent. - repeated SecurityHealthAnalyticsCustomModule - security_health_analytics_custom_modules = 1; - - // If not empty, indicates that there may be more custom modules to be - // returned. - string next_page_token = 2; -} - -// Request message for listing sources. -message ListSourcesRequest { - // Required. Resource name of the parent of sources to list. Its format should - // be "organizations/[organization_id]", "folders/[folder_id]", or - // "projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/Source" - } - ]; - - // The value returned by the last `ListSourcesResponse`; indicates - // that this is a continuation of a prior `ListSources` call, and - // that the system should return the next page of data. - string page_token = 2; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 7; -} - -// Response message for listing sources. -message ListSourcesResponse { - // Sources belonging to the requested parent. - repeated Source sources = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 2; -} - -// Request message for listing assets. -message ListAssetsRequest { - // Required. The name of the parent resource that contains the assets. The - // value that you can specify on parent depends on the method in which you - // specify parent. You can specify one of the following values: - // "organizations/[organization_id]", "folders/[folder_id]", or - // "projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/Asset" - } - ]; - - // Expression that defines the filter to apply across assets. - // 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 Asset resource. Examples include: - // - // * name - // * security_center_properties.resource_name - // * resource_properties.a_property - // * security_marks.marks.marka - // - // 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. - // - // The following are the allowed field and operator combinations: - // - // * name: `=` - // * update_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `update_time = "2019-06-10T16:07:18-07:00"` - // `update_time = 1560208038000` - // - // * create_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `create_time = "2019-06-10T16:07:18-07:00"` - // `create_time = 1560208038000` - // - // * iam_policy.policy_blob: `=`, `:` - // * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - // * security_marks.marks: `=`, `:` - // * security_center_properties.resource_name: `=`, `:` - // * security_center_properties.resource_display_name: `=`, `:` - // * security_center_properties.resource_type: `=`, `:` - // * security_center_properties.resource_parent: `=`, `:` - // * security_center_properties.resource_parent_display_name: `=`, `:` - // * security_center_properties.resource_project: `=`, `:` - // * security_center_properties.resource_project_display_name: `=`, `:` - // * security_center_properties.resource_owners: `=`, `:` - // - // For example, `resource_properties.size = 100` is a valid filter string. - // - // Use a partial match on the empty string to filter based on a property - // existing: `resource_properties.my_property : ""` - // - // Use a negated partial match on the empty string to filter based on a - // property not existing: `-resource_properties.my_property : ""` - string filter = 2; - - // Expression that defines what fields and order to use for sorting. The - // string value should follow SQL syntax: comma separated list of fields. For - // example: "name,resource_properties.a_property". The default sorting order - // is ascending. To specify descending order for a field, a suffix " desc" - // should be appended to the field name. For example: "name - // desc,resource_properties.a_property". Redundant space characters in the - // syntax are insignificant. "name desc,resource_properties.a_property" and " - // name desc , resource_properties.a_property " are equivalent. - // - // The following fields are supported: - // name - // update_time - // resource_properties - // security_marks.marks - // security_center_properties.resource_name - // security_center_properties.resource_display_name - // security_center_properties.resource_parent - // security_center_properties.resource_parent_display_name - // security_center_properties.resource_project - // security_center_properties.resource_project_display_name - // security_center_properties.resource_type - string order_by = 3; - - // Time used as a reference point when filtering assets. The filter is limited - // to assets existing at the supplied time and their values are those at that - // specific time. Absence of this field will default to the API's version of - // NOW. - google.protobuf.Timestamp read_time = 4; - - // When compare_duration is set, the ListAssetsResult's "state_change" - // attribute is updated to indicate whether the asset was added, removed, or - // remained present during the compare_duration period of time that precedes - // the read_time. This is the time between (read_time - compare_duration) and - // read_time. - // - // The state_change value is derived based on the presence of the asset at the - // two points in time. Intermediate state changes between the two times don't - // affect the result. For example, the results aren't affected if the asset is - // removed and re-created again. - // - // Possible "state_change" values when compare_duration is specified: - // - // * "ADDED": indicates that the asset was not present at the start of - // compare_duration, but present at read_time. - // * "REMOVED": indicates that the asset was present at the start of - // compare_duration, but not present at read_time. - // * "ACTIVE": indicates that the asset was present at both the - // start and the end of the time period defined by - // compare_duration and read_time. - // - // If compare_duration is not specified, then the only possible state_change - // is "UNUSED", which will be the state_change set for all assets present at - // read_time. - google.protobuf.Duration compare_duration = 5; - - // A field mask to specify the ListAssetsResult fields to be listed in the - // response. - // An empty field mask will list all fields. - google.protobuf.FieldMask field_mask = 7; - - // The value returned by the last `ListAssetsResponse`; indicates - // that this is a continuation of a prior `ListAssets` call, and - // that the system should return the next page of data. - string page_token = 8; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 9; -} - -// Response message for listing assets. -message ListAssetsResponse { - // Result containing the Asset and its State. - message ListAssetsResult { - // The change in state of the asset. - // - // When querying across two points in time this describes - // the change between the two points: ADDED, REMOVED, or ACTIVE. - // If there was no compare_duration supplied in the request the state change - // will be: UNUSED - enum StateChange { - // State change is unused, this is the canonical default for this enum. - UNUSED = 0; - - // Asset was added between the points in time. - ADDED = 1; - - // Asset was removed between the points in time. - REMOVED = 2; - - // Asset was present at both point(s) in time. - ACTIVE = 3; - } - - // Asset matching the search request. - Asset asset = 1; - - // State change of the asset between the points in time. - StateChange state_change = 2; - } - - // Assets matching the list request. - repeated ListAssetsResult list_assets_results = 1; - - // Time used for executing the list request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of assets matching the query. - int32 total_size = 4; -} - -// Request message for listing findings. -message ListFindingsRequest { - // Required. Name of the source the findings belong to. Its format is - // "organizations/[organization_id]/sources/[source_id], - // folders/[folder_id]/sources/[source_id], or - // projects/[project_id]/sources/[source_id]". To list across all sources - // provide a source_id of `-`. For example: - // organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - // projects/{projects_id}/sources/- - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; - - // Expression that defines the filter to apply across findings. - // The expression is a list of one 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. Examples include: - // - // * name - // * source_properties.a_property - // * security_marks.marks.marka - // - // 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. - // - // The following field and operator combinations are supported: - // - // * name: `=` - // * parent: `=`, `:` - // * resource_name: `=`, `:` - // * state: `=`, `:` - // * category: `=`, `:` - // * external_uri: `=`, `:` - // * event_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `event_time = "2019-06-10T16:07:18-07:00"` - // `event_time = 1560208038000` - // - // * severity: `=`, `:` - // * workflow_state: `=`, `:` - // * security_marks.marks: `=`, `:` - // * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - // - // For example, `source_properties.size = 100` is a valid filter string. - // - // Use a partial match on the empty string to filter based on a property - // existing: `source_properties.my_property : ""` - // - // Use a negated partial match on the empty string to filter based on a - // property not existing: `-source_properties.my_property : ""` - // - // * resource: - // * resource.name: `=`, `:` - // * resource.parent_name: `=`, `:` - // * resource.parent_display_name: `=`, `:` - // * resource.project_name: `=`, `:` - // * resource.project_display_name: `=`, `:` - // * resource.type: `=`, `:` - // * resource.folders.resource_folder: `=`, `:` - // * resource.display_name: `=`, `:` - string filter = 2; - - // Expression that defines what fields and order to use for sorting. The - // string value should follow SQL syntax: comma separated list of fields. For - // example: "name,resource_properties.a_property". The default sorting order - // is ascending. To specify descending order for a field, a suffix " desc" - // should be appended to the field name. For example: "name - // desc,source_properties.a_property". Redundant space characters in the - // syntax are insignificant. "name desc,source_properties.a_property" and " - // name desc , source_properties.a_property " are equivalent. - // - // The following fields are supported: - // name - // parent - // state - // category - // resource_name - // event_time - // source_properties - // security_marks.marks - string order_by = 3; - - // Time used as a reference point when filtering findings. The filter is - // limited to findings existing at the supplied time and their values are - // those at that specific time. Absence of this field will default to the - // API's version of NOW. - google.protobuf.Timestamp read_time = 4; - - // When compare_duration is set, the ListFindingsResult's "state_change" - // attribute is updated to indicate whether the finding had its state changed, - // the finding's state remained unchanged, or if the finding was added in any - // state during the compare_duration period of time that precedes the - // read_time. This is the time between (read_time - compare_duration) and - // read_time. - // - // The state_change value is derived based on the presence and state of the - // finding at the two points in time. Intermediate state changes between the - // two times don't affect the result. For example, the results aren't affected - // if the finding is made inactive and then active again. - // - // Possible "state_change" values when compare_duration is specified: - // - // * "CHANGED": indicates that the finding was present and matched the given - // filter at the start of compare_duration, but changed its - // state at read_time. - // * "UNCHANGED": indicates that the finding was present and matched the given - // filter at the start of compare_duration and did not change - // state at read_time. - // * "ADDED": indicates that the finding did not match the given filter or - // was not present at the start of compare_duration, but was - // present at read_time. - // * "REMOVED": indicates that the finding was present and matched the - // filter at the start of compare_duration, but did not match - // the filter at read_time. - // - // If compare_duration is not specified, then the only possible state_change - // is "UNUSED", which will be the state_change set for all findings present at - // read_time. - google.protobuf.Duration compare_duration = 5; - - // A field mask to specify the Finding fields to be listed in the response. - // An empty field mask will list all fields. - google.protobuf.FieldMask field_mask = 7; - - // The value returned by the last `ListFindingsResponse`; indicates - // that this is a continuation of a prior `ListFindings` call, and - // that the system should return the next page of data. - string page_token = 8; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 9; -} - -// Response message for listing findings. -message ListFindingsResponse { - // Result containing the Finding and its StateChange. - message ListFindingsResult { - // The change in state of the finding. - // - // When querying across two points in time this describes - // the change in the finding between the two points: CHANGED, UNCHANGED, - // ADDED, or REMOVED. Findings can not be deleted, so REMOVED implies that - // the finding at timestamp does not match the filter specified, but it did - // at timestamp - compare_duration. If there was no compare_duration - // supplied in the request the state change will be: UNUSED - enum StateChange { - // State change is unused, this is the canonical default for this enum. - UNUSED = 0; - - // The finding has changed state in some way between the points in time - // and existed at both points. - CHANGED = 1; - - // The finding has not changed state between the points in time and - // existed at both points. - UNCHANGED = 2; - - // The finding was created between the points in time. - ADDED = 3; - - // The finding at timestamp does not match the filter specified, but it - // did at timestamp - compare_duration. - REMOVED = 4; - } - - // Information related to the Google Cloud resource that is - // associated with this finding. - message Resource { - // The full resource name of the resource. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string name = 1; - - // The human readable name of the resource. - string display_name = 8; - - // The full resource type of the resource. - string type = 6; - - // The full resource name of project that the resource belongs to. - string project_name = 2; - - // The project ID that the resource belongs to. - string project_display_name = 3; - - // The full resource name of resource's parent. - string parent_name = 4; - - // The human readable name of resource's parent. - string parent_display_name = 5; - - // Contains a Folder message for each folder in the assets ancestry. - // The first folder is the deepest nested folder, and the last folder is - // the folder directly under the Organization. - repeated Folder folders = 7; - } - - // Finding matching the search request. - Finding finding = 1; - - // State change of the finding between the points in time. - StateChange state_change = 2; - - // Output only. Resource that is associated with this finding. - Resource resource = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Findings matching the list request. - repeated ListFindingsResult list_findings_results = 1; - - // Time used for executing the list request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of findings matching the query. - int32 total_size = 4; -} - -// Request message for updating a finding's state. -message SetFindingStateRequest { - // Required. The [relative resource - // name](https://cloud.google.com/apis/design/resource_names#relative_resource_name) - // of the finding. Example: - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", - // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}", - // "projects/{project_id}/sources/{source_id}/findings/{finding_id}". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Finding" - } - ]; - - // Required. The desired State of the finding. - Finding.State state = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The time at which the updated state takes effect. - google.protobuf.Timestamp start_time = 3 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for updating a finding's mute status. -message SetMuteRequest { - // Required. The [relative resource - // name](https://cloud.google.com/apis/design/resource_names#relative_resource_name) - // of the finding. Example: - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", - // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}", - // "projects/{project_id}/sources/{source_id}/findings/{finding_id}". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Finding" - } - ]; - - // Required. The desired state of the Mute. - Finding.Mute mute = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for running asset discovery for an organization. -message RunAssetDiscoveryRequest { - // Required. Name of the organization to run asset discovery for. Its format - // is "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; -} - -// Request message for updating a ExternalSystem resource. -message UpdateExternalSystemRequest { - // Required. The external system resource to update. - ExternalSystem external_system = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the external system resource. - // - // If empty all mutable fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating or creating a finding. -message UpdateFindingRequest { - // Required. The finding resource to update or create if it does not already - // exist. parent, security_marks, and update_time will be ignored. - // - // In the case of creation, the finding id portion of the name must be - // alphanumeric and less than or equal to 32 characters and greater than 0 - // characters in length. - Finding finding = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the finding resource. This field should - // not be specified when creating a finding. - // - // When updating a finding, an empty mask is treated as updating all mutable - // fields and replacing source_properties. Individual source_properties can - // be added/updated by using "source_properties." in the field - // mask. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating a mute config. -message UpdateMuteConfigRequest { - // Required. The mute config being updated. - MuteConfig mute_config = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. - // If empty all mutable fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating a notification config. -message UpdateNotificationConfigRequest { - // Required. The notification config to update. - NotificationConfig notification_config = 1 - [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the notification config. - // - // If empty all mutable fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating an organization's settings. -message UpdateOrganizationSettingsRequest { - // Required. The organization settings resource to update. - OrganizationSettings organization_settings = 1 - [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the settings resource. - // - // If empty all mutable fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating Security Health Analytics custom modules. -message UpdateSecurityHealthAnalyticsCustomModuleRequest { - // Required. The SecurityHealthAnalytics custom module to update. - SecurityHealthAnalyticsCustomModule security_health_analytics_custom_module = - 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to update. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating a source. -message UpdateSourceRequest { - // Required. The source resource to update. - Source source = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the source resource. - // - // If empty all mutable fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating a SecurityMarks resource. -message UpdateSecurityMarksRequest { - // Required. The security marks resource to update. - SecurityMarks security_marks = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the security marks resource. - // - // The field mask must not contain duplicate fields. - // If empty or set to "marks", all marks will be replaced. Individual - // marks can be updated using "marks.". - google.protobuf.FieldMask update_mask = 2; - - // The time at which the updated SecurityMarks take effect. - // If not set uses current server time. Updates will be applied to the - // SecurityMarks that are active immediately preceding this time. Must be - // earlier or equal to the server time. - google.protobuf.Timestamp start_time = 3; -} - -// Request message for creating a BigQuery export. -message CreateBigQueryExportRequest { - // Required. The name of the parent resource of the new BigQuery export. Its - // format is "organizations/[organization_id]", "folders/[folder_id]", or - // "projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/BigQueryExport" - } - ]; - - // Required. The BigQuery export being created. - BigQueryExport big_query_export = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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. - string big_query_export_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for updating a BigQuery export. -message UpdateBigQueryExportRequest { - // Required. The BigQuery export being updated. - BigQueryExport big_query_export = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. - // If empty all mutable fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for listing BigQuery exports at a given scope e.g. -// organization, folder or project. -message ListBigQueryExportsRequest { - // Required. The parent, which owns the collection of BigQuery exports. Its - // format is "organizations/[organization_id]", "folders/[folder_id]", - // "projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/BigQueryExport" - } - ]; - - // 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. - int32 page_size = 2; - - // 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. - string page_token = 3; -} - -// Response message for listing BigQuery exports. -message ListBigQueryExportsResponse { - // The BigQuery exports from the specified parent. - repeated BigQueryExport big_query_exports = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for deleting a BigQuery export. -message DeleteBigQueryExportRequest { - // Required. The name of the BigQuery export to delete. Its format is - // organizations/{organization}/bigQueryExports/{export_id}, - // folders/{folder}/bigQueryExports/{export_id}, or - // projects/{project}/bigQueryExports/{export_id} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/BigQueryExport" - } - ]; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/source.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/source.proto deleted file mode 100644 index 0aed0286225..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/source.proto +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/resource.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Security Command Center finding source. A finding source -// is an entity or a mechanism that can produce a finding. A source is like a -// container of findings that come from the same scanner, logger, monitor, and -// other tools. -message Source { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/Source" - pattern: "organizations/{organization}/sources/{source}" - pattern: "folders/{folder}/sources/{source}" - pattern: "projects/{project}/sources/{source}" - }; - - // The relative resource name of this source. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/sources/{source_id}" - string name = 1; - - // The source's display name. - // A source's display name must be unique amongst its siblings, for example, - // two sources with the same parent can't share the same display name. - // The display name must have a length between 1 and 64 characters - // (inclusive). - string display_name = 2; - - // The description of the source (max of 1024 characters). - // Example: - // "Web Security Scanner is a web security scanner for common - // vulnerabilities in App Engine applications. It can automatically - // scan and detect four common vulnerabilities, including cross-site-scripting - // (XSS), Flash injection, mixed content (HTTP in HTTPS), and - // outdated or insecure libraries." - string description = 3; - - // The canonical name of the finding. It's either - // "organizations/{organization_id}/sources/{source_id}", - // "folders/{folder_id}/sources/{source_id}" or - // "projects/{project_number}/sources/{source_id}", - // depending on the closest CRM ancestor of the resource associated with the - // finding. - string canonical_name = 14; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/vulnerability.proto b/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/vulnerability.proto deleted file mode 100644 index 457e88c7319..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/vulnerability.proto +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "VulnerabilityProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Refers to common vulnerability fields e.g. cve, cvss, cwe etc. -message Vulnerability { - // CVE stands for Common Vulnerabilities and Exposures - // (https://cve.mitre.org/about/) - Cve cve = 1; -} - -// CVE stands for Common Vulnerabilities and Exposures. -// More information: https://cve.mitre.org -message Cve { - // The unique identifier for the vulnerability. e.g. CVE-2021-34527 - string id = 1; - - // Additional information about the CVE. - // e.g. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-34527 - repeated Reference references = 2; - - // Describe Common Vulnerability Scoring System specified at - // https://www.first.org/cvss/v3.1/specification-document - Cvssv3 cvssv3 = 3; - - // Whether upstream fix is available for the CVE. - bool upstream_fix_available = 4; -} - -// Additional Links -message Reference { - // Source of the reference e.g. NVD - string source = 1; - - // Uri for the mentioned source e.g. - // https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-34527. - string uri = 2; -} - -// Common Vulnerability Scoring System version 3. -message Cvssv3 { - // This metric reflects the context by which vulnerability exploitation is - // possible. - enum AttackVector { - // Invalid value. - ATTACK_VECTOR_UNSPECIFIED = 0; - - // The vulnerable component is bound to the network stack and the set of - // possible attackers extends beyond the other options listed below, up to - // and including the entire Internet. - ATTACK_VECTOR_NETWORK = 1; - - // The vulnerable component is bound to the network stack, but the attack is - // limited at the protocol level to a logically adjacent topology. - ATTACK_VECTOR_ADJACENT = 2; - - // The vulnerable component is not bound to the network stack and the - // attacker's path is via read/write/execute capabilities. - ATTACK_VECTOR_LOCAL = 3; - - // The attack requires the attacker to physically touch or manipulate the - // vulnerable component. - ATTACK_VECTOR_PHYSICAL = 4; - } - - // This metric describes the conditions beyond the attacker's control that - // must exist in order to exploit the vulnerability. - enum AttackComplexity { - // Invalid value. - ATTACK_COMPLEXITY_UNSPECIFIED = 0; - - // Specialized access conditions or extenuating circumstances do not exist. - // An attacker can expect repeatable success when attacking the vulnerable - // component. - ATTACK_COMPLEXITY_LOW = 1; - - // A successful attack depends on conditions beyond the attacker's control. - // That is, a successful attack cannot be accomplished at will, but requires - // the attacker to invest in some measurable amount of effort in preparation - // or execution against the vulnerable component before a successful attack - // can be expected. - ATTACK_COMPLEXITY_HIGH = 2; - } - - // This metric describes the level of privileges an attacker must possess - // before successfully exploiting the vulnerability. - enum PrivilegesRequired { - // Invalid value. - PRIVILEGES_REQUIRED_UNSPECIFIED = 0; - - // The attacker is unauthorized prior to attack, and therefore does not - // require any access to settings or files of the vulnerable system to - // carry out an attack. - PRIVILEGES_REQUIRED_NONE = 1; - - // The attacker requires privileges that provide basic user capabilities - // that could normally affect only settings and files owned by a user. - // Alternatively, an attacker with Low privileges has the ability to access - // only non-sensitive resources. - PRIVILEGES_REQUIRED_LOW = 2; - - // The attacker requires privileges that provide significant (e.g., - // administrative) control over the vulnerable component allowing access to - // component-wide settings and files. - PRIVILEGES_REQUIRED_HIGH = 3; - } - - // This metric captures the requirement for a human user, other than the - // attacker, to participate in the successful compromise of the vulnerable - // component. - enum UserInteraction { - // Invalid value. - USER_INTERACTION_UNSPECIFIED = 0; - - // The vulnerable system can be exploited without interaction from any user. - USER_INTERACTION_NONE = 1; - - // Successful exploitation of this vulnerability requires a user to take - // some action before the vulnerability can be exploited. - USER_INTERACTION_REQUIRED = 2; - } - - // The Scope metric captures whether a vulnerability in one vulnerable - // component impacts resources in components beyond its security scope. - enum Scope { - // Invalid value. - SCOPE_UNSPECIFIED = 0; - - // An exploited vulnerability can only affect resources managed by the same - // security authority. - SCOPE_UNCHANGED = 1; - - // An exploited vulnerability can affect resources beyond the security scope - // managed by the security authority of the vulnerable component. - SCOPE_CHANGED = 2; - } - - // The Impact metrics capture the effects of a successfully exploited - // vulnerability on the component that suffers the worst outcome that is most - // directly and predictably associated with the attack. - enum Impact { - // Invalid value. - IMPACT_UNSPECIFIED = 0; - - // High impact. - IMPACT_HIGH = 1; - - // Low impact. - IMPACT_LOW = 2; - - // No impact. - IMPACT_NONE = 3; - } - - // The base score is a function of the base metric scores. - double base_score = 1; - - // Base Metrics - // Represents the intrinsic characteristics of a vulnerability that are - // constant over time and across user environments. - // This metric reflects the context by which vulnerability exploitation is - // possible. - AttackVector attack_vector = 5; - - // This metric describes the conditions beyond the attacker's control that - // must exist in order to exploit the vulnerability. - AttackComplexity attack_complexity = 6; - - // This metric describes the level of privileges an attacker must possess - // before successfully exploiting the vulnerability. - PrivilegesRequired privileges_required = 7; - - // This metric captures the requirement for a human user, other than the - // attacker, to participate in the successful compromise of the vulnerable - // component. - UserInteraction user_interaction = 8; - - // The Scope metric captures whether a vulnerability in one vulnerable - // component impacts resources in components beyond its security scope. - Scope scope = 9; - - // This metric measures the impact to the confidentiality of the information - // resources managed by a software component due to a successfully exploited - // vulnerability. - Impact confidentiality_impact = 10; - - // This metric measures the impact to integrity of a successfully exploited - // vulnerability. - Impact integrity_impact = 11; - - // This metric measures the impact to the availability of the impacted - // component resulting from a successfully exploited vulnerability. - Impact availability_impact = 12; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.bulk_mute_findings.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.bulk_mute_findings.js deleted file mode 100644 index 1e0ce0ee9c7..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.bulk_mute_findings.js +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, at which bulk action needs to be applied. Its format - * is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - */ - // const parent = 'abc123' - /** - * Expression that identifies findings that should be updated. - * 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. - */ - // const filter = 'abc123' - /** - * This can be a mute configuration name or any identifier for mute/unmute - * of findings based on the filter. - */ - // const muteAnnotation = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callBulkMuteFindings() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await securitycenterClient.bulkMuteFindings(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBulkMuteFindings(); - // [END securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_big_query_export.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_big_query_export.js deleted file mode 100644 index f5ffc8a929f..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_big_query_export.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, bigQueryExport, bigQueryExportId) { - // [START securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the parent resource of the new BigQuery export. Its - * format is "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - */ - // const parent = 'abc123' - /** - * Required. The BigQuery export being created. - */ - // const bigQueryExport = {} - /** - * 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. - */ - // const bigQueryExportId = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateBigQueryExport() { - // Construct request - const request = { - parent, - bigQueryExport, - bigQueryExportId, - }; - - // Run request - const response = await securitycenterClient.createBigQueryExport(request); - console.log(response); - } - - callCreateBigQueryExport(); - // [END securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_finding.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_finding.js deleted file mode 100644 index 4ef3d71c721..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_finding.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, findingId, finding) { - // [START securitycenter_v1_generated_SecurityCenter_CreateFinding_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new finding's parent. Its format should be - * "organizations/[organization_id]/sources/[source_id]". - */ - // const parent = 'abc123' - /** - * Required. Unique identifier provided by the client within the parent scope. - * It must be alphanumeric and less than or equal to 32 characters and - * greater than 0 characters in length. - */ - // const findingId = 'abc123' - /** - * Required. The Finding being created. The name and security_marks will be - * ignored as they are both output only fields on this resource. - */ - // const finding = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateFinding() { - // Construct request - const request = { - parent, - findingId, - finding, - }; - - // Run request - const response = await securitycenterClient.createFinding(request); - console.log(response); - } - - callCreateFinding(); - // [END securitycenter_v1_generated_SecurityCenter_CreateFinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_mute_config.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_mute_config.js deleted file mode 100644 index dec237a4b8e..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_mute_config.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, muteConfig, muteConfigId) { - // [START securitycenter_v1_generated_SecurityCenter_CreateMuteConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new mute configs's parent. Its format is - * "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - */ - // const parent = 'abc123' - /** - * Required. The mute config being created. - */ - // const muteConfig = {} - /** - * 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. - */ - // const muteConfigId = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateMuteConfig() { - // Construct request - const request = { - parent, - muteConfig, - muteConfigId, - }; - - // Run request - const response = await securitycenterClient.createMuteConfig(request); - console.log(response); - } - - callCreateMuteConfig(); - // [END securitycenter_v1_generated_SecurityCenter_CreateMuteConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_notification_config.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_notification_config.js deleted file mode 100644 index 51e50e56fdf..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_notification_config.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, configId, notificationConfig) { - // [START securitycenter_v1_generated_SecurityCenter_CreateNotificationConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new notification config's parent. Its format - * is "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - */ - // const parent = 'abc123' - /** - * Required. - * Unique identifier provided by the client within the parent scope. - * It must be between 1 and 128 characters and contain alphanumeric - * characters, underscores, or hyphens only. - */ - // const configId = 'abc123' - /** - * Required. The notification config being created. The name and the service - * account will be ignored as they are both output only fields on this - * resource. - */ - // const notificationConfig = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateNotificationConfig() { - // Construct request - const request = { - parent, - configId, - notificationConfig, - }; - - // Run request - const response = await securitycenterClient.createNotificationConfig(request); - console.log(response); - } - - callCreateNotificationConfig(); - // [END securitycenter_v1_generated_SecurityCenter_CreateNotificationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_security_health_analytics_custom_module.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_security_health_analytics_custom_module.js deleted file mode 100644 index 1bd26975723..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_security_health_analytics_custom_module.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, securityHealthAnalyticsCustomModule) { - // [START securitycenter_v1_generated_SecurityCenter_CreateSecurityHealthAnalyticsCustomModule_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new custom module's parent. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings", - * "folders/{folder}/securityHealthAnalyticsSettings", or - * "projects/{project}/securityHealthAnalyticsSettings" - */ - // const parent = 'abc123' - /** - * Required. SecurityHealthAnalytics custom module to create. The provided - * name is ignored and reset with provided parent information and - * server-generated ID. - */ - // const securityHealthAnalyticsCustomModule = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateSecurityHealthAnalyticsCustomModule() { - // Construct request - const request = { - parent, - securityHealthAnalyticsCustomModule, - }; - - // Run request - const response = await securitycenterClient.createSecurityHealthAnalyticsCustomModule(request); - console.log(response); - } - - callCreateSecurityHealthAnalyticsCustomModule(); - // [END securitycenter_v1_generated_SecurityCenter_CreateSecurityHealthAnalyticsCustomModule_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_source.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_source.js deleted file mode 100644 index 65ebcff52cb..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.create_source.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, source) { - // [START securitycenter_v1_generated_SecurityCenter_CreateSource_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new source's parent. Its format should be - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - /** - * Required. The Source being created, only the display_name and description - * will be used. All other fields will be ignored. - */ - // const source = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateSource() { - // Construct request - const request = { - parent, - source, - }; - - // Run request - const response = await securitycenterClient.createSource(request); - console.log(response); - } - - callCreateSource(); - // [END securitycenter_v1_generated_SecurityCenter_CreateSource_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_big_query_export.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_big_query_export.js deleted file mode 100644 index 8431ed836b6..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_big_query_export.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the BigQuery export to delete. Its format is - * organizations/{organization}/bigQueryExports/{export_id}, - * folders/{folder}/bigQueryExports/{export_id}, or - * projects/{project}/bigQueryExports/{export_id} - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callDeleteBigQueryExport() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.deleteBigQueryExport(request); - console.log(response); - } - - callDeleteBigQueryExport(); - // [END securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_mute_config.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_mute_config.js deleted file mode 100644 index 52be7752588..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_mute_config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_DeleteMuteConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the mute config to delete. Its format is - * organizations/{organization}/muteConfigs/{config_id}, - * folders/{folder}/muteConfigs/{config_id}, or - * projects/{project}/muteConfigs/{config_id} - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callDeleteMuteConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.deleteMuteConfig(request); - console.log(response); - } - - callDeleteMuteConfig(); - // [END securitycenter_v1_generated_SecurityCenter_DeleteMuteConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_notification_config.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_notification_config.js deleted file mode 100644 index 51096d1b3e3..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_notification_config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_DeleteNotificationConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the notification config to delete. Its format is - * "organizations/[organization_id]/notificationConfigs/[config_id]", - * "folders/[folder_id]/notificationConfigs/[config_id]", - * or "projects/[project_id]/notificationConfigs/[config_id]". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callDeleteNotificationConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.deleteNotificationConfig(request); - console.log(response); - } - - callDeleteNotificationConfig(); - // [END securitycenter_v1_generated_SecurityCenter_DeleteNotificationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_security_health_analytics_custom_module.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_security_health_analytics_custom_module.js deleted file mode 100644 index 86a77685ef9..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.delete_security_health_analytics_custom_module.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_DeleteSecurityHealthAnalyticsCustomModule_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the custom module to delete. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings/customModules/{customModule}", - * "folders/{folder}/securityHealthAnalyticsSettings/customModules/{customModule}", - * or - * "projects/{project}/securityHealthAnalyticsSettings/customModules/{customModule}" - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callDeleteSecurityHealthAnalyticsCustomModule() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.deleteSecurityHealthAnalyticsCustomModule(request); - console.log(response); - } - - callDeleteSecurityHealthAnalyticsCustomModule(); - // [END securitycenter_v1_generated_SecurityCenter_DeleteSecurityHealthAnalyticsCustomModule_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_big_query_export.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_big_query_export.js deleted file mode 100644 index 9d29e830f32..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_big_query_export.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the BigQuery export to retrieve. Its format is - * organizations/{organization}/bigQueryExports/{export_id}, - * folders/{folder}/bigQueryExports/{export_id}, or - * projects/{project}/bigQueryExports/{export_id} - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetBigQueryExport() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getBigQueryExport(request); - console.log(response); - } - - callGetBigQueryExport(); - // [END securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_effective_security_health_analytics_custom_module.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_effective_security_health_analytics_custom_module.js deleted file mode 100644 index 476cc6aaf3f..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_effective_security_health_analytics_custom_module.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_GetEffectiveSecurityHealthAnalyticsCustomModule_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the effective custom module to get. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}", - * "folders/{folder}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}", - * or - * "projects/{project}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}" - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetEffectiveSecurityHealthAnalyticsCustomModule() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getEffectiveSecurityHealthAnalyticsCustomModule(request); - console.log(response); - } - - callGetEffectiveSecurityHealthAnalyticsCustomModule(); - // [END securitycenter_v1_generated_SecurityCenter_GetEffectiveSecurityHealthAnalyticsCustomModule_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_iam_policy.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_iam_policy.js deleted file mode 100644 index 3901f396ce1..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_iam_policy.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resource) { - // [START securitycenter_v1_generated_SecurityCenter_GetIamPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - */ - // const options = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await securitycenterClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END securitycenter_v1_generated_SecurityCenter_GetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_mute_config.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_mute_config.js deleted file mode 100644 index e3c35dce8c9..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_mute_config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_GetMuteConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the mute config to retrieve. Its format is - * organizations/{organization}/muteConfigs/{config_id}, - * folders/{folder}/muteConfigs/{config_id}, or - * projects/{project}/muteConfigs/{config_id} - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetMuteConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getMuteConfig(request); - console.log(response); - } - - callGetMuteConfig(); - // [END securitycenter_v1_generated_SecurityCenter_GetMuteConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_notification_config.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_notification_config.js deleted file mode 100644 index b0d9970d8f5..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_notification_config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_GetNotificationConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the notification config to get. Its format is - * "organizations/[organization_id]/notificationConfigs/[config_id]", - * "folders/[folder_id]/notificationConfigs/[config_id]", - * or "projects/[project_id]/notificationConfigs/[config_id]". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetNotificationConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getNotificationConfig(request); - console.log(response); - } - - callGetNotificationConfig(); - // [END securitycenter_v1_generated_SecurityCenter_GetNotificationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_organization_settings.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_organization_settings.js deleted file mode 100644 index 06be4bf79f5..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_organization_settings.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_GetOrganizationSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to get organization settings for. Its - * format is "organizations/[organization_id]/organizationSettings". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetOrganizationSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getOrganizationSettings(request); - console.log(response); - } - - callGetOrganizationSettings(); - // [END securitycenter_v1_generated_SecurityCenter_GetOrganizationSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_security_health_analytics_custom_module.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_security_health_analytics_custom_module.js deleted file mode 100644 index 1c231328f48..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_security_health_analytics_custom_module.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_GetSecurityHealthAnalyticsCustomModule_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the custom module to get. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings/customModules/{customModule}", - * "folders/{folder}/securityHealthAnalyticsSettings/customModules/{customModule}", - * or - * "projects/{project}/securityHealthAnalyticsSettings/customModules/{customModule}" - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetSecurityHealthAnalyticsCustomModule() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getSecurityHealthAnalyticsCustomModule(request); - console.log(response); - } - - callGetSecurityHealthAnalyticsCustomModule(); - // [END securitycenter_v1_generated_SecurityCenter_GetSecurityHealthAnalyticsCustomModule_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_source.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_source.js deleted file mode 100644 index 2e45be1ae47..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.get_source.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_GetSource_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Relative resource name of the source. Its format is - * "organizations/[organization_id]/source/[source_id]". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetSource() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getSource(request); - console.log(response); - } - - callGetSource(); - // [END securitycenter_v1_generated_SecurityCenter_GetSource_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.group_assets.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.group_assets.js deleted file mode 100644 index 9a77c9a7694..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.group_assets.js +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, groupBy) { - // [START securitycenter_v1_generated_SecurityCenter_GroupAssets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the parent to group the assets by. Its format is - * "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across assets. - * 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 Asset resource. Examples include: - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * 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. - * The following field and operator combinations are supported: - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * For example, `resource_properties.size = 100` is a valid filter string. - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - */ - // const filter = 'abc123' - /** - * Required. Expression that defines what assets fields to use for grouping. - * The string value should follow SQL syntax: comma separated list of fields. - * For example: - * "security_center_properties.resource_project,security_center_properties.project". - * The following fields are supported when compare_duration is not set: - * * security_center_properties.resource_project - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * * security_center_properties.resource_parent_display_name - * The following fields are supported when compare_duration is set: - * * security_center_properties.resource_type - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_parent_display_name - */ - // const groupBy = 'abc123' - /** - * When compare_duration is set, the GroupResult's "state_change" property is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * The state change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * Possible "state_change" values when compare_duration is specified: - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * If this field is set then `state_change` must be a specified field in - * `group_by`. - */ - // const compareDuration = {} - /** - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - */ - // const readTime = {} - /** - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGroupAssets() { - // Construct request - const request = { - parent, - groupBy, - }; - - // Run request - const iterable = await securitycenterClient.groupAssetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callGroupAssets(); - // [END securitycenter_v1_generated_SecurityCenter_GroupAssets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.group_findings.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.group_findings.js deleted file mode 100644 index e86776056e5..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.group_findings.js +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, groupBy) { - // [START securitycenter_v1_generated_SecurityCenter_GroupFindings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]", - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]. To groupBy across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - * or projects/{project_id}/sources/- - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across findings. - * The expression is a list of one 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. Examples include: - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * 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. - * The following field and operator combinations are supported: - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * * severity: `=`, `:` - * * workflow_state: `=`, `:` - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * For example, `source_properties.size = 100` is a valid filter string. - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * * resource: - * * resource.name: `=`, `:` - * * resource.parent_name: `=`, `:` - * * resource.parent_display_name: `=`, `:` - * * resource.project_name: `=`, `:` - * * resource.project_display_name: `=`, `:` - * * resource.type: `=`, `:` - */ - // const filter = 'abc123' - /** - * Required. Expression that defines what assets fields to use for grouping - * (including `state_change`). The string value should follow SQL syntax: - * comma separated list of fields. For example: "parent,resource_name". - * The following fields are supported: - * * resource_name - * * category - * * state - * * parent - * * severity - * The following fields are supported when compare_duration is set: - * * state_change - */ - // const groupBy = 'abc123' - /** - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - */ - // const readTime = {} - /** - * When compare_duration is set, the GroupResult's "state_change" attribute is - * updated to indicate whether the finding had its state changed, the - * finding's state remained unchanged, or if the finding was added during the - * compare_duration period of time that precedes the read_time. This is the - * time between (read_time - compare_duration) and read_time. - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * Possible "state_change" values when compare_duration is specified: - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present - * at read_time. - * If this field is set then `state_change` must be a specified field in - * `group_by`. - */ - // const compareDuration = {} - /** - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGroupFindings() { - // Construct request - const request = { - parent, - groupBy, - }; - - // Run request - const iterable = await securitycenterClient.groupFindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callGroupFindings(); - // [END securitycenter_v1_generated_SecurityCenter_GroupFindings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_assets.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_assets.js deleted file mode 100644 index 0c96ef702f2..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_assets.js +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_ListAssets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the parent resource that contains the assets. The - * value that you can specify on parent depends on the method in which you - * specify parent. You can specify one of the following values: - * "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across assets. - * 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 Asset resource. Examples include: - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * 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. - * The following are the allowed field and operator combinations: - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * For example, `resource_properties.size = 100` is a valid filter string. - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - */ - // const filter = 'abc123' - /** - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * The following fields are supported: - * name - * update_time - * resource_properties - * security_marks.marks - * security_center_properties.resource_name - * security_center_properties.resource_display_name - * security_center_properties.resource_parent - * security_center_properties.resource_parent_display_name - * security_center_properties.resource_project - * security_center_properties.resource_project_display_name - * security_center_properties.resource_type - */ - // const orderBy = 'abc123' - /** - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - */ - // const readTime = {} - /** - * When compare_duration is set, the ListAssetsResult's "state_change" - * attribute is updated to indicate whether the asset was added, removed, or - * remained present during the compare_duration period of time that precedes - * the read_time. This is the time between (read_time - compare_duration) and - * read_time. - * The state_change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * Possible "state_change" values when compare_duration is specified: - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - */ - // const compareDuration = {} - /** - * A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - */ - // const fieldMask = {} - /** - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListAssets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listAssetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAssets(); - // [END securitycenter_v1_generated_SecurityCenter_ListAssets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_big_query_exports.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_big_query_exports.js deleted file mode 100644 index 0cd39cf6921..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_big_query_exports.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns the collection of BigQuery exports. Its - * format is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - */ - // const parent = 'abc123' - /** - * 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. - */ - // const pageSize = 1234 - /** - * 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. - */ - // const pageToken = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListBigQueryExports() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listBigQueryExportsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBigQueryExports(); - // [END securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_descendant_security_health_analytics_custom_modules.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_descendant_security_health_analytics_custom_modules.js deleted file mode 100644 index 778c97b4877..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_descendant_security_health_analytics_custom_modules.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_ListDescendantSecurityHealthAnalyticsCustomModules_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of parent to list descendant custom modules. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings", - * "folders/{folder}/securityHealthAnalyticsSettings", or - * "projects/{project}/securityHealthAnalyticsSettings" - */ - // const parent = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - /** - * The value returned by the last call indicating a continuation - */ - // const pageToken = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListDescendantSecurityHealthAnalyticsCustomModules() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listDescendantSecurityHealthAnalyticsCustomModulesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDescendantSecurityHealthAnalyticsCustomModules(); - // [END securitycenter_v1_generated_SecurityCenter_ListDescendantSecurityHealthAnalyticsCustomModules_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_effective_security_health_analytics_custom_modules.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_effective_security_health_analytics_custom_modules.js deleted file mode 100644 index 5eac21f2c77..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_effective_security_health_analytics_custom_modules.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_ListEffectiveSecurityHealthAnalyticsCustomModules_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of parent to list effective custom modules. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings", - * "folders/{folder}/securityHealthAnalyticsSettings", or - * "projects/{project}/securityHealthAnalyticsSettings" - */ - // const parent = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - /** - * The value returned by the last call indicating a continuation - */ - // const pageToken = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListEffectiveSecurityHealthAnalyticsCustomModules() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listEffectiveSecurityHealthAnalyticsCustomModulesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListEffectiveSecurityHealthAnalyticsCustomModules(); - // [END securitycenter_v1_generated_SecurityCenter_ListEffectiveSecurityHealthAnalyticsCustomModules_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_findings.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_findings.js deleted file mode 100644 index 909c58a0515..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_findings.js +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_ListFindings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id], - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]". To list across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - * projects/{projects_id}/sources/- - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across findings. - * The expression is a list of one 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. Examples include: - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * 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. - * The following field and operator combinations are supported: - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * * severity: `=`, `:` - * * workflow_state: `=`, `:` - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * For example, `source_properties.size = 100` is a valid filter string. - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * * resource: - * * resource.name: `=`, `:` - * * resource.parent_name: `=`, `:` - * * resource.parent_display_name: `=`, `:` - * * resource.project_name: `=`, `:` - * * resource.project_display_name: `=`, `:` - * * resource.type: `=`, `:` - * * resource.folders.resource_folder: `=`, `:` - * * resource.display_name: `=`, `:` - */ - // const filter = 'abc123' - /** - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * The following fields are supported: - * name - * parent - * state - * category - * resource_name - * event_time - * source_properties - * security_marks.marks - */ - // const orderBy = 'abc123' - /** - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - */ - // const readTime = {} - /** - * When compare_duration is set, the ListFindingsResult's "state_change" - * attribute is updated to indicate whether the finding had its state changed, - * the finding's state remained unchanged, or if the finding was added in any - * state during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * Possible "state_change" values when compare_duration is specified: - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present at - * read_time. - */ - // const compareDuration = {} - /** - * A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - */ - // const fieldMask = {} - /** - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListFindings() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listFindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFindings(); - // [END securitycenter_v1_generated_SecurityCenter_ListFindings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_mute_configs.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_mute_configs.js deleted file mode 100644 index 3427c281eb3..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_mute_configs.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_ListMuteConfigs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns the collection of mute configs. Its format - * is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - */ - // const parent = 'abc123' - /** - * 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. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListMuteConfigs` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListMuteConfigs` must - * match the call that provided the page token. - */ - // const pageToken = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListMuteConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listMuteConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMuteConfigs(); - // [END securitycenter_v1_generated_SecurityCenter_ListMuteConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_notification_configs.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_notification_configs.js deleted file mode 100644 index 7a0dfec9fce..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_notification_configs.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_ListNotificationConfigs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the parent in which to list the notification - * configurations. Its format is "organizations/[organization_id]", - * "folders/[folder_id]", or "projects/[project_id]". - */ - // const parent = 'abc123' - /** - * The value returned by the last `ListNotificationConfigsResponse`; indicates - * that this is a continuation of a prior `ListNotificationConfigs` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListNotificationConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listNotificationConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListNotificationConfigs(); - // [END securitycenter_v1_generated_SecurityCenter_ListNotificationConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_security_health_analytics_custom_modules.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_security_health_analytics_custom_modules.js deleted file mode 100644 index 513f96d67aa..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_security_health_analytics_custom_modules.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_ListSecurityHealthAnalyticsCustomModules_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of parent to list custom modules. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings", - * "folders/{folder}/securityHealthAnalyticsSettings", or - * "projects/{project}/securityHealthAnalyticsSettings" - */ - // const parent = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - /** - * The value returned by the last call indicating a continuation - */ - // const pageToken = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListSecurityHealthAnalyticsCustomModules() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listSecurityHealthAnalyticsCustomModulesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSecurityHealthAnalyticsCustomModules(); - // [END securitycenter_v1_generated_SecurityCenter_ListSecurityHealthAnalyticsCustomModules_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_sources.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_sources.js deleted file mode 100644 index e1f7a076417..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.list_sources.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_ListSources_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the parent of sources to list. Its format should - * be "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - */ - // const parent = 'abc123' - /** - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListSources() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listSourcesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSources(); - // [END securitycenter_v1_generated_SecurityCenter_ListSources_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.run_asset_discovery.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.run_asset_discovery.js deleted file mode 100644 index 9e9e4f42480..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.run_asset_discovery.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to run asset discovery for. Its format - * is "organizations/[organization_id]". - */ - // const parent = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callRunAssetDiscovery() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await securitycenterClient.runAssetDiscovery(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRunAssetDiscovery(); - // [END securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_finding_state.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_finding_state.js deleted file mode 100644 index 5ff07ee6428..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_finding_state.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, state, startTime) { - // [START securitycenter_v1_generated_SecurityCenter_SetFindingState_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource - * name (https://cloud.google.com/apis/design/resource_names#relative_resource_name) - * of the finding. Example: - * "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", - * "folders/{folder_id}/sources/{source_id}/findings/{finding_id}", - * "projects/{project_id}/sources/{source_id}/findings/{finding_id}". - */ - // const name = 'abc123' - /** - * Required. The desired State of the finding. - */ - // const state = {} - /** - * Required. The time at which the updated state takes effect. - */ - // const startTime = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callSetFindingState() { - // Construct request - const request = { - name, - state, - startTime, - }; - - // Run request - const response = await securitycenterClient.setFindingState(request); - console.log(response); - } - - callSetFindingState(); - // [END securitycenter_v1_generated_SecurityCenter_SetFindingState_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_iam_policy.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_iam_policy.js deleted file mode 100644 index 828a587ecf1..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_iam_policy.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resource, policy) { - // [START securitycenter_v1_generated_SecurityCenter_SetIamPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - */ - // const policy = {} - /** - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * `paths: "bindings, etag"` - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await securitycenterClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END securitycenter_v1_generated_SecurityCenter_SetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_mute.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_mute.js deleted file mode 100644 index d1e22987715..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.set_mute.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, mute) { - // [START securitycenter_v1_generated_SecurityCenter_SetMute_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource - * name (https://cloud.google.com/apis/design/resource_names#relative_resource_name) - * of the finding. Example: - * "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", - * "folders/{folder_id}/sources/{source_id}/findings/{finding_id}", - * "projects/{project_id}/sources/{source_id}/findings/{finding_id}". - */ - // const name = 'abc123' - /** - * Required. The desired state of the Mute. - */ - // const mute = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callSetMute() { - // Construct request - const request = { - name, - mute, - }; - - // Run request - const response = await securitycenterClient.setMute(request); - console.log(response); - } - - callSetMute(); - // [END securitycenter_v1_generated_SecurityCenter_SetMute_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.test_iam_permissions.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.test_iam_permissions.js deleted file mode 100644 index f00a7ed09b0..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.test_iam_permissions.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resource, permissions) { - // [START securitycenter_v1_generated_SecurityCenter_TestIamPermissions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). - */ - // const permissions = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await securitycenterClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END securitycenter_v1_generated_SecurityCenter_TestIamPermissions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_big_query_export.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_big_query_export.js deleted file mode 100644 index d81a8c86db7..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_big_query_export.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(bigQueryExport) { - // [START securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The BigQuery export being updated. - */ - // const bigQueryExport = {} - /** - * The list of fields to be updated. - * If empty all mutable fields will be updated. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateBigQueryExport() { - // Construct request - const request = { - bigQueryExport, - }; - - // Run request - const response = await securitycenterClient.updateBigQueryExport(request); - console.log(response); - } - - callUpdateBigQueryExport(); - // [END securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_external_system.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_external_system.js deleted file mode 100644 index d6bd90c80d3..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_external_system.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(externalSystem) { - // [START securitycenter_v1_generated_SecurityCenter_UpdateExternalSystem_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The external system resource to update. - */ - // const externalSystem = {} - /** - * The FieldMask to use when updating the external system resource. - * If empty all mutable fields will be updated. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateExternalSystem() { - // Construct request - const request = { - externalSystem, - }; - - // Run request - const response = await securitycenterClient.updateExternalSystem(request); - console.log(response); - } - - callUpdateExternalSystem(); - // [END securitycenter_v1_generated_SecurityCenter_UpdateExternalSystem_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_finding.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_finding.js deleted file mode 100644 index 7aeb185be42..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_finding.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(finding) { - // [START securitycenter_v1_generated_SecurityCenter_UpdateFinding_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The finding resource to update or create if it does not already - * exist. parent, security_marks, and update_time will be ignored. - * In the case of creation, the finding id portion of the name must be - * alphanumeric and less than or equal to 32 characters and greater than 0 - * characters in length. - */ - // const finding = {} - /** - * The FieldMask to use when updating the finding resource. This field should - * not be specified when creating a finding. - * When updating a finding, an empty mask is treated as updating all mutable - * fields and replacing source_properties. Individual source_properties can - * be added/updated by using "source_properties." in the field - * mask. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateFinding() { - // Construct request - const request = { - finding, - }; - - // Run request - const response = await securitycenterClient.updateFinding(request); - console.log(response); - } - - callUpdateFinding(); - // [END securitycenter_v1_generated_SecurityCenter_UpdateFinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_mute_config.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_mute_config.js deleted file mode 100644 index 71e4ac6daa3..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_mute_config.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(muteConfig) { - // [START securitycenter_v1_generated_SecurityCenter_UpdateMuteConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The mute config being updated. - */ - // const muteConfig = {} - /** - * The list of fields to be updated. - * If empty all mutable fields will be updated. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateMuteConfig() { - // Construct request - const request = { - muteConfig, - }; - - // Run request - const response = await securitycenterClient.updateMuteConfig(request); - console.log(response); - } - - callUpdateMuteConfig(); - // [END securitycenter_v1_generated_SecurityCenter_UpdateMuteConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_notification_config.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_notification_config.js deleted file mode 100644 index 2769e3cd8f3..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_notification_config.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(notificationConfig) { - // [START securitycenter_v1_generated_SecurityCenter_UpdateNotificationConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The notification config to update. - */ - // const notificationConfig = {} - /** - * The FieldMask to use when updating the notification config. - * If empty all mutable fields will be updated. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateNotificationConfig() { - // Construct request - const request = { - notificationConfig, - }; - - // Run request - const response = await securitycenterClient.updateNotificationConfig(request); - console.log(response); - } - - callUpdateNotificationConfig(); - // [END securitycenter_v1_generated_SecurityCenter_UpdateNotificationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_organization_settings.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_organization_settings.js deleted file mode 100644 index bfe708a3f06..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_organization_settings.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(organizationSettings) { - // [START securitycenter_v1_generated_SecurityCenter_UpdateOrganizationSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The organization settings resource to update. - */ - // const organizationSettings = {} - /** - * The FieldMask to use when updating the settings resource. - * If empty all mutable fields will be updated. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateOrganizationSettings() { - // Construct request - const request = { - organizationSettings, - }; - - // Run request - const response = await securitycenterClient.updateOrganizationSettings(request); - console.log(response); - } - - callUpdateOrganizationSettings(); - // [END securitycenter_v1_generated_SecurityCenter_UpdateOrganizationSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_security_health_analytics_custom_module.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_security_health_analytics_custom_module.js deleted file mode 100644 index f23ceaf32a2..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_security_health_analytics_custom_module.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(securityHealthAnalyticsCustomModule) { - // [START securitycenter_v1_generated_SecurityCenter_UpdateSecurityHealthAnalyticsCustomModule_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The SecurityHealthAnalytics custom module to update. - */ - // const securityHealthAnalyticsCustomModule = {} - /** - * The list of fields to update. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateSecurityHealthAnalyticsCustomModule() { - // Construct request - const request = { - securityHealthAnalyticsCustomModule, - }; - - // Run request - const response = await securitycenterClient.updateSecurityHealthAnalyticsCustomModule(request); - console.log(response); - } - - callUpdateSecurityHealthAnalyticsCustomModule(); - // [END securitycenter_v1_generated_SecurityCenter_UpdateSecurityHealthAnalyticsCustomModule_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_security_marks.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_security_marks.js deleted file mode 100644 index 884a807d2f8..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_security_marks.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(securityMarks) { - // [START securitycenter_v1_generated_SecurityCenter_UpdateSecurityMarks_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The security marks resource to update. - */ - // const securityMarks = {} - /** - * The FieldMask to use when updating the security marks resource. - * The field mask must not contain duplicate fields. - * If empty or set to "marks", all marks will be replaced. Individual - * marks can be updated using "marks.". - */ - // const updateMask = {} - /** - * The time at which the updated SecurityMarks take effect. - * If not set uses current server time. Updates will be applied to the - * SecurityMarks that are active immediately preceding this time. Must be - * earlier or equal to the server time. - */ - // const startTime = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateSecurityMarks() { - // Construct request - const request = { - securityMarks, - }; - - // Run request - const response = await securitycenterClient.updateSecurityMarks(request); - console.log(response); - } - - callUpdateSecurityMarks(); - // [END securitycenter_v1_generated_SecurityCenter_UpdateSecurityMarks_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_source.js b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_source.js deleted file mode 100644 index f8c2bdffc96..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/security_center.update_source.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(source) { - // [START securitycenter_v1_generated_SecurityCenter_UpdateSource_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The source resource to update. - */ - // const source = {} - /** - * The FieldMask to use when updating the source resource. - * If empty all mutable fields will be updated. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateSource() { - // Construct request - const request = { - source, - }; - - // Run request - const response = await securitycenterClient.updateSource(request); - console.log(response); - } - - callUpdateSource(); - // [END securitycenter_v1_generated_SecurityCenter_UpdateSource_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json b/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json deleted file mode 100644 index f58fb1865bc..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json +++ /dev/null @@ -1,2051 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-securitycenter", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.securitycenter.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_async", - "title": "SecurityCenter bulkMuteFindings Sample", - "origin": "API_DEFINITION", - "description": " Kicks off an LRO to bulk mute findings for a parent based on a filter. The parent can be either an organization, folder or project. The findings matched by the filter will be muted after the LRO is done.", - "canonical": true, - "file": "security_center.bulk_mute_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BulkMuteFindings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.BulkMuteFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "mute_annotation", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "BulkMuteFindings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.BulkMuteFindings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateSecurityHealthAnalyticsCustomModule_async", - "title": "SecurityCenter createSecurityHealthAnalyticsCustomModule Sample", - "origin": "API_DEFINITION", - "description": " Creates a resident SecurityHealthAnalyticsCustomModule at the scope of the given CRM parent, and also creates inherited SecurityHealthAnalyticsCustomModules for all CRM descendants of the given parent. These modules are enabled by default.", - "canonical": true, - "file": "security_center.create_security_health_analytics_custom_module.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSecurityHealthAnalyticsCustomModule", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateSecurityHealthAnalyticsCustomModule", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "security_health_analytics_custom_module", - "type": ".google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule" - } - ], - "resultType": ".google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateSecurityHealthAnalyticsCustomModule", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateSecurityHealthAnalyticsCustomModule", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateSource_async", - "title": "SecurityCenter createSource Sample", - "origin": "API_DEFINITION", - "description": " Creates a source.", - "canonical": true, - "file": "security_center.create_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSource", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateSource", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "source", - "type": ".google.cloud.securitycenter.v1.Source" - } - ], - "resultType": ".google.cloud.securitycenter.v1.Source", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateSource", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateSource", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateFinding_async", - "title": "SecurityCenter createFinding Sample", - "origin": "API_DEFINITION", - "description": " Creates a finding. The corresponding source must exist for finding creation to succeed.", - "canonical": true, - "file": "security_center.create_finding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFinding", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateFinding", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "finding_id", - "type": "TYPE_STRING" - }, - { - "name": "finding", - "type": ".google.cloud.securitycenter.v1.Finding" - } - ], - "resultType": ".google.cloud.securitycenter.v1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateFinding", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateFinding", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateMuteConfig_async", - "title": "SecurityCenter createMuteConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a mute config.", - "canonical": true, - "file": "security_center.create_mute_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMuteConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateMuteConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "mute_config", - "type": ".google.cloud.securitycenter.v1.MuteConfig" - }, - { - "name": "mute_config_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.MuteConfig", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateMuteConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateMuteConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateNotificationConfig_async", - "title": "SecurityCenter createNotificationConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a notification config.", - "canonical": true, - "file": "security_center.create_notification_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateNotificationConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateNotificationConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "config_id", - "type": "TYPE_STRING" - }, - { - "name": "notification_config", - "type": ".google.cloud.securitycenter.v1.NotificationConfig" - } - ], - "resultType": ".google.cloud.securitycenter.v1.NotificationConfig", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateNotificationConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateNotificationConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_DeleteMuteConfig_async", - "title": "SecurityCenter deleteMuteConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing mute config.", - "canonical": true, - "file": "security_center.delete_mute_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteMuteConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteMuteConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "DeleteMuteConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteMuteConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_DeleteNotificationConfig_async", - "title": "SecurityCenter deleteNotificationConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes a notification config.", - "canonical": true, - "file": "security_center.delete_notification_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteNotificationConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteNotificationConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "DeleteNotificationConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteNotificationConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_DeleteSecurityHealthAnalyticsCustomModule_async", - "title": "SecurityCenter deleteSecurityHealthAnalyticsCustomModule Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified SecurityHealthAnalyticsCustomModule and all of its descendants in the CRM hierarchy. This method is only supported for resident custom modules.", - "canonical": true, - "file": "security_center.delete_security_health_analytics_custom_module.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteSecurityHealthAnalyticsCustomModule", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteSecurityHealthAnalyticsCustomModule", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "DeleteSecurityHealthAnalyticsCustomModule", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteSecurityHealthAnalyticsCustomModule", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_async", - "title": "SecurityCenter getBigQueryExport Sample", - "origin": "API_DEFINITION", - "description": " Gets a BigQuery export.", - "canonical": true, - "file": "security_center.get_big_query_export.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBigQueryExport", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetBigQueryExport", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.BigQueryExport", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "GetBigQueryExport", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetBigQueryExport", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_GetIamPolicy_async", - "title": "SecurityCenter getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the access control policy on the specified Source.", - "canonical": true, - "file": "security_center.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetIamPolicy", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_GetMuteConfig_async", - "title": "SecurityCenter getMuteConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a mute config.", - "canonical": true, - "file": "security_center.get_mute_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetMuteConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetMuteConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.MuteConfig", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "GetMuteConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetMuteConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_GetNotificationConfig_async", - "title": "SecurityCenter getNotificationConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a notification config.", - "canonical": true, - "file": "security_center.get_notification_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNotificationConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetNotificationConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.NotificationConfig", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "GetNotificationConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetNotificationConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_GetOrganizationSettings_async", - "title": "SecurityCenter getOrganizationSettings Sample", - "origin": "API_DEFINITION", - "description": " Gets the settings for an organization.", - "canonical": true, - "file": "security_center.get_organization_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetOrganizationSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.OrganizationSettings", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "GetOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetOrganizationSettings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_GetEffectiveSecurityHealthAnalyticsCustomModule_async", - "title": "SecurityCenter getEffectiveSecurityHealthAnalyticsCustomModule Sample", - "origin": "API_DEFINITION", - "description": " Retrieves an EffectiveSecurityHealthAnalyticsCustomModule.", - "canonical": true, - "file": "security_center.get_effective_security_health_analytics_custom_module.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetEffectiveSecurityHealthAnalyticsCustomModule", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetEffectiveSecurityHealthAnalyticsCustomModule", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "GetEffectiveSecurityHealthAnalyticsCustomModule", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetEffectiveSecurityHealthAnalyticsCustomModule", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_GetSecurityHealthAnalyticsCustomModule_async", - "title": "SecurityCenter getSecurityHealthAnalyticsCustomModule Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a SecurityHealthAnalyticsCustomModule.", - "canonical": true, - "file": "security_center.get_security_health_analytics_custom_module.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSecurityHealthAnalyticsCustomModule", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetSecurityHealthAnalyticsCustomModule", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "GetSecurityHealthAnalyticsCustomModule", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetSecurityHealthAnalyticsCustomModule", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_GetSource_async", - "title": "SecurityCenter getSource Sample", - "origin": "API_DEFINITION", - "description": " Gets a source.", - "canonical": true, - "file": "security_center.get_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSource", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetSource", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.Source", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "GetSource", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetSource", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_GroupAssets_async", - "title": "SecurityCenter groupAssets Sample", - "origin": "API_DEFINITION", - "description": " Filters an organization's assets and groups them by their specified properties.", - "canonical": true, - "file": "security_center.group_assets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 168, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GroupAssets", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GroupAssets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "group_by", - "type": "TYPE_STRING" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1.GroupAssetsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "GroupAssets", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GroupAssets", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_GroupFindings_async", - "title": "SecurityCenter groupFindings Sample", - "origin": "API_DEFINITION", - "description": " Filters an organization or source's findings and groups them by their specified properties. To group across all sources provide a `-` as the source id. Example: /v1/organizations/{organization_id}/sources/-/findings, /v1/folders/{folder_id}/sources/-/findings, /v1/projects/{project_id}/sources/-/findings", - "canonical": true, - "file": "security_center.group_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 172, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GroupFindings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GroupFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "group_by", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1.GroupFindingsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "GroupFindings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GroupFindings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_ListAssets_async", - "title": "SecurityCenter listAssets Sample", - "origin": "API_DEFINITION", - "description": " Lists an organization's assets.", - "canonical": true, - "file": "security_center.list_assets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 179, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAssets", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListAssets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "field_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1.ListAssetsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "ListAssets", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListAssets", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_ListDescendantSecurityHealthAnalyticsCustomModules_async", - "title": "SecurityCenter listDescendantSecurityHealthAnalyticsCustomModules Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of all resident SecurityHealthAnalyticsCustomModules under the given CRM parent and all of the parent’s CRM descendants.", - "canonical": true, - "file": "security_center.list_descendant_security_health_analytics_custom_modules.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDescendantSecurityHealthAnalyticsCustomModules", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListDescendantSecurityHealthAnalyticsCustomModules", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "ListDescendantSecurityHealthAnalyticsCustomModules", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListDescendantSecurityHealthAnalyticsCustomModules", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_ListFindings_async", - "title": "SecurityCenter listFindings Sample", - "origin": "API_DEFINITION", - "description": " Lists an organization or source's findings. To list across all sources provide a `-` as the source id. Example: /v1/organizations/{organization_id}/sources/-/findings", - "canonical": true, - "file": "security_center.list_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 183, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFindings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "field_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1.ListFindingsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "ListFindings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListFindings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_ListMuteConfigs_async", - "title": "SecurityCenter listMuteConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists mute configs.", - "canonical": true, - "file": "security_center.list_mute_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMuteConfigs", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListMuteConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.ListMuteConfigsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "ListMuteConfigs", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListMuteConfigs", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_ListNotificationConfigs_async", - "title": "SecurityCenter listNotificationConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists notification configs.", - "canonical": true, - "file": "security_center.list_notification_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNotificationConfigs", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListNotificationConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1.ListNotificationConfigsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "ListNotificationConfigs", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListNotificationConfigs", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_ListEffectiveSecurityHealthAnalyticsCustomModules_async", - "title": "SecurityCenter listEffectiveSecurityHealthAnalyticsCustomModules Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of all EffectiveSecurityHealthAnalyticsCustomModules for the given parent. This includes resident modules defined at the scope of the parent, and inherited modules, inherited from CRM ancestors.", - "canonical": true, - "file": "security_center.list_effective_security_health_analytics_custom_modules.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListEffectiveSecurityHealthAnalyticsCustomModules", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListEffectiveSecurityHealthAnalyticsCustomModules", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "ListEffectiveSecurityHealthAnalyticsCustomModules", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListEffectiveSecurityHealthAnalyticsCustomModules", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_ListSecurityHealthAnalyticsCustomModules_async", - "title": "SecurityCenter listSecurityHealthAnalyticsCustomModules Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of all SecurityHealthAnalyticsCustomModules for the given parent. This includes resident modules defined at the scope of the parent, and inherited modules, inherited from CRM ancestors.", - "canonical": true, - "file": "security_center.list_security_health_analytics_custom_modules.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSecurityHealthAnalyticsCustomModules", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListSecurityHealthAnalyticsCustomModules", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "ListSecurityHealthAnalyticsCustomModules", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListSecurityHealthAnalyticsCustomModules", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_ListSources_async", - "title": "SecurityCenter listSources Sample", - "origin": "API_DEFINITION", - "description": " Lists all sources belonging to an organization.", - "canonical": true, - "file": "security_center.list_sources.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSources", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListSources", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1.ListSourcesResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "ListSources", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListSources", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_async", - "title": "SecurityCenter runAssetDiscovery Sample", - "origin": "API_DEFINITION", - "description": " Runs asset discovery. The discovery is tracked with a long-running operation. This API can only be called with limited frequency for an organization. If it is called too frequently the caller will receive a TOO_MANY_REQUESTS error.", - "canonical": true, - "file": "security_center.run_asset_discovery.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RunAssetDiscovery", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.RunAssetDiscovery", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "RunAssetDiscovery", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.RunAssetDiscovery", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_SetFindingState_async", - "title": "SecurityCenter setFindingState Sample", - "origin": "API_DEFINITION", - "description": " Updates the state of a finding.", - "canonical": true, - "file": "security_center.set_finding_state.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetFindingState", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetFindingState", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "state", - "type": ".google.cloud.securitycenter.v1.Finding.State" - }, - { - "name": "start_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.cloud.securitycenter.v1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "SetFindingState", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetFindingState", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_SetMute_async", - "title": "SecurityCenter setMute Sample", - "origin": "API_DEFINITION", - "description": " Updates the mute state of a finding.", - "canonical": true, - "file": "security_center.set_mute.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetMute", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetMute", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "mute", - "type": ".google.cloud.securitycenter.v1.Finding.Mute" - } - ], - "resultType": ".google.cloud.securitycenter.v1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "SetMute", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetMute", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_SetIamPolicy_async", - "title": "SecurityCenter setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the access control policy on the specified Source.", - "canonical": true, - "file": "security_center.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "policy", - "type": ".google.iam.v1.Policy" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetIamPolicy", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_TestIamPermissions_async", - "title": "SecurityCenter testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Returns the permissions that a caller has on the specified source.", - "canonical": true, - "file": "security_center.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.TestIamPermissions", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateExternalSystem_async", - "title": "SecurityCenter updateExternalSystem Sample", - "origin": "API_DEFINITION", - "description": " Updates external system. This is for a given finding.", - "canonical": true, - "file": "security_center.update_external_system.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateExternalSystem", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateExternalSystem", - "async": true, - "parameters": [ - { - "name": "external_system", - "type": ".google.cloud.securitycenter.v1.ExternalSystem" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1.ExternalSystem", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateExternalSystem", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateExternalSystem", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateFinding_async", - "title": "SecurityCenter updateFinding Sample", - "origin": "API_DEFINITION", - "description": " Creates or updates a finding. The corresponding source must exist for a finding creation to succeed.", - "canonical": true, - "file": "security_center.update_finding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFinding", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateFinding", - "async": true, - "parameters": [ - { - "name": "finding", - "type": ".google.cloud.securitycenter.v1.Finding" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateFinding", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateFinding", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateMuteConfig_async", - "title": "SecurityCenter updateMuteConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates a mute config.", - "canonical": true, - "file": "security_center.update_mute_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateMuteConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateMuteConfig", - "async": true, - "parameters": [ - { - "name": "mute_config", - "type": ".google.cloud.securitycenter.v1.MuteConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1.MuteConfig", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateMuteConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateMuteConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateNotificationConfig_async", - "title": "SecurityCenter updateNotificationConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates a notification config. The following update fields are allowed: description, pubsub_topic, streaming_config.filter", - "canonical": true, - "file": "security_center.update_notification_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateNotificationConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateNotificationConfig", - "async": true, - "parameters": [ - { - "name": "notification_config", - "type": ".google.cloud.securitycenter.v1.NotificationConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1.NotificationConfig", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateNotificationConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateNotificationConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateOrganizationSettings_async", - "title": "SecurityCenter updateOrganizationSettings Sample", - "origin": "API_DEFINITION", - "description": " Updates an organization's settings.", - "canonical": true, - "file": "security_center.update_organization_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateOrganizationSettings", - "async": true, - "parameters": [ - { - "name": "organization_settings", - "type": ".google.cloud.securitycenter.v1.OrganizationSettings" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1.OrganizationSettings", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateOrganizationSettings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateSecurityHealthAnalyticsCustomModule_async", - "title": "SecurityCenter updateSecurityHealthAnalyticsCustomModule Sample", - "origin": "API_DEFINITION", - "description": " Updates the SecurityHealthAnalyticsCustomModule under the given name based on the given update mask. Updating the enablement state is supported on both resident and inherited modules (though resident modules cannot have an enablement state of \"inherited\"). Updating the display name and custom config of a module is supported on resident modules only.", - "canonical": true, - "file": "security_center.update_security_health_analytics_custom_module.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSecurityHealthAnalyticsCustomModule", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSecurityHealthAnalyticsCustomModule", - "async": true, - "parameters": [ - { - "name": "security_health_analytics_custom_module", - "type": ".google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateSecurityHealthAnalyticsCustomModule", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSecurityHealthAnalyticsCustomModule", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateSource_async", - "title": "SecurityCenter updateSource Sample", - "origin": "API_DEFINITION", - "description": " Updates a source.", - "canonical": true, - "file": "security_center.update_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSource", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSource", - "async": true, - "parameters": [ - { - "name": "source", - "type": ".google.cloud.securitycenter.v1.Source" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1.Source", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateSource", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSource", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateSecurityMarks_async", - "title": "SecurityCenter updateSecurityMarks Sample", - "origin": "API_DEFINITION", - "description": " Updates security marks.", - "canonical": true, - "file": "security_center.update_security_marks.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSecurityMarks", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSecurityMarks", - "async": true, - "parameters": [ - { - "name": "security_marks", - "type": ".google.cloud.securitycenter.v1.SecurityMarks" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "start_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.cloud.securitycenter.v1.SecurityMarks", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateSecurityMarks", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSecurityMarks", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_async", - "title": "SecurityCenter createBigQueryExport Sample", - "origin": "API_DEFINITION", - "description": " Creates a BigQuery export.", - "canonical": true, - "file": "security_center.create_big_query_export.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBigQueryExport", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateBigQueryExport", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "big_query_export", - "type": ".google.cloud.securitycenter.v1.BigQueryExport" - }, - { - "name": "big_query_export_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.BigQueryExport", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateBigQueryExport", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateBigQueryExport", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_async", - "title": "SecurityCenter deleteBigQueryExport Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing BigQuery export.", - "canonical": true, - "file": "security_center.delete_big_query_export.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBigQueryExport", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteBigQueryExport", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "DeleteBigQueryExport", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteBigQueryExport", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_async", - "title": "SecurityCenter updateBigQueryExport Sample", - "origin": "API_DEFINITION", - "description": " Updates a BigQuery export.", - "canonical": true, - "file": "security_center.update_big_query_export.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBigQueryExport", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateBigQueryExport", - "async": true, - "parameters": [ - { - "name": "big_query_export", - "type": ".google.cloud.securitycenter.v1.BigQueryExport" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1.BigQueryExport", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateBigQueryExport", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateBigQueryExport", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_async", - "title": "SecurityCenter listBigQueryExports Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "security_center.list_big_query_exports.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBigQueryExports", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListBigQueryExports", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.ListBigQueryExportsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "ListBigQueryExports", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListBigQueryExports", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/src/index.ts b/owl-bot-staging/google-cloud-securitycenter/v1/src/index.ts deleted file mode 100644 index cb56921c366..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1 from './v1'; -const SecurityCenterClient = v1.SecurityCenterClient; -type SecurityCenterClient = v1.SecurityCenterClient; -export {v1, SecurityCenterClient}; -export default {v1, SecurityCenterClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 8abf26ce403..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,507 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.securitycenter.v1", - "libraryPackage": "@google-cloud/security-center", - "services": { - "SecurityCenter": { - "clients": { - "grpc": { - "libraryClient": "SecurityCenterClient", - "rpcs": { - "CreateSecurityHealthAnalyticsCustomModule": { - "methods": [ - "createSecurityHealthAnalyticsCustomModule" - ] - }, - "CreateSource": { - "methods": [ - "createSource" - ] - }, - "CreateFinding": { - "methods": [ - "createFinding" - ] - }, - "CreateMuteConfig": { - "methods": [ - "createMuteConfig" - ] - }, - "CreateNotificationConfig": { - "methods": [ - "createNotificationConfig" - ] - }, - "DeleteMuteConfig": { - "methods": [ - "deleteMuteConfig" - ] - }, - "DeleteNotificationConfig": { - "methods": [ - "deleteNotificationConfig" - ] - }, - "DeleteSecurityHealthAnalyticsCustomModule": { - "methods": [ - "deleteSecurityHealthAnalyticsCustomModule" - ] - }, - "GetBigQueryExport": { - "methods": [ - "getBigQueryExport" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "GetMuteConfig": { - "methods": [ - "getMuteConfig" - ] - }, - "GetNotificationConfig": { - "methods": [ - "getNotificationConfig" - ] - }, - "GetOrganizationSettings": { - "methods": [ - "getOrganizationSettings" - ] - }, - "GetEffectiveSecurityHealthAnalyticsCustomModule": { - "methods": [ - "getEffectiveSecurityHealthAnalyticsCustomModule" - ] - }, - "GetSecurityHealthAnalyticsCustomModule": { - "methods": [ - "getSecurityHealthAnalyticsCustomModule" - ] - }, - "GetSource": { - "methods": [ - "getSource" - ] - }, - "SetFindingState": { - "methods": [ - "setFindingState" - ] - }, - "SetMute": { - "methods": [ - "setMute" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "UpdateExternalSystem": { - "methods": [ - "updateExternalSystem" - ] - }, - "UpdateFinding": { - "methods": [ - "updateFinding" - ] - }, - "UpdateMuteConfig": { - "methods": [ - "updateMuteConfig" - ] - }, - "UpdateNotificationConfig": { - "methods": [ - "updateNotificationConfig" - ] - }, - "UpdateOrganizationSettings": { - "methods": [ - "updateOrganizationSettings" - ] - }, - "UpdateSecurityHealthAnalyticsCustomModule": { - "methods": [ - "updateSecurityHealthAnalyticsCustomModule" - ] - }, - "UpdateSource": { - "methods": [ - "updateSource" - ] - }, - "UpdateSecurityMarks": { - "methods": [ - "updateSecurityMarks" - ] - }, - "CreateBigQueryExport": { - "methods": [ - "createBigQueryExport" - ] - }, - "DeleteBigQueryExport": { - "methods": [ - "deleteBigQueryExport" - ] - }, - "UpdateBigQueryExport": { - "methods": [ - "updateBigQueryExport" - ] - }, - "BulkMuteFindings": { - "methods": [ - "bulkMuteFindings" - ] - }, - "RunAssetDiscovery": { - "methods": [ - "runAssetDiscovery" - ] - }, - "GroupAssets": { - "methods": [ - "groupAssets", - "groupAssetsStream", - "groupAssetsAsync" - ] - }, - "GroupFindings": { - "methods": [ - "groupFindings", - "groupFindingsStream", - "groupFindingsAsync" - ] - }, - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - }, - "ListDescendantSecurityHealthAnalyticsCustomModules": { - "methods": [ - "listDescendantSecurityHealthAnalyticsCustomModules", - "listDescendantSecurityHealthAnalyticsCustomModulesStream", - "listDescendantSecurityHealthAnalyticsCustomModulesAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - }, - "ListMuteConfigs": { - "methods": [ - "listMuteConfigs", - "listMuteConfigsStream", - "listMuteConfigsAsync" - ] - }, - "ListNotificationConfigs": { - "methods": [ - "listNotificationConfigs", - "listNotificationConfigsStream", - "listNotificationConfigsAsync" - ] - }, - "ListEffectiveSecurityHealthAnalyticsCustomModules": { - "methods": [ - "listEffectiveSecurityHealthAnalyticsCustomModules", - "listEffectiveSecurityHealthAnalyticsCustomModulesStream", - "listEffectiveSecurityHealthAnalyticsCustomModulesAsync" - ] - }, - "ListSecurityHealthAnalyticsCustomModules": { - "methods": [ - "listSecurityHealthAnalyticsCustomModules", - "listSecurityHealthAnalyticsCustomModulesStream", - "listSecurityHealthAnalyticsCustomModulesAsync" - ] - }, - "ListSources": { - "methods": [ - "listSources", - "listSourcesStream", - "listSourcesAsync" - ] - }, - "ListBigQueryExports": { - "methods": [ - "listBigQueryExports", - "listBigQueryExportsStream", - "listBigQueryExportsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SecurityCenterClient", - "rpcs": { - "CreateSecurityHealthAnalyticsCustomModule": { - "methods": [ - "createSecurityHealthAnalyticsCustomModule" - ] - }, - "CreateSource": { - "methods": [ - "createSource" - ] - }, - "CreateFinding": { - "methods": [ - "createFinding" - ] - }, - "CreateMuteConfig": { - "methods": [ - "createMuteConfig" - ] - }, - "CreateNotificationConfig": { - "methods": [ - "createNotificationConfig" - ] - }, - "DeleteMuteConfig": { - "methods": [ - "deleteMuteConfig" - ] - }, - "DeleteNotificationConfig": { - "methods": [ - "deleteNotificationConfig" - ] - }, - "DeleteSecurityHealthAnalyticsCustomModule": { - "methods": [ - "deleteSecurityHealthAnalyticsCustomModule" - ] - }, - "GetBigQueryExport": { - "methods": [ - "getBigQueryExport" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "GetMuteConfig": { - "methods": [ - "getMuteConfig" - ] - }, - "GetNotificationConfig": { - "methods": [ - "getNotificationConfig" - ] - }, - "GetOrganizationSettings": { - "methods": [ - "getOrganizationSettings" - ] - }, - "GetEffectiveSecurityHealthAnalyticsCustomModule": { - "methods": [ - "getEffectiveSecurityHealthAnalyticsCustomModule" - ] - }, - "GetSecurityHealthAnalyticsCustomModule": { - "methods": [ - "getSecurityHealthAnalyticsCustomModule" - ] - }, - "GetSource": { - "methods": [ - "getSource" - ] - }, - "SetFindingState": { - "methods": [ - "setFindingState" - ] - }, - "SetMute": { - "methods": [ - "setMute" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "UpdateExternalSystem": { - "methods": [ - "updateExternalSystem" - ] - }, - "UpdateFinding": { - "methods": [ - "updateFinding" - ] - }, - "UpdateMuteConfig": { - "methods": [ - "updateMuteConfig" - ] - }, - "UpdateNotificationConfig": { - "methods": [ - "updateNotificationConfig" - ] - }, - "UpdateOrganizationSettings": { - "methods": [ - "updateOrganizationSettings" - ] - }, - "UpdateSecurityHealthAnalyticsCustomModule": { - "methods": [ - "updateSecurityHealthAnalyticsCustomModule" - ] - }, - "UpdateSource": { - "methods": [ - "updateSource" - ] - }, - "UpdateSecurityMarks": { - "methods": [ - "updateSecurityMarks" - ] - }, - "CreateBigQueryExport": { - "methods": [ - "createBigQueryExport" - ] - }, - "DeleteBigQueryExport": { - "methods": [ - "deleteBigQueryExport" - ] - }, - "UpdateBigQueryExport": { - "methods": [ - "updateBigQueryExport" - ] - }, - "BulkMuteFindings": { - "methods": [ - "bulkMuteFindings" - ] - }, - "RunAssetDiscovery": { - "methods": [ - "runAssetDiscovery" - ] - }, - "GroupAssets": { - "methods": [ - "groupAssets", - "groupAssetsStream", - "groupAssetsAsync" - ] - }, - "GroupFindings": { - "methods": [ - "groupFindings", - "groupFindingsStream", - "groupFindingsAsync" - ] - }, - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - }, - "ListDescendantSecurityHealthAnalyticsCustomModules": { - "methods": [ - "listDescendantSecurityHealthAnalyticsCustomModules", - "listDescendantSecurityHealthAnalyticsCustomModulesStream", - "listDescendantSecurityHealthAnalyticsCustomModulesAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - }, - "ListMuteConfigs": { - "methods": [ - "listMuteConfigs", - "listMuteConfigsStream", - "listMuteConfigsAsync" - ] - }, - "ListNotificationConfigs": { - "methods": [ - "listNotificationConfigs", - "listNotificationConfigsStream", - "listNotificationConfigsAsync" - ] - }, - "ListEffectiveSecurityHealthAnalyticsCustomModules": { - "methods": [ - "listEffectiveSecurityHealthAnalyticsCustomModules", - "listEffectiveSecurityHealthAnalyticsCustomModulesStream", - "listEffectiveSecurityHealthAnalyticsCustomModulesAsync" - ] - }, - "ListSecurityHealthAnalyticsCustomModules": { - "methods": [ - "listSecurityHealthAnalyticsCustomModules", - "listSecurityHealthAnalyticsCustomModulesStream", - "listSecurityHealthAnalyticsCustomModulesAsync" - ] - }, - "ListSources": { - "methods": [ - "listSources", - "listSourcesStream", - "listSourcesAsync" - ] - }, - "ListBigQueryExports": { - "methods": [ - "listBigQueryExports", - "listBigQueryExportsStream", - "listBigQueryExportsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/index.ts deleted file mode 100644 index fa3996e6154..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {SecurityCenterClient} from './security_center_client'; diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_client.ts b/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_client.ts deleted file mode 100644 index 75bea92c5c4..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_client.ts +++ /dev/null @@ -1,8207 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/security_center_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './security_center_client_config.json'; -const version = require('../../../package.json').version; - -/** - * V1 APIs for Security Center service. - * @class - * @memberof v1 - */ -export class SecurityCenterClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - securityCenterStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SecurityCenterClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SecurityCenterClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SecurityCenterClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - folderAssetPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/assets/{asset}' - ), - folderAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/assets/{asset}/securityMarks' - ), - folderExportPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/bigQueryExports/{export}' - ), - folderMuteConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/muteConfigs/{mute_config}' - ), - folderNotificationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationConfigs/{notification_config}' - ), - folderSecurityHealthAnalyticsSettingsCustomModulePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/securityHealthAnalyticsSettings/customModules/{custom_module}' - ), - folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/securityHealthAnalyticsSettings/effectiveCustomModules/{effective_custom_module}' - ), - folderSourcePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sources/{source}' - ), - folderSourceFindingPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sources/{source}/findings/{finding}' - ), - folderSourceFindingExternalsystemPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}' - ), - folderSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sources/{source}/findings/{finding}/securityMarks' - ), - organizationPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}' - ), - organizationAssetPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/assets/{asset}' - ), - organizationAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/assets/{asset}/securityMarks' - ), - organizationExportPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/bigQueryExports/{export}' - ), - organizationMuteConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/muteConfigs/{mute_config}' - ), - organizationNotificationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationConfigs/{notification_config}' - ), - organizationSecurityHealthAnalyticsSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/securityHealthAnalyticsSettings' - ), - organizationSecurityHealthAnalyticsSettingsCustomModulePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/securityHealthAnalyticsSettings/customModules/{custom_module}' - ), - organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/securityHealthAnalyticsSettings/effectiveCustomModules/{effective_custom_module}' - ), - organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/organizationSettings' - ), - organizationSourcePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}' - ), - organizationSourceFindingPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}/findings/{finding}' - ), - organizationSourceFindingExternalsystemPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}' - ), - organizationSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks' - ), - projectAssetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/assets/{asset}' - ), - projectAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/assets/{asset}/securityMarks' - ), - projectExportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/bigQueryExports/{export}' - ), - projectMuteConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/muteConfigs/{mute_config}' - ), - projectNotificationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationConfigs/{notification_config}' - ), - projectSecurityHealthAnalyticsSettingsCustomModulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/securityHealthAnalyticsSettings/customModules/{custom_module}' - ), - projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/securityHealthAnalyticsSettings/effectiveCustomModules/{effective_custom_module}' - ), - projectSourcePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sources/{source}' - ), - projectSourceFindingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sources/{source}/findings/{finding}' - ), - projectSourceFindingExternalsystemPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}' - ), - projectSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sources/{source}/findings/{finding}/securityMarks' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - groupAssets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), - groupFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), - listAssets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listAssetsResults'), - listDescendantSecurityHealthAnalyticsCustomModules: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'securityHealthAnalyticsCustomModules'), - listFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listFindingsResults'), - listMuteConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'muteConfigs'), - listNotificationConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'notificationConfigs'), - listEffectiveSecurityHealthAnalyticsCustomModules: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'effectiveSecurityHealthAnalyticsCustomModules'), - listSecurityHealthAnalyticsCustomModules: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'securityHealthAnalyticsCustomModules'), - listSources: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sources'), - listBigQueryExports: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'bigQueryExports') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=organizations/*/operations/*}:cancel',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=organizations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=organizations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=organizations/*/operations}',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const bulkMuteFindingsResponse = protoFilesRoot.lookup( - '.google.cloud.securitycenter.v1.BulkMuteFindingsResponse') as gax.protobuf.Type; - const bulkMuteFindingsMetadata = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const runAssetDiscoveryResponse = protoFilesRoot.lookup( - '.google.cloud.securitycenter.v1.RunAssetDiscoveryResponse') as gax.protobuf.Type; - const runAssetDiscoveryMetadata = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - - this.descriptors.longrunning = { - bulkMuteFindings: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - bulkMuteFindingsResponse.decode.bind(bulkMuteFindingsResponse), - bulkMuteFindingsMetadata.decode.bind(bulkMuteFindingsMetadata)), - runAssetDiscovery: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - runAssetDiscoveryResponse.decode.bind(runAssetDiscoveryResponse), - runAssetDiscoveryMetadata.decode.bind(runAssetDiscoveryMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.securitycenter.v1.SecurityCenter', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.securityCenterStub) { - return this.securityCenterStub; - } - - // Put together the "service stub" for - // google.cloud.securitycenter.v1.SecurityCenter. - this.securityCenterStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.securitycenter.v1.SecurityCenter') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.securitycenter.v1.SecurityCenter, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const securityCenterStubMethods = - ['bulkMuteFindings', 'createSecurityHealthAnalyticsCustomModule', 'createSource', 'createFinding', 'createMuteConfig', 'createNotificationConfig', 'deleteMuteConfig', 'deleteNotificationConfig', 'deleteSecurityHealthAnalyticsCustomModule', 'getBigQueryExport', 'getIamPolicy', 'getMuteConfig', 'getNotificationConfig', 'getOrganizationSettings', 'getEffectiveSecurityHealthAnalyticsCustomModule', 'getSecurityHealthAnalyticsCustomModule', 'getSource', 'groupAssets', 'groupFindings', 'listAssets', 'listDescendantSecurityHealthAnalyticsCustomModules', 'listFindings', 'listMuteConfigs', 'listNotificationConfigs', 'listEffectiveSecurityHealthAnalyticsCustomModules', 'listSecurityHealthAnalyticsCustomModules', 'listSources', 'runAssetDiscovery', 'setFindingState', 'setMute', 'setIamPolicy', 'testIamPermissions', 'updateExternalSystem', 'updateFinding', 'updateMuteConfig', 'updateNotificationConfig', 'updateOrganizationSettings', 'updateSecurityHealthAnalyticsCustomModule', 'updateSource', 'updateSecurityMarks', 'createBigQueryExport', 'deleteBigQueryExport', 'updateBigQueryExport', 'listBigQueryExports']; - for (const methodName of securityCenterStubMethods) { - const callPromise = this.securityCenterStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.securityCenterStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'securitycenter.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'securitycenter.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a resident SecurityHealthAnalyticsCustomModule at the scope of the - * given CRM parent, and also creates inherited - * SecurityHealthAnalyticsCustomModules for all CRM descendants of the given - * parent. These modules are enabled by default. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new custom module's parent. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings", - * "folders/{folder}/securityHealthAnalyticsSettings", or - * "projects/{project}/securityHealthAnalyticsSettings" - * @param {google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule} request.securityHealthAnalyticsCustomModule - * Required. SecurityHealthAnalytics custom module to create. The provided - * name is ignored and reset with provided parent information and - * server-generated ID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule | SecurityHealthAnalyticsCustomModule}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.create_security_health_analytics_custom_module.js - * region_tag:securitycenter_v1_generated_SecurityCenter_CreateSecurityHealthAnalyticsCustomModule_async - */ - createSecurityHealthAnalyticsCustomModule( - request?: protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined - ]>; - createSecurityHealthAnalyticsCustomModule( - request: protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>): void; - createSecurityHealthAnalyticsCustomModule( - request: protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>): void; - createSecurityHealthAnalyticsCustomModule( - request?: protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.ICreateSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createSecurityHealthAnalyticsCustomModule(request, options, callback); - } -/** - * Creates a source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new source's parent. Its format should be - * "organizations/[organization_id]". - * @param {google.cloud.securitycenter.v1.Source} request.source - * Required. The Source being created, only the display_name and description - * will be used. All other fields will be ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.Source | Source}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.create_source.js - * region_tag:securitycenter_v1_generated_SecurityCenter_CreateSource_async - */ - createSource( - request?: protos.google.cloud.securitycenter.v1.ICreateSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.ICreateSourceRequest|undefined, {}|undefined - ]>; - createSource( - request: protos.google.cloud.securitycenter.v1.ICreateSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.ICreateSourceRequest|null|undefined, - {}|null|undefined>): void; - createSource( - request: protos.google.cloud.securitycenter.v1.ICreateSourceRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.ICreateSourceRequest|null|undefined, - {}|null|undefined>): void; - createSource( - request?: protos.google.cloud.securitycenter.v1.ICreateSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.ICreateSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.ICreateSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.ICreateSourceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createSource(request, options, callback); - } -/** - * Creates a finding. The corresponding source must exist for finding creation - * to succeed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new finding's parent. Its format should be - * "organizations/[organization_id]/sources/[source_id]". - * @param {string} request.findingId - * Required. Unique identifier provided by the client within the parent scope. - * It must be alphanumeric and less than or equal to 32 characters and - * greater than 0 characters in length. - * @param {google.cloud.securitycenter.v1.Finding} request.finding - * Required. The Finding being created. The name and security_marks will be - * ignored as they are both output only fields on this resource. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.Finding | Finding}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.create_finding.js - * region_tag:securitycenter_v1_generated_SecurityCenter_CreateFinding_async - */ - createFinding( - request?: protos.google.cloud.securitycenter.v1.ICreateFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ICreateFindingRequest|undefined, {}|undefined - ]>; - createFinding( - request: protos.google.cloud.securitycenter.v1.ICreateFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ICreateFindingRequest|null|undefined, - {}|null|undefined>): void; - createFinding( - request: protos.google.cloud.securitycenter.v1.ICreateFindingRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ICreateFindingRequest|null|undefined, - {}|null|undefined>): void; - createFinding( - request?: protos.google.cloud.securitycenter.v1.ICreateFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ICreateFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ICreateFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ICreateFindingRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createFinding(request, options, callback); - } -/** - * Creates a mute config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new mute configs's parent. Its format is - * "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - * @param {google.cloud.securitycenter.v1.MuteConfig} request.muteConfig - * Required. The mute config being created. - * @param {string} request.muteConfigId - * 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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.MuteConfig | MuteConfig}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.create_mute_config.js - * region_tag:securitycenter_v1_generated_SecurityCenter_CreateMuteConfig_async - */ - createMuteConfig( - request?: protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|undefined, {}|undefined - ]>; - createMuteConfig( - request: protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|null|undefined, - {}|null|undefined>): void; - createMuteConfig( - request: protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|null|undefined, - {}|null|undefined>): void; - createMuteConfig( - request?: protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createMuteConfig(request, options, callback); - } -/** - * Creates a notification config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new notification config's parent. Its format - * is "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - * @param {string} request.configId - * Required. - * Unique identifier provided by the client within the parent scope. - * It must be between 1 and 128 characters and contain alphanumeric - * characters, underscores, or hyphens only. - * @param {google.cloud.securitycenter.v1.NotificationConfig} request.notificationConfig - * Required. The notification config being created. The name and the service - * account will be ignored as they are both output only fields on this - * resource. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.NotificationConfig | NotificationConfig}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.create_notification_config.js - * region_tag:securitycenter_v1_generated_SecurityCenter_CreateNotificationConfig_async - */ - createNotificationConfig( - request?: protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|undefined, {}|undefined - ]>; - createNotificationConfig( - request: protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - createNotificationConfig( - request: protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - createNotificationConfig( - request?: protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createNotificationConfig(request, options, callback); - } -/** - * Deletes an existing mute config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the mute config to delete. Its format is - * organizations/{organization}/muteConfigs/{config_id}, - * folders/{folder}/muteConfigs/{config_id}, or - * projects/{project}/muteConfigs/{config_id} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.protobuf.Empty | Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.delete_mute_config.js - * region_tag:securitycenter_v1_generated_SecurityCenter_DeleteMuteConfig_async - */ - deleteMuteConfig( - request?: protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|undefined, {}|undefined - ]>; - deleteMuteConfig( - request: protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteMuteConfig( - request: protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteMuteConfig( - request?: protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteMuteConfig(request, options, callback); - } -/** - * Deletes a notification config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the notification config to delete. Its format is - * "organizations/[organization_id]/notificationConfigs/[config_id]", - * "folders/[folder_id]/notificationConfigs/[config_id]", - * or "projects/[project_id]/notificationConfigs/[config_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.protobuf.Empty | Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.delete_notification_config.js - * region_tag:securitycenter_v1_generated_SecurityCenter_DeleteNotificationConfig_async - */ - deleteNotificationConfig( - request?: protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|undefined, {}|undefined - ]>; - deleteNotificationConfig( - request: protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteNotificationConfig( - request: protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteNotificationConfig( - request?: protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteNotificationConfig(request, options, callback); - } -/** - * Deletes the specified SecurityHealthAnalyticsCustomModule and all of its - * descendants in the CRM hierarchy. This method is only supported for - * resident custom modules. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the custom module to delete. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings/customModules/{customModule}", - * "folders/{folder}/securityHealthAnalyticsSettings/customModules/{customModule}", - * or - * "projects/{project}/securityHealthAnalyticsSettings/customModules/{customModule}" - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.protobuf.Empty | Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.delete_security_health_analytics_custom_module.js - * region_tag:securitycenter_v1_generated_SecurityCenter_DeleteSecurityHealthAnalyticsCustomModule_async - */ - deleteSecurityHealthAnalyticsCustomModule( - request?: protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined - ]>; - deleteSecurityHealthAnalyticsCustomModule( - request: protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>): void; - deleteSecurityHealthAnalyticsCustomModule( - request: protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>): void; - deleteSecurityHealthAnalyticsCustomModule( - request?: protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule(request, options, callback); - } -/** - * Gets a BigQuery export. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the BigQuery export to retrieve. Its format is - * organizations/{organization}/bigQueryExports/{export_id}, - * folders/{folder}/bigQueryExports/{export_id}, or - * projects/{project}/bigQueryExports/{export_id} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.BigQueryExport | BigQueryExport}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.get_big_query_export.js - * region_tag:securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_async - */ - getBigQueryExport( - request?: protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|undefined, {}|undefined - ]>; - getBigQueryExport( - request: protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|null|undefined, - {}|null|undefined>): void; - getBigQueryExport( - request: protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|null|undefined, - {}|null|undefined>): void; - getBigQueryExport( - request?: protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getBigQueryExport(request, options, callback); - } -/** - * Gets the access control policy on the specified Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.get_iam_policy.js - * region_tag:securitycenter_v1_generated_SecurityCenter_GetIamPolicy_async - */ - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize(); - return this.innerApiCalls.getIamPolicy(request, options, callback); - } -/** - * Gets a mute config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the mute config to retrieve. Its format is - * organizations/{organization}/muteConfigs/{config_id}, - * folders/{folder}/muteConfigs/{config_id}, or - * projects/{project}/muteConfigs/{config_id} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.MuteConfig | MuteConfig}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.get_mute_config.js - * region_tag:securitycenter_v1_generated_SecurityCenter_GetMuteConfig_async - */ - getMuteConfig( - request?: protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|undefined, {}|undefined - ]>; - getMuteConfig( - request: protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|null|undefined, - {}|null|undefined>): void; - getMuteConfig( - request: protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|null|undefined, - {}|null|undefined>): void; - getMuteConfig( - request?: protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getMuteConfig(request, options, callback); - } -/** - * Gets a notification config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the notification config to get. Its format is - * "organizations/[organization_id]/notificationConfigs/[config_id]", - * "folders/[folder_id]/notificationConfigs/[config_id]", - * or "projects/[project_id]/notificationConfigs/[config_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.NotificationConfig | NotificationConfig}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.get_notification_config.js - * region_tag:securitycenter_v1_generated_SecurityCenter_GetNotificationConfig_async - */ - getNotificationConfig( - request?: protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|undefined, {}|undefined - ]>; - getNotificationConfig( - request: protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - getNotificationConfig( - request: protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - getNotificationConfig( - request?: protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getNotificationConfig(request, options, callback); - } -/** - * Gets the settings for an organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the organization to get organization settings for. Its - * format is "organizations/[organization_id]/organizationSettings". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.OrganizationSettings | OrganizationSettings}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.get_organization_settings.js - * region_tag:securitycenter_v1_generated_SecurityCenter_GetOrganizationSettings_async - */ - getOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|undefined, {}|undefined - ]>; - getOrganizationSettings( - request: protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - getOrganizationSettings( - request: protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - getOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getOrganizationSettings(request, options, callback); - } -/** - * Retrieves an EffectiveSecurityHealthAnalyticsCustomModule. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the effective custom module to get. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}", - * "folders/{folder}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}", - * or - * "projects/{project}/securityHealthAnalyticsSettings/effectiveCustomModules/{customModule}" - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule | EffectiveSecurityHealthAnalyticsCustomModule}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.get_effective_security_health_analytics_custom_module.js - * region_tag:securitycenter_v1_generated_SecurityCenter_GetEffectiveSecurityHealthAnalyticsCustomModule_async - */ - getEffectiveSecurityHealthAnalyticsCustomModule( - request?: protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined - ]>; - getEffectiveSecurityHealthAnalyticsCustomModule( - request: protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>): void; - getEffectiveSecurityHealthAnalyticsCustomModule( - request: protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>): void; - getEffectiveSecurityHealthAnalyticsCustomModule( - request?: protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.IGetEffectiveSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule(request, options, callback); - } -/** - * Retrieves a SecurityHealthAnalyticsCustomModule. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the custom module to get. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings/customModules/{customModule}", - * "folders/{folder}/securityHealthAnalyticsSettings/customModules/{customModule}", - * or - * "projects/{project}/securityHealthAnalyticsSettings/customModules/{customModule}" - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule | SecurityHealthAnalyticsCustomModule}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.get_security_health_analytics_custom_module.js - * region_tag:securitycenter_v1_generated_SecurityCenter_GetSecurityHealthAnalyticsCustomModule_async - */ - getSecurityHealthAnalyticsCustomModule( - request?: protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined - ]>; - getSecurityHealthAnalyticsCustomModule( - request: protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>): void; - getSecurityHealthAnalyticsCustomModule( - request: protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>): void; - getSecurityHealthAnalyticsCustomModule( - request?: protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.IGetSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getSecurityHealthAnalyticsCustomModule(request, options, callback); - } -/** - * Gets a source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Relative resource name of the source. Its format is - * "organizations/[organization_id]/source/[source_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.Source | Source}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.get_source.js - * region_tag:securitycenter_v1_generated_SecurityCenter_GetSource_async - */ - getSource( - request?: protos.google.cloud.securitycenter.v1.IGetSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IGetSourceRequest|undefined, {}|undefined - ]>; - getSource( - request: protos.google.cloud.securitycenter.v1.IGetSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IGetSourceRequest|null|undefined, - {}|null|undefined>): void; - getSource( - request: protos.google.cloud.securitycenter.v1.IGetSourceRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IGetSourceRequest|null|undefined, - {}|null|undefined>): void; - getSource( - request?: protos.google.cloud.securitycenter.v1.IGetSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IGetSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IGetSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IGetSourceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getSource(request, options, callback); - } -/** - * Updates the state of a finding. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The [relative resource - * name](https://cloud.google.com/apis/design/resource_names#relative_resource_name) - * of the finding. Example: - * "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", - * "folders/{folder_id}/sources/{source_id}/findings/{finding_id}", - * "projects/{project_id}/sources/{source_id}/findings/{finding_id}". - * @param {google.cloud.securitycenter.v1.Finding.State} request.state - * Required. The desired State of the finding. - * @param {google.protobuf.Timestamp} request.startTime - * Required. The time at which the updated state takes effect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.Finding | Finding}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.set_finding_state.js - * region_tag:securitycenter_v1_generated_SecurityCenter_SetFindingState_async - */ - setFindingState( - request?: protos.google.cloud.securitycenter.v1.ISetFindingStateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|undefined, {}|undefined - ]>; - setFindingState( - request: protos.google.cloud.securitycenter.v1.ISetFindingStateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>): void; - setFindingState( - request: protos.google.cloud.securitycenter.v1.ISetFindingStateRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>): void; - setFindingState( - request?: protos.google.cloud.securitycenter.v1.ISetFindingStateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.setFindingState(request, options, callback); - } -/** - * Updates the mute state of a finding. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The [relative resource - * name](https://cloud.google.com/apis/design/resource_names#relative_resource_name) - * of the finding. Example: - * "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", - * "folders/{folder_id}/sources/{source_id}/findings/{finding_id}", - * "projects/{project_id}/sources/{source_id}/findings/{finding_id}". - * @param {google.cloud.securitycenter.v1.Finding.Mute} request.mute - * Required. The desired state of the Mute. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.Finding | Finding}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.set_mute.js - * region_tag:securitycenter_v1_generated_SecurityCenter_SetMute_async - */ - setMute( - request?: protos.google.cloud.securitycenter.v1.ISetMuteRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetMuteRequest|undefined, {}|undefined - ]>; - setMute( - request: protos.google.cloud.securitycenter.v1.ISetMuteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetMuteRequest|null|undefined, - {}|null|undefined>): void; - setMute( - request: protos.google.cloud.securitycenter.v1.ISetMuteRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetMuteRequest|null|undefined, - {}|null|undefined>): void; - setMute( - request?: protos.google.cloud.securitycenter.v1.ISetMuteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetMuteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetMuteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetMuteRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.setMute(request, options, callback); - } -/** - * Sets the access control policy on the specified Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.Policy} request.policy - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param {google.protobuf.FieldMask} request.updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.set_iam_policy.js - * region_tag:securitycenter_v1_generated_SecurityCenter_SetIamPolicy_async - */ - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize(); - return this.innerApiCalls.setIamPolicy(request, options, callback); - } -/** - * Returns the permissions that a caller has on the specified source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.test_iam_permissions.js - * region_tag:securitycenter_v1_generated_SecurityCenter_TestIamPermissions_async - */ - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize(); - return this.innerApiCalls.testIamPermissions(request, options, callback); - } -/** - * Updates external system. This is for a given finding. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1.ExternalSystem} request.externalSystem - * Required. The external system resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the external system resource. - * - * If empty all mutable fields will be updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.ExternalSystem | ExternalSystem}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.update_external_system.js - * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateExternalSystem_async - */ - updateExternalSystem( - request?: protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IExternalSystem, - protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|undefined, {}|undefined - ]>; - updateExternalSystem( - request: protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IExternalSystem, - protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|null|undefined, - {}|null|undefined>): void; - updateExternalSystem( - request: protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IExternalSystem, - protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|null|undefined, - {}|null|undefined>): void; - updateExternalSystem( - request?: protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IExternalSystem, - protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IExternalSystem, - protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IExternalSystem, - protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'external_system.name': request.externalSystem!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateExternalSystem(request, options, callback); - } -/** - * Creates or updates a finding. The corresponding source must exist for a - * finding creation to succeed. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1.Finding} request.finding - * Required. The finding resource to update or create if it does not already - * exist. parent, security_marks, and update_time will be ignored. - * - * In the case of creation, the finding id portion of the name must be - * alphanumeric and less than or equal to 32 characters and greater than 0 - * characters in length. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the finding resource. This field should - * not be specified when creating a finding. - * - * When updating a finding, an empty mask is treated as updating all mutable - * fields and replacing source_properties. Individual source_properties can - * be added/updated by using "source_properties." in the field - * mask. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.Finding | Finding}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.update_finding.js - * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateFinding_async - */ - updateFinding( - request?: protos.google.cloud.securitycenter.v1.IUpdateFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|undefined, {}|undefined - ]>; - updateFinding( - request: protos.google.cloud.securitycenter.v1.IUpdateFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>): void; - updateFinding( - request: protos.google.cloud.securitycenter.v1.IUpdateFindingRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>): void; - updateFinding( - request?: protos.google.cloud.securitycenter.v1.IUpdateFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'finding.name': request.finding!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFinding(request, options, callback); - } -/** - * Updates a mute config. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1.MuteConfig} request.muteConfig - * Required. The mute config being updated. - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. - * If empty all mutable fields will be updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.MuteConfig | MuteConfig}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.update_mute_config.js - * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateMuteConfig_async - */ - updateMuteConfig( - request?: protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|undefined, {}|undefined - ]>; - updateMuteConfig( - request: protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|null|undefined, - {}|null|undefined>): void; - updateMuteConfig( - request: protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|null|undefined, - {}|null|undefined>): void; - updateMuteConfig( - request?: protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'mute_config.name': request.muteConfig!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateMuteConfig(request, options, callback); - } -/** - * - * Updates a notification config. The following update - * fields are allowed: description, pubsub_topic, streaming_config.filter - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1.NotificationConfig} request.notificationConfig - * Required. The notification config to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the notification config. - * - * If empty all mutable fields will be updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.NotificationConfig | NotificationConfig}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.update_notification_config.js - * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateNotificationConfig_async - */ - updateNotificationConfig( - request?: protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|undefined, {}|undefined - ]>; - updateNotificationConfig( - request: protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - updateNotificationConfig( - request: protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - updateNotificationConfig( - request?: protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'notification_config.name': request.notificationConfig!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateNotificationConfig(request, options, callback); - } -/** - * Updates an organization's settings. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1.OrganizationSettings} request.organizationSettings - * Required. The organization settings resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the settings resource. - * - * If empty all mutable fields will be updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.OrganizationSettings | OrganizationSettings}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.update_organization_settings.js - * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateOrganizationSettings_async - */ - updateOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|undefined, {}|undefined - ]>; - updateOrganizationSettings( - request: protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateOrganizationSettings( - request: protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'organization_settings.name': request.organizationSettings!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateOrganizationSettings(request, options, callback); - } -/** - * Updates the SecurityHealthAnalyticsCustomModule under the given name based - * on the given update mask. Updating the enablement state is supported on - * both resident and inherited modules (though resident modules cannot have an - * enablement state of "inherited"). Updating the display name and custom - * config of a module is supported on resident modules only. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule} request.securityHealthAnalyticsCustomModule - * Required. The SecurityHealthAnalytics custom module to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to update. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule | SecurityHealthAnalyticsCustomModule}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.update_security_health_analytics_custom_module.js - * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateSecurityHealthAnalyticsCustomModule_async - */ - updateSecurityHealthAnalyticsCustomModule( - request?: protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined - ]>; - updateSecurityHealthAnalyticsCustomModule( - request: protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>): void; - updateSecurityHealthAnalyticsCustomModule( - request: protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>): void; - updateSecurityHealthAnalyticsCustomModule( - request?: protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule, - protos.google.cloud.securitycenter.v1.IUpdateSecurityHealthAnalyticsCustomModuleRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'security_health_analytics_custom_module.name': request.securityHealthAnalyticsCustomModule!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSecurityHealthAnalyticsCustomModule(request, options, callback); - } -/** - * Updates a source. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1.Source} request.source - * Required. The source resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the source resource. - * - * If empty all mutable fields will be updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.Source | Source}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.update_source.js - * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateSource_async - */ - updateSource( - request?: protos.google.cloud.securitycenter.v1.IUpdateSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|undefined, {}|undefined - ]>; - updateSource( - request: protos.google.cloud.securitycenter.v1.IUpdateSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>): void; - updateSource( - request: protos.google.cloud.securitycenter.v1.IUpdateSourceRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>): void; - updateSource( - request?: protos.google.cloud.securitycenter.v1.IUpdateSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'source.name': request.source!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSource(request, options, callback); - } -/** - * Updates security marks. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1.SecurityMarks} request.securityMarks - * Required. The security marks resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the security marks resource. - * - * The field mask must not contain duplicate fields. - * If empty or set to "marks", all marks will be replaced. Individual - * marks can be updated using "marks.". - * @param {google.protobuf.Timestamp} request.startTime - * The time at which the updated SecurityMarks take effect. - * If not set uses current server time. Updates will be applied to the - * SecurityMarks that are active immediately preceding this time. Must be - * earlier or equal to the server time. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.SecurityMarks | SecurityMarks}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.update_security_marks.js - * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateSecurityMarks_async - */ - updateSecurityMarks( - request?: protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ISecurityMarks, - protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|undefined, {}|undefined - ]>; - updateSecurityMarks( - request: protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISecurityMarks, - protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>): void; - updateSecurityMarks( - request: protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISecurityMarks, - protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>): void; - updateSecurityMarks( - request?: protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.ISecurityMarks, - protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.ISecurityMarks, - protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.ISecurityMarks, - protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'security_marks.name': request.securityMarks!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSecurityMarks(request, options, callback); - } -/** - * Creates a BigQuery export. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent resource of the new BigQuery export. Its - * format is "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - * @param {google.cloud.securitycenter.v1.BigQueryExport} request.bigQueryExport - * Required. The BigQuery export being created. - * @param {string} request.bigQueryExportId - * 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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.BigQueryExport | BigQueryExport}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.create_big_query_export.js - * region_tag:securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_async - */ - createBigQueryExport( - request?: protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|undefined, {}|undefined - ]>; - createBigQueryExport( - request: protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|null|undefined, - {}|null|undefined>): void; - createBigQueryExport( - request: protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|null|undefined, - {}|null|undefined>): void; - createBigQueryExport( - request?: protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createBigQueryExport(request, options, callback); - } -/** - * Deletes an existing BigQuery export. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the BigQuery export to delete. Its format is - * organizations/{organization}/bigQueryExports/{export_id}, - * folders/{folder}/bigQueryExports/{export_id}, or - * projects/{project}/bigQueryExports/{export_id} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.protobuf.Empty | Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.delete_big_query_export.js - * region_tag:securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_async - */ - deleteBigQueryExport( - request?: protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|undefined, {}|undefined - ]>; - deleteBigQueryExport( - request: protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|null|undefined, - {}|null|undefined>): void; - deleteBigQueryExport( - request: protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|null|undefined, - {}|null|undefined>): void; - deleteBigQueryExport( - request?: protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteBigQueryExport(request, options, callback); - } -/** - * Updates a BigQuery export. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1.BigQueryExport} request.bigQueryExport - * Required. The BigQuery export being updated. - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. - * If empty all mutable fields will be updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1.BigQueryExport | BigQueryExport}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.update_big_query_export.js - * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_async - */ - updateBigQueryExport( - request?: protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|undefined, {}|undefined - ]>; - updateBigQueryExport( - request: protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|null|undefined, - {}|null|undefined>): void; - updateBigQueryExport( - request: protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|null|undefined, - {}|null|undefined>): void; - updateBigQueryExport( - request?: protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'big_query_export.name': request.bigQueryExport!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateBigQueryExport(request, options, callback); - } - -/** - * Kicks off an LRO to bulk mute findings for a parent based on a filter. The - * parent can be either an organization, folder or project. The findings - * matched by the filter will be muted after the LRO is done. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, at which bulk action needs to be applied. Its format - * is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - * @param {string} request.filter - * Expression that identifies findings that should be updated. - * 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. - * @param {string} request.muteAnnotation - * This can be a mute configuration name or any identifier for mute/unmute - * of findings based on the filter. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/security_center.bulk_mute_findings.js - * region_tag:securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_async - */ - bulkMuteFindings( - request?: protos.google.cloud.securitycenter.v1.IBulkMuteFindingsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - bulkMuteFindings( - request: protos.google.cloud.securitycenter.v1.IBulkMuteFindingsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - bulkMuteFindings( - request: protos.google.cloud.securitycenter.v1.IBulkMuteFindingsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - bulkMuteFindings( - request?: protos.google.cloud.securitycenter.v1.IBulkMuteFindingsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.bulkMuteFindings(request, options, callback); - } -/** - * Check the status of the long running operation returned by `bulkMuteFindings()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/security_center.bulk_mute_findings.js - * region_tag:securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_async - */ - async checkBulkMuteFindingsProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.bulkMuteFindings, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Runs asset discovery. The discovery is tracked with a long-running - * operation. - * - * This API can only be called with limited frequency for an organization. If - * it is called too frequently the caller will receive a TOO_MANY_REQUESTS - * error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to run asset discovery for. Its format - * is "organizations/[organization_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/security_center.run_asset_discovery.js - * region_tag:securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_async - */ - runAssetDiscovery( - request?: protos.google.cloud.securitycenter.v1.IRunAssetDiscoveryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - runAssetDiscovery( - request: protos.google.cloud.securitycenter.v1.IRunAssetDiscoveryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runAssetDiscovery( - request: protos.google.cloud.securitycenter.v1.IRunAssetDiscoveryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runAssetDiscovery( - request?: protos.google.cloud.securitycenter.v1.IRunAssetDiscoveryRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.runAssetDiscovery(request, options, callback); - } -/** - * Check the status of the long running operation returned by `runAssetDiscovery()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/security_center.run_asset_discovery.js - * region_tag:securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_async - */ - async checkRunAssetDiscoveryProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runAssetDiscovery, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Filters an organization's assets and groups them by their specified - * properties. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent to group the assets by. Its format is - * "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * 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 Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping. - * The string value should follow SQL syntax: comma separated list of fields. - * For example: - * "security_center_properties.resource_project,security_center_properties.project". - * - * The following fields are supported when compare_duration is not set: - * - * * security_center_properties.resource_project - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * * security_center_properties.resource_parent_display_name - * - * The following fields are supported when compare_duration is set: - * - * * security_center_properties.resource_type - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_parent_display_name - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" property is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1.GroupResult | GroupResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `groupAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - groupAssets( - request?: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IGroupResult[], - protos.google.cloud.securitycenter.v1.IGroupAssetsRequest|null, - protos.google.cloud.securitycenter.v1.IGroupAssetsResponse - ]>; - groupAssets( - request: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IGroupResult>): void; - groupAssets( - request: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IGroupResult>): void; - groupAssets( - request?: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IGroupResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IGroupResult>): - Promise<[ - protos.google.cloud.securitycenter.v1.IGroupResult[], - protos.google.cloud.securitycenter.v1.IGroupAssetsRequest|null, - protos.google.cloud.securitycenter.v1.IGroupAssetsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.groupAssets(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent to group the assets by. Its format is - * "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * 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 Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping. - * The string value should follow SQL syntax: comma separated list of fields. - * For example: - * "security_center_properties.resource_project,security_center_properties.project". - * - * The following fields are supported when compare_duration is not set: - * - * * security_center_properties.resource_project - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * * security_center_properties.resource_parent_display_name - * - * The following fields are supported when compare_duration is set: - * - * * security_center_properties.resource_type - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_parent_display_name - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" property is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.GroupResult | GroupResult} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `groupAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - groupAssetsStream( - request?: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['groupAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupAssets.createStream( - this.innerApiCalls.groupAssets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `groupAssets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent to group the assets by. Its format is - * "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * 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 Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping. - * The string value should follow SQL syntax: comma separated list of fields. - * For example: - * "security_center_properties.resource_project,security_center_properties.project". - * - * The following fields are supported when compare_duration is not set: - * - * * security_center_properties.resource_project - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * * security_center_properties.resource_parent_display_name - * - * The following fields are supported when compare_duration is set: - * - * * security_center_properties.resource_type - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_parent_display_name - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" property is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1.GroupResult | GroupResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/security_center.group_assets.js - * region_tag:securitycenter_v1_generated_SecurityCenter_GroupAssets_async - */ - groupAssetsAsync( - request?: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['groupAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupAssets.asyncIterate( - this.innerApiCalls['groupAssets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Filters an organization or source's findings and groups them by their - * specified properties. - * - * To group across all sources provide a `-` as the source id. - * Example: /v1/organizations/{organization_id}/sources/-/findings, - * /v1/folders/{folder_id}/sources/-/findings, - * /v1/projects/{project_id}/sources/-/findings - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]", - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]. To groupBy across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - * or projects/{project_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one 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. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * * severity: `=`, `:` - * * workflow_state: `=`, `:` - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * - * * resource: - * * resource.name: `=`, `:` - * * resource.parent_name: `=`, `:` - * * resource.parent_display_name: `=`, `:` - * * resource.project_name: `=`, `:` - * * resource.project_display_name: `=`, `:` - * * resource.type: `=`, `:` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping - * (including `state_change`). The string value should follow SQL syntax: - * comma separated list of fields. For example: "parent,resource_name". - * - * The following fields are supported: - * - * * resource_name - * * category - * * state - * * parent - * * severity - * - * The following fields are supported when compare_duration is set: - * - * * state_change - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" attribute is - * updated to indicate whether the finding had its state changed, the - * finding's state remained unchanged, or if the finding was added during the - * compare_duration period of time that precedes the read_time. This is the - * time between (read_time - compare_duration) and read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present - * at read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {string} request.pageToken - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1.GroupResult | GroupResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `groupFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - groupFindings( - request?: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IGroupResult[], - protos.google.cloud.securitycenter.v1.IGroupFindingsRequest|null, - protos.google.cloud.securitycenter.v1.IGroupFindingsResponse - ]>; - groupFindings( - request: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IGroupResult>): void; - groupFindings( - request: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IGroupResult>): void; - groupFindings( - request?: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IGroupResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IGroupResult>): - Promise<[ - protos.google.cloud.securitycenter.v1.IGroupResult[], - protos.google.cloud.securitycenter.v1.IGroupFindingsRequest|null, - protos.google.cloud.securitycenter.v1.IGroupFindingsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.groupFindings(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]", - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]. To groupBy across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - * or projects/{project_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one 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. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * * severity: `=`, `:` - * * workflow_state: `=`, `:` - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * - * * resource: - * * resource.name: `=`, `:` - * * resource.parent_name: `=`, `:` - * * resource.parent_display_name: `=`, `:` - * * resource.project_name: `=`, `:` - * * resource.project_display_name: `=`, `:` - * * resource.type: `=`, `:` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping - * (including `state_change`). The string value should follow SQL syntax: - * comma separated list of fields. For example: "parent,resource_name". - * - * The following fields are supported: - * - * * resource_name - * * category - * * state - * * parent - * * severity - * - * The following fields are supported when compare_duration is set: - * - * * state_change - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" attribute is - * updated to indicate whether the finding had its state changed, the - * finding's state remained unchanged, or if the finding was added during the - * compare_duration period of time that precedes the read_time. This is the - * time between (read_time - compare_duration) and read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present - * at read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {string} request.pageToken - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.GroupResult | GroupResult} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `groupFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - groupFindingsStream( - request?: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['groupFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupFindings.createStream( - this.innerApiCalls.groupFindings as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `groupFindings`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]", - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]. To groupBy across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - * or projects/{project_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one 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. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * * severity: `=`, `:` - * * workflow_state: `=`, `:` - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * - * * resource: - * * resource.name: `=`, `:` - * * resource.parent_name: `=`, `:` - * * resource.parent_display_name: `=`, `:` - * * resource.project_name: `=`, `:` - * * resource.project_display_name: `=`, `:` - * * resource.type: `=`, `:` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping - * (including `state_change`). The string value should follow SQL syntax: - * comma separated list of fields. For example: "parent,resource_name". - * - * The following fields are supported: - * - * * resource_name - * * category - * * state - * * parent - * * severity - * - * The following fields are supported when compare_duration is set: - * - * * state_change - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" attribute is - * updated to indicate whether the finding had its state changed, the - * finding's state remained unchanged, or if the finding was added during the - * compare_duration period of time that precedes the read_time. This is the - * time between (read_time - compare_duration) and read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present - * at read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {string} request.pageToken - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1.GroupResult | GroupResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/security_center.group_findings.js - * region_tag:securitycenter_v1_generated_SecurityCenter_GroupFindings_async - */ - groupFindingsAsync( - request?: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['groupFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupFindings.asyncIterate( - this.innerApiCalls['groupFindings'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists an organization's assets. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent resource that contains the assets. The - * value that you can specify on parent depends on the method in which you - * specify parent. You can specify one of the following values: - * "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * 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 Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following are the allowed field and operator combinations: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * update_time - * resource_properties - * security_marks.marks - * security_center_properties.resource_name - * security_center_properties.resource_display_name - * security_center_properties.resource_parent - * security_center_properties.resource_parent_display_name - * security_center_properties.resource_project - * security_center_properties.resource_project_display_name - * security_center_properties.resource_type - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListAssetsResult's "state_change" - * attribute is updated to indicate whether the asset was added, removed, or - * remained present during the compare_duration period of time that precedes - * the read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult | ListAssetsResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAssets( - request?: protos.google.cloud.securitycenter.v1.IListAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[], - protos.google.cloud.securitycenter.v1.IListAssetsRequest|null, - protos.google.cloud.securitycenter.v1.IListAssetsResponse - ]>; - listAssets( - request: protos.google.cloud.securitycenter.v1.IListAssetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult>): void; - listAssets( - request: protos.google.cloud.securitycenter.v1.IListAssetsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult>): void; - listAssets( - request?: protos.google.cloud.securitycenter.v1.IListAssetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult>): - Promise<[ - protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[], - protos.google.cloud.securitycenter.v1.IListAssetsRequest|null, - protos.google.cloud.securitycenter.v1.IListAssetsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listAssets(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent resource that contains the assets. The - * value that you can specify on parent depends on the method in which you - * specify parent. You can specify one of the following values: - * "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * 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 Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following are the allowed field and operator combinations: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * update_time - * resource_properties - * security_marks.marks - * security_center_properties.resource_name - * security_center_properties.resource_display_name - * security_center_properties.resource_parent - * security_center_properties.resource_parent_display_name - * security_center_properties.resource_project - * security_center_properties.resource_project_display_name - * security_center_properties.resource_type - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListAssetsResult's "state_change" - * attribute is updated to indicate whether the asset was added, removed, or - * remained present during the compare_duration period of time that precedes - * the read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult | ListAssetsResult} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAssetsStream( - request?: protos.google.cloud.securitycenter.v1.IListAssetsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssets.createStream( - this.innerApiCalls.listAssets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAssets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent resource that contains the assets. The - * value that you can specify on parent depends on the method in which you - * specify parent. You can specify one of the following values: - * "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * 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 Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following are the allowed field and operator combinations: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * update_time - * resource_properties - * security_marks.marks - * security_center_properties.resource_name - * security_center_properties.resource_display_name - * security_center_properties.resource_parent - * security_center_properties.resource_parent_display_name - * security_center_properties.resource_project - * security_center_properties.resource_project_display_name - * security_center_properties.resource_type - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListAssetsResult's "state_change" - * attribute is updated to indicate whether the asset was added, removed, or - * remained present during the compare_duration period of time that precedes - * the read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult | ListAssetsResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/security_center.list_assets.js - * region_tag:securitycenter_v1_generated_SecurityCenter_ListAssets_async - */ - listAssetsAsync( - request?: protos.google.cloud.securitycenter.v1.IListAssetsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssets.asyncIterate( - this.innerApiCalls['listAssets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns a list of all resident SecurityHealthAnalyticsCustomModules under - * the given CRM parent and all of the parent’s CRM descendants. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of parent to list descendant custom modules. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings", - * "folders/{folder}/securityHealthAnalyticsSettings", or - * "projects/{project}/securityHealthAnalyticsSettings" - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {string} request.pageToken - * The value returned by the last call indicating a continuation - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule | SecurityHealthAnalyticsCustomModule}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listDescendantSecurityHealthAnalyticsCustomModulesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listDescendantSecurityHealthAnalyticsCustomModules( - request?: protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[], - protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest|null, - protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesResponse - ]>; - listDescendantSecurityHealthAnalyticsCustomModules( - request: protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, - protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule>): void; - listDescendantSecurityHealthAnalyticsCustomModules( - request: protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, - protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule>): void; - listDescendantSecurityHealthAnalyticsCustomModules( - request?: protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, - protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, - protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule>): - Promise<[ - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[], - protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest|null, - protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of parent to list descendant custom modules. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings", - * "folders/{folder}/securityHealthAnalyticsSettings", or - * "projects/{project}/securityHealthAnalyticsSettings" - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {string} request.pageToken - * The value returned by the last call indicating a continuation - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule | SecurityHealthAnalyticsCustomModule} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listDescendantSecurityHealthAnalyticsCustomModulesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listDescendantSecurityHealthAnalyticsCustomModulesStream( - request?: protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listDescendantSecurityHealthAnalyticsCustomModules']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.createStream( - this.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDescendantSecurityHealthAnalyticsCustomModules`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of parent to list descendant custom modules. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings", - * "folders/{folder}/securityHealthAnalyticsSettings", or - * "projects/{project}/securityHealthAnalyticsSettings" - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {string} request.pageToken - * The value returned by the last call indicating a continuation - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule | SecurityHealthAnalyticsCustomModule}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/security_center.list_descendant_security_health_analytics_custom_modules.js - * region_tag:securitycenter_v1_generated_SecurityCenter_ListDescendantSecurityHealthAnalyticsCustomModules_async - */ - listDescendantSecurityHealthAnalyticsCustomModulesAsync( - request?: protos.google.cloud.securitycenter.v1.IListDescendantSecurityHealthAnalyticsCustomModulesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listDescendantSecurityHealthAnalyticsCustomModules']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.asyncIterate( - this.innerApiCalls['listDescendantSecurityHealthAnalyticsCustomModules'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists an organization or source's findings. - * - * To list across all sources provide a `-` as the source id. - * Example: /v1/organizations/{organization_id}/sources/-/findings - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id], - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]". To list across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - * projects/{projects_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one 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. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * * severity: `=`, `:` - * * workflow_state: `=`, `:` - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * - * * resource: - * * resource.name: `=`, `:` - * * resource.parent_name: `=`, `:` - * * resource.parent_display_name: `=`, `:` - * * resource.project_name: `=`, `:` - * * resource.project_display_name: `=`, `:` - * * resource.type: `=`, `:` - * * resource.folders.resource_folder: `=`, `:` - * * resource.display_name: `=`, `:` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * parent - * state - * category - * resource_name - * event_time - * source_properties - * security_marks.marks - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListFindingsResult's "state_change" - * attribute is updated to indicate whether the finding had its state changed, - * the finding's state remained unchanged, or if the finding was added in any - * state during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult | ListFindingsResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listFindings( - request?: protos.google.cloud.securitycenter.v1.IListFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult[], - protos.google.cloud.securitycenter.v1.IListFindingsRequest|null, - protos.google.cloud.securitycenter.v1.IListFindingsResponse - ]>; - listFindings( - request: protos.google.cloud.securitycenter.v1.IListFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult>): void; - listFindings( - request: protos.google.cloud.securitycenter.v1.IListFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult>): void; - listFindings( - request?: protos.google.cloud.securitycenter.v1.IListFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult>): - Promise<[ - protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult[], - protos.google.cloud.securitycenter.v1.IListFindingsRequest|null, - protos.google.cloud.securitycenter.v1.IListFindingsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listFindings(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id], - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]". To list across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - * projects/{projects_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one 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. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * * severity: `=`, `:` - * * workflow_state: `=`, `:` - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * - * * resource: - * * resource.name: `=`, `:` - * * resource.parent_name: `=`, `:` - * * resource.parent_display_name: `=`, `:` - * * resource.project_name: `=`, `:` - * * resource.project_display_name: `=`, `:` - * * resource.type: `=`, `:` - * * resource.folders.resource_folder: `=`, `:` - * * resource.display_name: `=`, `:` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * parent - * state - * category - * resource_name - * event_time - * source_properties - * security_marks.marks - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListFindingsResult's "state_change" - * attribute is updated to indicate whether the finding had its state changed, - * the finding's state remained unchanged, or if the finding was added in any - * state during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult | ListFindingsResult} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listFindingsStream( - request?: protos.google.cloud.securitycenter.v1.IListFindingsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFindings.createStream( - this.innerApiCalls.listFindings as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFindings`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id], - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]". To list across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - * projects/{projects_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one 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. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * * severity: `=`, `:` - * * workflow_state: `=`, `:` - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * - * * resource: - * * resource.name: `=`, `:` - * * resource.parent_name: `=`, `:` - * * resource.parent_display_name: `=`, `:` - * * resource.project_name: `=`, `:` - * * resource.project_display_name: `=`, `:` - * * resource.type: `=`, `:` - * * resource.folders.resource_folder: `=`, `:` - * * resource.display_name: `=`, `:` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * parent - * state - * category - * resource_name - * event_time - * source_properties - * security_marks.marks - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListFindingsResult's "state_change" - * attribute is updated to indicate whether the finding had its state changed, - * the finding's state remained unchanged, or if the finding was added in any - * state during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult | ListFindingsResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/security_center.list_findings.js - * region_tag:securitycenter_v1_generated_SecurityCenter_ListFindings_async - */ - listFindingsAsync( - request?: protos.google.cloud.securitycenter.v1.IListFindingsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFindings.asyncIterate( - this.innerApiCalls['listFindings'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists mute configs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns the collection of mute configs. Its format - * is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - * @param {number} request.pageSize - * 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. - * @param {string} request.pageToken - * A page token, received from a previous `ListMuteConfigs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListMuteConfigs` must - * match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1.MuteConfig | MuteConfig}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listMuteConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listMuteConfigs( - request?: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IMuteConfig[], - protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest|null, - protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse - ]>; - listMuteConfigs( - request: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IMuteConfig>): void; - listMuteConfigs( - request: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IMuteConfig>): void; - listMuteConfigs( - request?: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IMuteConfig>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IMuteConfig>): - Promise<[ - protos.google.cloud.securitycenter.v1.IMuteConfig[], - protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest|null, - protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listMuteConfigs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns the collection of mute configs. Its format - * is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - * @param {number} request.pageSize - * 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. - * @param {string} request.pageToken - * A page token, received from a previous `ListMuteConfigs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListMuteConfigs` must - * match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.MuteConfig | MuteConfig} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listMuteConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listMuteConfigsStream( - request?: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listMuteConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMuteConfigs.createStream( - this.innerApiCalls.listMuteConfigs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMuteConfigs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns the collection of mute configs. Its format - * is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - * @param {number} request.pageSize - * 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. - * @param {string} request.pageToken - * A page token, received from a previous `ListMuteConfigs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListMuteConfigs` must - * match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1.MuteConfig | MuteConfig}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/security_center.list_mute_configs.js - * region_tag:securitycenter_v1_generated_SecurityCenter_ListMuteConfigs_async - */ - listMuteConfigsAsync( - request?: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listMuteConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMuteConfigs.asyncIterate( - this.innerApiCalls['listMuteConfigs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists notification configs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent in which to list the notification - * configurations. Its format is "organizations/[organization_id]", - * "folders/[folder_id]", or "projects/[project_id]". - * @param {string} request.pageToken - * The value returned by the last `ListNotificationConfigsResponse`; indicates - * that this is a continuation of a prior `ListNotificationConfigs` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1.NotificationConfig | NotificationConfig}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listNotificationConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listNotificationConfigs( - request?: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.INotificationConfig[], - protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest|null, - protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse - ]>; - listNotificationConfigs( - request: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.INotificationConfig>): void; - listNotificationConfigs( - request: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.INotificationConfig>): void; - listNotificationConfigs( - request?: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.INotificationConfig>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.INotificationConfig>): - Promise<[ - protos.google.cloud.securitycenter.v1.INotificationConfig[], - protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest|null, - protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listNotificationConfigs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent in which to list the notification - * configurations. Its format is "organizations/[organization_id]", - * "folders/[folder_id]", or "projects/[project_id]". - * @param {string} request.pageToken - * The value returned by the last `ListNotificationConfigsResponse`; indicates - * that this is a continuation of a prior `ListNotificationConfigs` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.NotificationConfig | NotificationConfig} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listNotificationConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listNotificationConfigsStream( - request?: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listNotificationConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNotificationConfigs.createStream( - this.innerApiCalls.listNotificationConfigs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listNotificationConfigs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the parent in which to list the notification - * configurations. Its format is "organizations/[organization_id]", - * "folders/[folder_id]", or "projects/[project_id]". - * @param {string} request.pageToken - * The value returned by the last `ListNotificationConfigsResponse`; indicates - * that this is a continuation of a prior `ListNotificationConfigs` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1.NotificationConfig | NotificationConfig}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/security_center.list_notification_configs.js - * region_tag:securitycenter_v1_generated_SecurityCenter_ListNotificationConfigs_async - */ - listNotificationConfigsAsync( - request?: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listNotificationConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNotificationConfigs.asyncIterate( - this.innerApiCalls['listNotificationConfigs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns a list of all EffectiveSecurityHealthAnalyticsCustomModules for the - * given parent. This includes resident modules defined at the scope of the - * parent, and inherited modules, inherited from CRM ancestors. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of parent to list effective custom modules. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings", - * "folders/{folder}/securityHealthAnalyticsSettings", or - * "projects/{project}/securityHealthAnalyticsSettings" - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {string} request.pageToken - * The value returned by the last call indicating a continuation - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule | EffectiveSecurityHealthAnalyticsCustomModule}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listEffectiveSecurityHealthAnalyticsCustomModulesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listEffectiveSecurityHealthAnalyticsCustomModules( - request?: protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule[], - protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest|null, - protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesResponse - ]>; - listEffectiveSecurityHealthAnalyticsCustomModules( - request: protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, - protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule>): void; - listEffectiveSecurityHealthAnalyticsCustomModules( - request: protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, - protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule>): void; - listEffectiveSecurityHealthAnalyticsCustomModules( - request?: protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, - protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, - protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule>): - Promise<[ - protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule[], - protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest|null, - protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of parent to list effective custom modules. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings", - * "folders/{folder}/securityHealthAnalyticsSettings", or - * "projects/{project}/securityHealthAnalyticsSettings" - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {string} request.pageToken - * The value returned by the last call indicating a continuation - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule | EffectiveSecurityHealthAnalyticsCustomModule} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listEffectiveSecurityHealthAnalyticsCustomModulesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listEffectiveSecurityHealthAnalyticsCustomModulesStream( - request?: protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listEffectiveSecurityHealthAnalyticsCustomModules']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.createStream( - this.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listEffectiveSecurityHealthAnalyticsCustomModules`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of parent to list effective custom modules. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings", - * "folders/{folder}/securityHealthAnalyticsSettings", or - * "projects/{project}/securityHealthAnalyticsSettings" - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {string} request.pageToken - * The value returned by the last call indicating a continuation - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule | EffectiveSecurityHealthAnalyticsCustomModule}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/security_center.list_effective_security_health_analytics_custom_modules.js - * region_tag:securitycenter_v1_generated_SecurityCenter_ListEffectiveSecurityHealthAnalyticsCustomModules_async - */ - listEffectiveSecurityHealthAnalyticsCustomModulesAsync( - request?: protos.google.cloud.securitycenter.v1.IListEffectiveSecurityHealthAnalyticsCustomModulesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listEffectiveSecurityHealthAnalyticsCustomModules']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.asyncIterate( - this.innerApiCalls['listEffectiveSecurityHealthAnalyticsCustomModules'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns a list of all SecurityHealthAnalyticsCustomModules for the given - * parent. This includes resident modules defined at the scope of the parent, - * and inherited modules, inherited from CRM ancestors. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of parent to list custom modules. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings", - * "folders/{folder}/securityHealthAnalyticsSettings", or - * "projects/{project}/securityHealthAnalyticsSettings" - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {string} request.pageToken - * The value returned by the last call indicating a continuation - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule | SecurityHealthAnalyticsCustomModule}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSecurityHealthAnalyticsCustomModulesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listSecurityHealthAnalyticsCustomModules( - request?: protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[], - protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest|null, - protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesResponse - ]>; - listSecurityHealthAnalyticsCustomModules( - request: protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, - protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule>): void; - listSecurityHealthAnalyticsCustomModules( - request: protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, - protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule>): void; - listSecurityHealthAnalyticsCustomModules( - request?: protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, - protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, - protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule>): - Promise<[ - protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[], - protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest|null, - protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listSecurityHealthAnalyticsCustomModules(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of parent to list custom modules. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings", - * "folders/{folder}/securityHealthAnalyticsSettings", or - * "projects/{project}/securityHealthAnalyticsSettings" - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {string} request.pageToken - * The value returned by the last call indicating a continuation - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule | SecurityHealthAnalyticsCustomModule} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSecurityHealthAnalyticsCustomModulesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listSecurityHealthAnalyticsCustomModulesStream( - request?: protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSecurityHealthAnalyticsCustomModules']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSecurityHealthAnalyticsCustomModules.createStream( - this.innerApiCalls.listSecurityHealthAnalyticsCustomModules as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSecurityHealthAnalyticsCustomModules`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of parent to list custom modules. Its format is - * "organizations/{organization}/securityHealthAnalyticsSettings", - * "folders/{folder}/securityHealthAnalyticsSettings", or - * "projects/{project}/securityHealthAnalyticsSettings" - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {string} request.pageToken - * The value returned by the last call indicating a continuation - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule | SecurityHealthAnalyticsCustomModule}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/security_center.list_security_health_analytics_custom_modules.js - * region_tag:securitycenter_v1_generated_SecurityCenter_ListSecurityHealthAnalyticsCustomModules_async - */ - listSecurityHealthAnalyticsCustomModulesAsync( - request?: protos.google.cloud.securitycenter.v1.IListSecurityHealthAnalyticsCustomModulesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSecurityHealthAnalyticsCustomModules']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSecurityHealthAnalyticsCustomModules.asyncIterate( - this.innerApiCalls['listSecurityHealthAnalyticsCustomModules'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all sources belonging to an organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent of sources to list. Its format should - * be "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - * @param {string} request.pageToken - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1.Source | Source}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSourcesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listSources( - request?: protos.google.cloud.securitycenter.v1.IListSourcesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ISource[], - protos.google.cloud.securitycenter.v1.IListSourcesRequest|null, - protos.google.cloud.securitycenter.v1.IListSourcesResponse - ]>; - listSources( - request: protos.google.cloud.securitycenter.v1.IListSourcesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ISource>): void; - listSources( - request: protos.google.cloud.securitycenter.v1.IListSourcesRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ISource>): void; - listSources( - request?: protos.google.cloud.securitycenter.v1.IListSourcesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ISource>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ISource>): - Promise<[ - protos.google.cloud.securitycenter.v1.ISource[], - protos.google.cloud.securitycenter.v1.IListSourcesRequest|null, - protos.google.cloud.securitycenter.v1.IListSourcesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listSources(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent of sources to list. Its format should - * be "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - * @param {string} request.pageToken - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.Source | Source} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSourcesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listSourcesStream( - request?: protos.google.cloud.securitycenter.v1.IListSourcesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSources.createStream( - this.innerApiCalls.listSources as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSources`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent of sources to list. Its format should - * be "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - * @param {string} request.pageToken - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1.Source | Source}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/security_center.list_sources.js - * region_tag:securitycenter_v1_generated_SecurityCenter_ListSources_async - */ - listSourcesAsync( - request?: protos.google.cloud.securitycenter.v1.IListSourcesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSources.asyncIterate( - this.innerApiCalls['listSources'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * 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. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns the collection of BigQuery exports. Its - * format is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - * @param {number} request.pageSize - * 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. - * @param {string} request.pageToken - * 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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1.BigQueryExport | BigQueryExport}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBigQueryExportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listBigQueryExports( - request?: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IBigQueryExport[], - protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest|null, - protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse - ]>; - listBigQueryExports( - request: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IBigQueryExport>): void; - listBigQueryExports( - request: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IBigQueryExport>): void; - listBigQueryExports( - request?: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IBigQueryExport>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IBigQueryExport>): - Promise<[ - protos.google.cloud.securitycenter.v1.IBigQueryExport[], - protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest|null, - protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listBigQueryExports(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns the collection of BigQuery exports. Its - * format is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - * @param {number} request.pageSize - * 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. - * @param {string} request.pageToken - * 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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1.BigQueryExport | BigQueryExport} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listBigQueryExportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listBigQueryExportsStream( - request?: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBigQueryExports']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBigQueryExports.createStream( - this.innerApiCalls.listBigQueryExports as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBigQueryExports`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns the collection of BigQuery exports. Its - * format is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - * @param {number} request.pageSize - * 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. - * @param {string} request.pageToken - * 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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1.BigQueryExport | BigQueryExport}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/security_center.list_big_query_exports.js - * region_tag:securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_async - */ - listBigQueryExportsAsync( - request?: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBigQueryExports']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBigQueryExports.asyncIterate( - this.innerApiCalls['listBigQueryExports'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderAsset resource name string. - * - * @param {string} folder - * @param {string} asset - * @returns {string} Resource name string. - */ - folderAssetPath(folder:string,asset:string) { - return this.pathTemplates.folderAssetPathTemplate.render({ - folder: folder, - asset: asset, - }); - } - - /** - * Parse the folder from FolderAsset resource. - * - * @param {string} folderAssetName - * A fully-qualified path representing folder_asset resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAssetName(folderAssetName: string) { - return this.pathTemplates.folderAssetPathTemplate.match(folderAssetName).folder; - } - - /** - * Parse the asset from FolderAsset resource. - * - * @param {string} folderAssetName - * A fully-qualified path representing folder_asset resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromFolderAssetName(folderAssetName: string) { - return this.pathTemplates.folderAssetPathTemplate.match(folderAssetName).asset; - } - - /** - * Return a fully-qualified folderAssetSecurityMarks resource name string. - * - * @param {string} folder - * @param {string} asset - * @returns {string} Resource name string. - */ - folderAssetSecurityMarksPath(folder:string,asset:string) { - return this.pathTemplates.folderAssetSecurityMarksPathTemplate.render({ - folder: folder, - asset: asset, - }); - } - - /** - * Parse the folder from FolderAssetSecurityMarks resource. - * - * @param {string} folderAssetSecurityMarksName - * A fully-qualified path representing folder_asset_securityMarks resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAssetSecurityMarksName(folderAssetSecurityMarksName: string) { - return this.pathTemplates.folderAssetSecurityMarksPathTemplate.match(folderAssetSecurityMarksName).folder; - } - - /** - * Parse the asset from FolderAssetSecurityMarks resource. - * - * @param {string} folderAssetSecurityMarksName - * A fully-qualified path representing folder_asset_securityMarks resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromFolderAssetSecurityMarksName(folderAssetSecurityMarksName: string) { - return this.pathTemplates.folderAssetSecurityMarksPathTemplate.match(folderAssetSecurityMarksName).asset; - } - - /** - * Return a fully-qualified folderExport resource name string. - * - * @param {string} folder - * @param {string} exportParam - * @returns {string} Resource name string. - */ - folderExportPath(folder:string,exportParam:string) { - return this.pathTemplates.folderExportPathTemplate.render({ - folder: folder, - export: exportParam, - }); - } - - /** - * Parse the folder from FolderExport resource. - * - * @param {string} folderExportName - * A fully-qualified path representing folder_export resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderExportName(folderExportName: string) { - return this.pathTemplates.folderExportPathTemplate.match(folderExportName).folder; - } - - /** - * Parse the export from FolderExport resource. - * - * @param {string} folderExportName - * A fully-qualified path representing folder_export resource. - * @returns {string} A string representing the export. - */ - matchExportFromFolderExportName(folderExportName: string) { - return this.pathTemplates.folderExportPathTemplate.match(folderExportName).export; - } - - /** - * Return a fully-qualified folderMuteConfig resource name string. - * - * @param {string} folder - * @param {string} mute_config - * @returns {string} Resource name string. - */ - folderMuteConfigPath(folder:string,muteConfig:string) { - return this.pathTemplates.folderMuteConfigPathTemplate.render({ - folder: folder, - mute_config: muteConfig, - }); - } - - /** - * Parse the folder from FolderMuteConfig resource. - * - * @param {string} folderMuteConfigName - * A fully-qualified path representing folder_mute_config resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderMuteConfigName(folderMuteConfigName: string) { - return this.pathTemplates.folderMuteConfigPathTemplate.match(folderMuteConfigName).folder; - } - - /** - * Parse the mute_config from FolderMuteConfig resource. - * - * @param {string} folderMuteConfigName - * A fully-qualified path representing folder_mute_config resource. - * @returns {string} A string representing the mute_config. - */ - matchMuteConfigFromFolderMuteConfigName(folderMuteConfigName: string) { - return this.pathTemplates.folderMuteConfigPathTemplate.match(folderMuteConfigName).mute_config; - } - - /** - * Return a fully-qualified folderNotificationConfig resource name string. - * - * @param {string} folder - * @param {string} notification_config - * @returns {string} Resource name string. - */ - folderNotificationConfigPath(folder:string,notificationConfig:string) { - return this.pathTemplates.folderNotificationConfigPathTemplate.render({ - folder: folder, - notification_config: notificationConfig, - }); - } - - /** - * Parse the folder from FolderNotificationConfig resource. - * - * @param {string} folderNotificationConfigName - * A fully-qualified path representing folder_notification_config resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderNotificationConfigName(folderNotificationConfigName: string) { - return this.pathTemplates.folderNotificationConfigPathTemplate.match(folderNotificationConfigName).folder; - } - - /** - * Parse the notification_config from FolderNotificationConfig resource. - * - * @param {string} folderNotificationConfigName - * A fully-qualified path representing folder_notification_config resource. - * @returns {string} A string representing the notification_config. - */ - matchNotificationConfigFromFolderNotificationConfigName(folderNotificationConfigName: string) { - return this.pathTemplates.folderNotificationConfigPathTemplate.match(folderNotificationConfigName).notification_config; - } - - /** - * Return a fully-qualified folderSecurityHealthAnalyticsSettingsCustomModule resource name string. - * - * @param {string} folder - * @param {string} custom_module - * @returns {string} Resource name string. - */ - folderSecurityHealthAnalyticsSettingsCustomModulePath(folder:string,customModule:string) { - return this.pathTemplates.folderSecurityHealthAnalyticsSettingsCustomModulePathTemplate.render({ - folder: folder, - custom_module: customModule, - }); - } - - /** - * Parse the folder from FolderSecurityHealthAnalyticsSettingsCustomModule resource. - * - * @param {string} folderSecurityHealthAnalyticsSettingsCustomModuleName - * A fully-qualified path representing folder_securityHealthAnalyticsSettings_custom_module resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSecurityHealthAnalyticsSettingsCustomModuleName(folderSecurityHealthAnalyticsSettingsCustomModuleName: string) { - return this.pathTemplates.folderSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match(folderSecurityHealthAnalyticsSettingsCustomModuleName).folder; - } - - /** - * Parse the custom_module from FolderSecurityHealthAnalyticsSettingsCustomModule resource. - * - * @param {string} folderSecurityHealthAnalyticsSettingsCustomModuleName - * A fully-qualified path representing folder_securityHealthAnalyticsSettings_custom_module resource. - * @returns {string} A string representing the custom_module. - */ - matchCustomModuleFromFolderSecurityHealthAnalyticsSettingsCustomModuleName(folderSecurityHealthAnalyticsSettingsCustomModuleName: string) { - return this.pathTemplates.folderSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match(folderSecurityHealthAnalyticsSettingsCustomModuleName).custom_module; - } - - /** - * Return a fully-qualified folderSecurityHealthAnalyticsSettingsEffectiveCustomModule resource name string. - * - * @param {string} folder - * @param {string} effective_custom_module - * @returns {string} Resource name string. - */ - folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePath(folder:string,effectiveCustomModule:string) { - return this.pathTemplates.folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.render({ - folder: folder, - effective_custom_module: effectiveCustomModule, - }); - } - - /** - * Parse the folder from FolderSecurityHealthAnalyticsSettingsEffectiveCustomModule resource. - * - * @param {string} folderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName - * A fully-qualified path representing folder_securityHealthAnalyticsSettings_effective_custom_module resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(folderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName: string) { - return this.pathTemplates.folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match(folderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName).folder; - } - - /** - * Parse the effective_custom_module from FolderSecurityHealthAnalyticsSettingsEffectiveCustomModule resource. - * - * @param {string} folderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName - * A fully-qualified path representing folder_securityHealthAnalyticsSettings_effective_custom_module resource. - * @returns {string} A string representing the effective_custom_module. - */ - matchEffectiveCustomModuleFromFolderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(folderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName: string) { - return this.pathTemplates.folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match(folderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName).effective_custom_module; - } - - /** - * Return a fully-qualified folderSource resource name string. - * - * @param {string} folder - * @param {string} source - * @returns {string} Resource name string. - */ - folderSourcePath(folder:string,source:string) { - return this.pathTemplates.folderSourcePathTemplate.render({ - folder: folder, - source: source, - }); - } - - /** - * Parse the folder from FolderSource resource. - * - * @param {string} folderSourceName - * A fully-qualified path representing folder_source resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSourceName(folderSourceName: string) { - return this.pathTemplates.folderSourcePathTemplate.match(folderSourceName).folder; - } - - /** - * Parse the source from FolderSource resource. - * - * @param {string} folderSourceName - * A fully-qualified path representing folder_source resource. - * @returns {string} A string representing the source. - */ - matchSourceFromFolderSourceName(folderSourceName: string) { - return this.pathTemplates.folderSourcePathTemplate.match(folderSourceName).source; - } - - /** - * Return a fully-qualified folderSourceFinding resource name string. - * - * @param {string} folder - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - folderSourceFindingPath(folder:string,source:string,finding:string) { - return this.pathTemplates.folderSourceFindingPathTemplate.render({ - folder: folder, - source: source, - finding: finding, - }); - } - - /** - * Parse the folder from FolderSourceFinding resource. - * - * @param {string} folderSourceFindingName - * A fully-qualified path representing folder_source_finding resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSourceFindingName(folderSourceFindingName: string) { - return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).folder; - } - - /** - * Parse the source from FolderSourceFinding resource. - * - * @param {string} folderSourceFindingName - * A fully-qualified path representing folder_source_finding resource. - * @returns {string} A string representing the source. - */ - matchSourceFromFolderSourceFindingName(folderSourceFindingName: string) { - return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).source; - } - - /** - * Parse the finding from FolderSourceFinding resource. - * - * @param {string} folderSourceFindingName - * A fully-qualified path representing folder_source_finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromFolderSourceFindingName(folderSourceFindingName: string) { - return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).finding; - } - - /** - * Return a fully-qualified folderSourceFindingExternalsystem resource name string. - * - * @param {string} folder - * @param {string} source - * @param {string} finding - * @param {string} externalsystem - * @returns {string} Resource name string. - */ - folderSourceFindingExternalsystemPath(folder:string,source:string,finding:string,externalsystem:string) { - return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.render({ - folder: folder, - source: source, - finding: finding, - externalsystem: externalsystem, - }); - } - - /** - * Parse the folder from FolderSourceFindingExternalsystem resource. - * - * @param {string} folderSourceFindingExternalsystemName - * A fully-qualified path representing folder_source_finding_externalsystem resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSourceFindingExternalsystemName(folderSourceFindingExternalsystemName: string) { - return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match(folderSourceFindingExternalsystemName).folder; - } - - /** - * Parse the source from FolderSourceFindingExternalsystem resource. - * - * @param {string} folderSourceFindingExternalsystemName - * A fully-qualified path representing folder_source_finding_externalsystem resource. - * @returns {string} A string representing the source. - */ - matchSourceFromFolderSourceFindingExternalsystemName(folderSourceFindingExternalsystemName: string) { - return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match(folderSourceFindingExternalsystemName).source; - } - - /** - * Parse the finding from FolderSourceFindingExternalsystem resource. - * - * @param {string} folderSourceFindingExternalsystemName - * A fully-qualified path representing folder_source_finding_externalsystem resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromFolderSourceFindingExternalsystemName(folderSourceFindingExternalsystemName: string) { - return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match(folderSourceFindingExternalsystemName).finding; - } - - /** - * Parse the externalsystem from FolderSourceFindingExternalsystem resource. - * - * @param {string} folderSourceFindingExternalsystemName - * A fully-qualified path representing folder_source_finding_externalsystem resource. - * @returns {string} A string representing the externalsystem. - */ - matchExternalsystemFromFolderSourceFindingExternalsystemName(folderSourceFindingExternalsystemName: string) { - return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match(folderSourceFindingExternalsystemName).externalsystem; - } - - /** - * Return a fully-qualified folderSourceFindingSecurityMarks resource name string. - * - * @param {string} folder - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - folderSourceFindingSecurityMarksPath(folder:string,source:string,finding:string) { - return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render({ - folder: folder, - source: source, - finding: finding, - }); - } - - /** - * Parse the folder from FolderSourceFindingSecurityMarks resource. - * - * @param {string} folderSourceFindingSecurityMarksName - * A fully-qualified path representing folder_source_finding_securityMarks resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { - return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).folder; - } - - /** - * Parse the source from FolderSourceFindingSecurityMarks resource. - * - * @param {string} folderSourceFindingSecurityMarksName - * A fully-qualified path representing folder_source_finding_securityMarks resource. - * @returns {string} A string representing the source. - */ - matchSourceFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { - return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).source; - } - - /** - * Parse the finding from FolderSourceFindingSecurityMarks resource. - * - * @param {string} folderSourceFindingSecurityMarksName - * A fully-qualified path representing folder_source_finding_securityMarks resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { - return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).finding; - } - - /** - * Return a fully-qualified organization resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationPath(organization:string) { - return this.pathTemplates.organizationPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from Organization resource. - * - * @param {string} organizationName - * A fully-qualified path representing Organization resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationName(organizationName: string) { - return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; - } - - /** - * Return a fully-qualified organizationAsset resource name string. - * - * @param {string} organization - * @param {string} asset - * @returns {string} Resource name string. - */ - organizationAssetPath(organization:string,asset:string) { - return this.pathTemplates.organizationAssetPathTemplate.render({ - organization: organization, - asset: asset, - }); - } - - /** - * Parse the organization from OrganizationAsset resource. - * - * @param {string} organizationAssetName - * A fully-qualified path representing organization_asset resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAssetName(organizationAssetName: string) { - return this.pathTemplates.organizationAssetPathTemplate.match(organizationAssetName).organization; - } - - /** - * Parse the asset from OrganizationAsset resource. - * - * @param {string} organizationAssetName - * A fully-qualified path representing organization_asset resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromOrganizationAssetName(organizationAssetName: string) { - return this.pathTemplates.organizationAssetPathTemplate.match(organizationAssetName).asset; - } - - /** - * Return a fully-qualified organizationAssetSecurityMarks resource name string. - * - * @param {string} organization - * @param {string} asset - * @returns {string} Resource name string. - */ - organizationAssetSecurityMarksPath(organization:string,asset:string) { - return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.render({ - organization: organization, - asset: asset, - }); - } - - /** - * Parse the organization from OrganizationAssetSecurityMarks resource. - * - * @param {string} organizationAssetSecurityMarksName - * A fully-qualified path representing organization_asset_securityMarks resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { - return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).organization; - } - - /** - * Parse the asset from OrganizationAssetSecurityMarks resource. - * - * @param {string} organizationAssetSecurityMarksName - * A fully-qualified path representing organization_asset_securityMarks resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { - return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).asset; - } - - /** - * Return a fully-qualified organizationExport resource name string. - * - * @param {string} organization - * @param {string} exportParam - * @returns {string} Resource name string. - */ - organizationExportPath(organization:string,exportParam:string) { - return this.pathTemplates.organizationExportPathTemplate.render({ - organization: organization, - export: exportParam, - }); - } - - /** - * Parse the organization from OrganizationExport resource. - * - * @param {string} organizationExportName - * A fully-qualified path representing organization_export resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationExportName(organizationExportName: string) { - return this.pathTemplates.organizationExportPathTemplate.match(organizationExportName).organization; - } - - /** - * Parse the export from OrganizationExport resource. - * - * @param {string} organizationExportName - * A fully-qualified path representing organization_export resource. - * @returns {string} A string representing the export. - */ - matchExportFromOrganizationExportName(organizationExportName: string) { - return this.pathTemplates.organizationExportPathTemplate.match(organizationExportName).export; - } - - /** - * Return a fully-qualified organizationMuteConfig resource name string. - * - * @param {string} organization - * @param {string} mute_config - * @returns {string} Resource name string. - */ - organizationMuteConfigPath(organization:string,muteConfig:string) { - return this.pathTemplates.organizationMuteConfigPathTemplate.render({ - organization: organization, - mute_config: muteConfig, - }); - } - - /** - * Parse the organization from OrganizationMuteConfig resource. - * - * @param {string} organizationMuteConfigName - * A fully-qualified path representing organization_mute_config resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationMuteConfigName(organizationMuteConfigName: string) { - return this.pathTemplates.organizationMuteConfigPathTemplate.match(organizationMuteConfigName).organization; - } - - /** - * Parse the mute_config from OrganizationMuteConfig resource. - * - * @param {string} organizationMuteConfigName - * A fully-qualified path representing organization_mute_config resource. - * @returns {string} A string representing the mute_config. - */ - matchMuteConfigFromOrganizationMuteConfigName(organizationMuteConfigName: string) { - return this.pathTemplates.organizationMuteConfigPathTemplate.match(organizationMuteConfigName).mute_config; - } - - /** - * Return a fully-qualified organizationNotificationConfig resource name string. - * - * @param {string} organization - * @param {string} notification_config - * @returns {string} Resource name string. - */ - organizationNotificationConfigPath(organization:string,notificationConfig:string) { - return this.pathTemplates.organizationNotificationConfigPathTemplate.render({ - organization: organization, - notification_config: notificationConfig, - }); - } - - /** - * Parse the organization from OrganizationNotificationConfig resource. - * - * @param {string} organizationNotificationConfigName - * A fully-qualified path representing organization_notification_config resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationNotificationConfigName(organizationNotificationConfigName: string) { - return this.pathTemplates.organizationNotificationConfigPathTemplate.match(organizationNotificationConfigName).organization; - } - - /** - * Parse the notification_config from OrganizationNotificationConfig resource. - * - * @param {string} organizationNotificationConfigName - * A fully-qualified path representing organization_notification_config resource. - * @returns {string} A string representing the notification_config. - */ - matchNotificationConfigFromOrganizationNotificationConfigName(organizationNotificationConfigName: string) { - return this.pathTemplates.organizationNotificationConfigPathTemplate.match(organizationNotificationConfigName).notification_config; - } - - /** - * Return a fully-qualified organizationSecurityHealthAnalyticsSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSecurityHealthAnalyticsSettingsPath(organization:string) { - return this.pathTemplates.organizationSecurityHealthAnalyticsSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSecurityHealthAnalyticsSettings resource. - * - * @param {string} organizationSecurityHealthAnalyticsSettingsName - * A fully-qualified path representing organization_securityHealthAnalyticsSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSecurityHealthAnalyticsSettingsName(organizationSecurityHealthAnalyticsSettingsName: string) { - return this.pathTemplates.organizationSecurityHealthAnalyticsSettingsPathTemplate.match(organizationSecurityHealthAnalyticsSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSecurityHealthAnalyticsSettingsCustomModule resource name string. - * - * @param {string} organization - * @param {string} custom_module - * @returns {string} Resource name string. - */ - organizationSecurityHealthAnalyticsSettingsCustomModulePath(organization:string,customModule:string) { - return this.pathTemplates.organizationSecurityHealthAnalyticsSettingsCustomModulePathTemplate.render({ - organization: organization, - custom_module: customModule, - }); - } - - /** - * Parse the organization from OrganizationSecurityHealthAnalyticsSettingsCustomModule resource. - * - * @param {string} organizationSecurityHealthAnalyticsSettingsCustomModuleName - * A fully-qualified path representing organization_securityHealthAnalyticsSettings_custom_module resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSecurityHealthAnalyticsSettingsCustomModuleName(organizationSecurityHealthAnalyticsSettingsCustomModuleName: string) { - return this.pathTemplates.organizationSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match(organizationSecurityHealthAnalyticsSettingsCustomModuleName).organization; - } - - /** - * Parse the custom_module from OrganizationSecurityHealthAnalyticsSettingsCustomModule resource. - * - * @param {string} organizationSecurityHealthAnalyticsSettingsCustomModuleName - * A fully-qualified path representing organization_securityHealthAnalyticsSettings_custom_module resource. - * @returns {string} A string representing the custom_module. - */ - matchCustomModuleFromOrganizationSecurityHealthAnalyticsSettingsCustomModuleName(organizationSecurityHealthAnalyticsSettingsCustomModuleName: string) { - return this.pathTemplates.organizationSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match(organizationSecurityHealthAnalyticsSettingsCustomModuleName).custom_module; - } - - /** - * Return a fully-qualified organizationSecurityHealthAnalyticsSettingsEffectiveCustomModule resource name string. - * - * @param {string} organization - * @param {string} effective_custom_module - * @returns {string} Resource name string. - */ - organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePath(organization:string,effectiveCustomModule:string) { - return this.pathTemplates.organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.render({ - organization: organization, - effective_custom_module: effectiveCustomModule, - }); - } - - /** - * Parse the organization from OrganizationSecurityHealthAnalyticsSettingsEffectiveCustomModule resource. - * - * @param {string} organizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName - * A fully-qualified path representing organization_securityHealthAnalyticsSettings_effective_custom_module resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(organizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName: string) { - return this.pathTemplates.organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match(organizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName).organization; - } - - /** - * Parse the effective_custom_module from OrganizationSecurityHealthAnalyticsSettingsEffectiveCustomModule resource. - * - * @param {string} organizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName - * A fully-qualified path representing organization_securityHealthAnalyticsSettings_effective_custom_module resource. - * @returns {string} A string representing the effective_custom_module. - */ - matchEffectiveCustomModuleFromOrganizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(organizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName: string) { - return this.pathTemplates.organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match(organizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName).effective_custom_module; - } - - /** - * Return a fully-qualified organizationSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSettingsPath(organization:string) { - return this.pathTemplates.organizationSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSettings resource. - * - * @param {string} organizationSettingsName - * A fully-qualified path representing OrganizationSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { - return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSource resource name string. - * - * @param {string} organization - * @param {string} source - * @returns {string} Resource name string. - */ - organizationSourcePath(organization:string,source:string) { - return this.pathTemplates.organizationSourcePathTemplate.render({ - organization: organization, - source: source, - }); - } - - /** - * Parse the organization from OrganizationSource resource. - * - * @param {string} organizationSourceName - * A fully-qualified path representing organization_source resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSourceName(organizationSourceName: string) { - return this.pathTemplates.organizationSourcePathTemplate.match(organizationSourceName).organization; - } - - /** - * Parse the source from OrganizationSource resource. - * - * @param {string} organizationSourceName - * A fully-qualified path representing organization_source resource. - * @returns {string} A string representing the source. - */ - matchSourceFromOrganizationSourceName(organizationSourceName: string) { - return this.pathTemplates.organizationSourcePathTemplate.match(organizationSourceName).source; - } - - /** - * Return a fully-qualified organizationSourceFinding resource name string. - * - * @param {string} organization - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - organizationSourceFindingPath(organization:string,source:string,finding:string) { - return this.pathTemplates.organizationSourceFindingPathTemplate.render({ - organization: organization, - source: source, - finding: finding, - }); - } - - /** - * Parse the organization from OrganizationSourceFinding resource. - * - * @param {string} organizationSourceFindingName - * A fully-qualified path representing organization_source_finding resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSourceFindingName(organizationSourceFindingName: string) { - return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).organization; - } - - /** - * Parse the source from OrganizationSourceFinding resource. - * - * @param {string} organizationSourceFindingName - * A fully-qualified path representing organization_source_finding resource. - * @returns {string} A string representing the source. - */ - matchSourceFromOrganizationSourceFindingName(organizationSourceFindingName: string) { - return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).source; - } - - /** - * Parse the finding from OrganizationSourceFinding resource. - * - * @param {string} organizationSourceFindingName - * A fully-qualified path representing organization_source_finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromOrganizationSourceFindingName(organizationSourceFindingName: string) { - return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).finding; - } - - /** - * Return a fully-qualified organizationSourceFindingExternalsystem resource name string. - * - * @param {string} organization - * @param {string} source - * @param {string} finding - * @param {string} externalsystem - * @returns {string} Resource name string. - */ - organizationSourceFindingExternalsystemPath(organization:string,source:string,finding:string,externalsystem:string) { - return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.render({ - organization: organization, - source: source, - finding: finding, - externalsystem: externalsystem, - }); - } - - /** - * Parse the organization from OrganizationSourceFindingExternalsystem resource. - * - * @param {string} organizationSourceFindingExternalsystemName - * A fully-qualified path representing organization_source_finding_externalsystem resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSourceFindingExternalsystemName(organizationSourceFindingExternalsystemName: string) { - return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match(organizationSourceFindingExternalsystemName).organization; - } - - /** - * Parse the source from OrganizationSourceFindingExternalsystem resource. - * - * @param {string} organizationSourceFindingExternalsystemName - * A fully-qualified path representing organization_source_finding_externalsystem resource. - * @returns {string} A string representing the source. - */ - matchSourceFromOrganizationSourceFindingExternalsystemName(organizationSourceFindingExternalsystemName: string) { - return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match(organizationSourceFindingExternalsystemName).source; - } - - /** - * Parse the finding from OrganizationSourceFindingExternalsystem resource. - * - * @param {string} organizationSourceFindingExternalsystemName - * A fully-qualified path representing organization_source_finding_externalsystem resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromOrganizationSourceFindingExternalsystemName(organizationSourceFindingExternalsystemName: string) { - return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match(organizationSourceFindingExternalsystemName).finding; - } - - /** - * Parse the externalsystem from OrganizationSourceFindingExternalsystem resource. - * - * @param {string} organizationSourceFindingExternalsystemName - * A fully-qualified path representing organization_source_finding_externalsystem resource. - * @returns {string} A string representing the externalsystem. - */ - matchExternalsystemFromOrganizationSourceFindingExternalsystemName(organizationSourceFindingExternalsystemName: string) { - return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match(organizationSourceFindingExternalsystemName).externalsystem; - } - - /** - * Return a fully-qualified organizationSourceFindingSecurityMarks resource name string. - * - * @param {string} organization - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - organizationSourceFindingSecurityMarksPath(organization:string,source:string,finding:string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render({ - organization: organization, - source: source, - finding: finding, - }); - } - - /** - * Parse the organization from OrganizationSourceFindingSecurityMarks resource. - * - * @param {string} organizationSourceFindingSecurityMarksName - * A fully-qualified path representing organization_source_finding_securityMarks resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).organization; - } - - /** - * Parse the source from OrganizationSourceFindingSecurityMarks resource. - * - * @param {string} organizationSourceFindingSecurityMarksName - * A fully-qualified path representing organization_source_finding_securityMarks resource. - * @returns {string} A string representing the source. - */ - matchSourceFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).source; - } - - /** - * Parse the finding from OrganizationSourceFindingSecurityMarks resource. - * - * @param {string} organizationSourceFindingSecurityMarksName - * A fully-qualified path representing organization_source_finding_securityMarks resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).finding; - } - - /** - * Return a fully-qualified projectAsset resource name string. - * - * @param {string} project - * @param {string} asset - * @returns {string} Resource name string. - */ - projectAssetPath(project:string,asset:string) { - return this.pathTemplates.projectAssetPathTemplate.render({ - project: project, - asset: asset, - }); - } - - /** - * Parse the project from ProjectAsset resource. - * - * @param {string} projectAssetName - * A fully-qualified path representing project_asset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAssetName(projectAssetName: string) { - return this.pathTemplates.projectAssetPathTemplate.match(projectAssetName).project; - } - - /** - * Parse the asset from ProjectAsset resource. - * - * @param {string} projectAssetName - * A fully-qualified path representing project_asset resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromProjectAssetName(projectAssetName: string) { - return this.pathTemplates.projectAssetPathTemplate.match(projectAssetName).asset; - } - - /** - * Return a fully-qualified projectAssetSecurityMarks resource name string. - * - * @param {string} project - * @param {string} asset - * @returns {string} Resource name string. - */ - projectAssetSecurityMarksPath(project:string,asset:string) { - return this.pathTemplates.projectAssetSecurityMarksPathTemplate.render({ - project: project, - asset: asset, - }); - } - - /** - * Parse the project from ProjectAssetSecurityMarks resource. - * - * @param {string} projectAssetSecurityMarksName - * A fully-qualified path representing project_asset_securityMarks resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAssetSecurityMarksName(projectAssetSecurityMarksName: string) { - return this.pathTemplates.projectAssetSecurityMarksPathTemplate.match(projectAssetSecurityMarksName).project; - } - - /** - * Parse the asset from ProjectAssetSecurityMarks resource. - * - * @param {string} projectAssetSecurityMarksName - * A fully-qualified path representing project_asset_securityMarks resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromProjectAssetSecurityMarksName(projectAssetSecurityMarksName: string) { - return this.pathTemplates.projectAssetSecurityMarksPathTemplate.match(projectAssetSecurityMarksName).asset; - } - - /** - * Return a fully-qualified projectExport resource name string. - * - * @param {string} project - * @param {string} exportParam - * @returns {string} Resource name string. - */ - projectExportPath(project:string,exportParam:string) { - return this.pathTemplates.projectExportPathTemplate.render({ - project: project, - export: exportParam, - }); - } - - /** - * Parse the project from ProjectExport resource. - * - * @param {string} projectExportName - * A fully-qualified path representing project_export resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectExportName(projectExportName: string) { - return this.pathTemplates.projectExportPathTemplate.match(projectExportName).project; - } - - /** - * Parse the export from ProjectExport resource. - * - * @param {string} projectExportName - * A fully-qualified path representing project_export resource. - * @returns {string} A string representing the export. - */ - matchExportFromProjectExportName(projectExportName: string) { - return this.pathTemplates.projectExportPathTemplate.match(projectExportName).export; - } - - /** - * Return a fully-qualified projectMuteConfig resource name string. - * - * @param {string} project - * @param {string} mute_config - * @returns {string} Resource name string. - */ - projectMuteConfigPath(project:string,muteConfig:string) { - return this.pathTemplates.projectMuteConfigPathTemplate.render({ - project: project, - mute_config: muteConfig, - }); - } - - /** - * Parse the project from ProjectMuteConfig resource. - * - * @param {string} projectMuteConfigName - * A fully-qualified path representing project_mute_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectMuteConfigName(projectMuteConfigName: string) { - return this.pathTemplates.projectMuteConfigPathTemplate.match(projectMuteConfigName).project; - } - - /** - * Parse the mute_config from ProjectMuteConfig resource. - * - * @param {string} projectMuteConfigName - * A fully-qualified path representing project_mute_config resource. - * @returns {string} A string representing the mute_config. - */ - matchMuteConfigFromProjectMuteConfigName(projectMuteConfigName: string) { - return this.pathTemplates.projectMuteConfigPathTemplate.match(projectMuteConfigName).mute_config; - } - - /** - * Return a fully-qualified projectNotificationConfig resource name string. - * - * @param {string} project - * @param {string} notification_config - * @returns {string} Resource name string. - */ - projectNotificationConfigPath(project:string,notificationConfig:string) { - return this.pathTemplates.projectNotificationConfigPathTemplate.render({ - project: project, - notification_config: notificationConfig, - }); - } - - /** - * Parse the project from ProjectNotificationConfig resource. - * - * @param {string} projectNotificationConfigName - * A fully-qualified path representing project_notification_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectNotificationConfigName(projectNotificationConfigName: string) { - return this.pathTemplates.projectNotificationConfigPathTemplate.match(projectNotificationConfigName).project; - } - - /** - * Parse the notification_config from ProjectNotificationConfig resource. - * - * @param {string} projectNotificationConfigName - * A fully-qualified path representing project_notification_config resource. - * @returns {string} A string representing the notification_config. - */ - matchNotificationConfigFromProjectNotificationConfigName(projectNotificationConfigName: string) { - return this.pathTemplates.projectNotificationConfigPathTemplate.match(projectNotificationConfigName).notification_config; - } - - /** - * Return a fully-qualified projectSecurityHealthAnalyticsSettingsCustomModule resource name string. - * - * @param {string} project - * @param {string} custom_module - * @returns {string} Resource name string. - */ - projectSecurityHealthAnalyticsSettingsCustomModulePath(project:string,customModule:string) { - return this.pathTemplates.projectSecurityHealthAnalyticsSettingsCustomModulePathTemplate.render({ - project: project, - custom_module: customModule, - }); - } - - /** - * Parse the project from ProjectSecurityHealthAnalyticsSettingsCustomModule resource. - * - * @param {string} projectSecurityHealthAnalyticsSettingsCustomModuleName - * A fully-qualified path representing project_securityHealthAnalyticsSettings_custom_module resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSecurityHealthAnalyticsSettingsCustomModuleName(projectSecurityHealthAnalyticsSettingsCustomModuleName: string) { - return this.pathTemplates.projectSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match(projectSecurityHealthAnalyticsSettingsCustomModuleName).project; - } - - /** - * Parse the custom_module from ProjectSecurityHealthAnalyticsSettingsCustomModule resource. - * - * @param {string} projectSecurityHealthAnalyticsSettingsCustomModuleName - * A fully-qualified path representing project_securityHealthAnalyticsSettings_custom_module resource. - * @returns {string} A string representing the custom_module. - */ - matchCustomModuleFromProjectSecurityHealthAnalyticsSettingsCustomModuleName(projectSecurityHealthAnalyticsSettingsCustomModuleName: string) { - return this.pathTemplates.projectSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match(projectSecurityHealthAnalyticsSettingsCustomModuleName).custom_module; - } - - /** - * Return a fully-qualified projectSecurityHealthAnalyticsSettingsEffectiveCustomModule resource name string. - * - * @param {string} project - * @param {string} effective_custom_module - * @returns {string} Resource name string. - */ - projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePath(project:string,effectiveCustomModule:string) { - return this.pathTemplates.projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.render({ - project: project, - effective_custom_module: effectiveCustomModule, - }); - } - - /** - * Parse the project from ProjectSecurityHealthAnalyticsSettingsEffectiveCustomModule resource. - * - * @param {string} projectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName - * A fully-qualified path representing project_securityHealthAnalyticsSettings_effective_custom_module resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(projectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName: string) { - return this.pathTemplates.projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match(projectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName).project; - } - - /** - * Parse the effective_custom_module from ProjectSecurityHealthAnalyticsSettingsEffectiveCustomModule resource. - * - * @param {string} projectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName - * A fully-qualified path representing project_securityHealthAnalyticsSettings_effective_custom_module resource. - * @returns {string} A string representing the effective_custom_module. - */ - matchEffectiveCustomModuleFromProjectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(projectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName: string) { - return this.pathTemplates.projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match(projectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName).effective_custom_module; - } - - /** - * Return a fully-qualified projectSource resource name string. - * - * @param {string} project - * @param {string} source - * @returns {string} Resource name string. - */ - projectSourcePath(project:string,source:string) { - return this.pathTemplates.projectSourcePathTemplate.render({ - project: project, - source: source, - }); - } - - /** - * Parse the project from ProjectSource resource. - * - * @param {string} projectSourceName - * A fully-qualified path representing project_source resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSourceName(projectSourceName: string) { - return this.pathTemplates.projectSourcePathTemplate.match(projectSourceName).project; - } - - /** - * Parse the source from ProjectSource resource. - * - * @param {string} projectSourceName - * A fully-qualified path representing project_source resource. - * @returns {string} A string representing the source. - */ - matchSourceFromProjectSourceName(projectSourceName: string) { - return this.pathTemplates.projectSourcePathTemplate.match(projectSourceName).source; - } - - /** - * Return a fully-qualified projectSourceFinding resource name string. - * - * @param {string} project - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - projectSourceFindingPath(project:string,source:string,finding:string) { - return this.pathTemplates.projectSourceFindingPathTemplate.render({ - project: project, - source: source, - finding: finding, - }); - } - - /** - * Parse the project from ProjectSourceFinding resource. - * - * @param {string} projectSourceFindingName - * A fully-qualified path representing project_source_finding resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSourceFindingName(projectSourceFindingName: string) { - return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).project; - } - - /** - * Parse the source from ProjectSourceFinding resource. - * - * @param {string} projectSourceFindingName - * A fully-qualified path representing project_source_finding resource. - * @returns {string} A string representing the source. - */ - matchSourceFromProjectSourceFindingName(projectSourceFindingName: string) { - return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).source; - } - - /** - * Parse the finding from ProjectSourceFinding resource. - * - * @param {string} projectSourceFindingName - * A fully-qualified path representing project_source_finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromProjectSourceFindingName(projectSourceFindingName: string) { - return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).finding; - } - - /** - * Return a fully-qualified projectSourceFindingExternalsystem resource name string. - * - * @param {string} project - * @param {string} source - * @param {string} finding - * @param {string} externalsystem - * @returns {string} Resource name string. - */ - projectSourceFindingExternalsystemPath(project:string,source:string,finding:string,externalsystem:string) { - return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.render({ - project: project, - source: source, - finding: finding, - externalsystem: externalsystem, - }); - } - - /** - * Parse the project from ProjectSourceFindingExternalsystem resource. - * - * @param {string} projectSourceFindingExternalsystemName - * A fully-qualified path representing project_source_finding_externalsystem resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSourceFindingExternalsystemName(projectSourceFindingExternalsystemName: string) { - return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match(projectSourceFindingExternalsystemName).project; - } - - /** - * Parse the source from ProjectSourceFindingExternalsystem resource. - * - * @param {string} projectSourceFindingExternalsystemName - * A fully-qualified path representing project_source_finding_externalsystem resource. - * @returns {string} A string representing the source. - */ - matchSourceFromProjectSourceFindingExternalsystemName(projectSourceFindingExternalsystemName: string) { - return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match(projectSourceFindingExternalsystemName).source; - } - - /** - * Parse the finding from ProjectSourceFindingExternalsystem resource. - * - * @param {string} projectSourceFindingExternalsystemName - * A fully-qualified path representing project_source_finding_externalsystem resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromProjectSourceFindingExternalsystemName(projectSourceFindingExternalsystemName: string) { - return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match(projectSourceFindingExternalsystemName).finding; - } - - /** - * Parse the externalsystem from ProjectSourceFindingExternalsystem resource. - * - * @param {string} projectSourceFindingExternalsystemName - * A fully-qualified path representing project_source_finding_externalsystem resource. - * @returns {string} A string representing the externalsystem. - */ - matchExternalsystemFromProjectSourceFindingExternalsystemName(projectSourceFindingExternalsystemName: string) { - return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match(projectSourceFindingExternalsystemName).externalsystem; - } - - /** - * Return a fully-qualified projectSourceFindingSecurityMarks resource name string. - * - * @param {string} project - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - projectSourceFindingSecurityMarksPath(project:string,source:string,finding:string) { - return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render({ - project: project, - source: source, - finding: finding, - }); - } - - /** - * Parse the project from ProjectSourceFindingSecurityMarks resource. - * - * @param {string} projectSourceFindingSecurityMarksName - * A fully-qualified path representing project_source_finding_securityMarks resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { - return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).project; - } - - /** - * Parse the source from ProjectSourceFindingSecurityMarks resource. - * - * @param {string} projectSourceFindingSecurityMarksName - * A fully-qualified path representing project_source_finding_securityMarks resource. - * @returns {string} A string representing the source. - */ - matchSourceFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { - return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).source; - } - - /** - * Parse the finding from ProjectSourceFindingSecurityMarks resource. - * - * @param {string} projectSourceFindingSecurityMarksName - * A fully-qualified path representing project_source_finding_securityMarks resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { - return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).finding; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.securityCenterStub && !this._terminated) { - return this.securityCenterStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_client_config.json b/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_client_config.json deleted file mode 100644 index e87538464a8..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_client_config.json +++ /dev/null @@ -1,233 +0,0 @@ -{ - "interfaces": { - "google.cloud.securitycenter.v1.SecurityCenter": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "BulkMuteFindings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateSecurityHealthAnalyticsCustomModule": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateSource": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateFinding": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateMuteConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateNotificationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteMuteConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteNotificationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteSecurityHealthAnalyticsCustomModule": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBigQueryExport": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetMuteConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetNotificationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetOrganizationSettings": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetEffectiveSecurityHealthAnalyticsCustomModule": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetSecurityHealthAnalyticsCustomModule": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetSource": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GroupAssets": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GroupFindings": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListAssets": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListDescendantSecurityHealthAnalyticsCustomModules": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFindings": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListMuteConfigs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListNotificationConfigs": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListEffectiveSecurityHealthAnalyticsCustomModules": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListSecurityHealthAnalyticsCustomModules": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListSources": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "RunAssetDiscovery": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetFindingState": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetMute": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "TestIamPermissions": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateExternalSystem": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateFinding": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateMuteConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateNotificationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateOrganizationSettings": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSecurityHealthAnalyticsCustomModule": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSource": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSecurityMarks": { - "timeout_millis": 480000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateBigQueryExport": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBigQueryExport": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateBigQueryExport": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBigQueryExports": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_proto_list.json b/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_proto_list.json deleted file mode 100644 index 445bd4476f4..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/src/v1/security_center_proto_list.json +++ /dev/null @@ -1,37 +0,0 @@ -[ - "../../protos/google/cloud/securitycenter/v1/access.proto", - "../../protos/google/cloud/securitycenter/v1/asset.proto", - "../../protos/google/cloud/securitycenter/v1/bigquery_export.proto", - "../../protos/google/cloud/securitycenter/v1/cloud_dlp_data_profile.proto", - "../../protos/google/cloud/securitycenter/v1/cloud_dlp_inspection.proto", - "../../protos/google/cloud/securitycenter/v1/compliance.proto", - "../../protos/google/cloud/securitycenter/v1/connection.proto", - "../../protos/google/cloud/securitycenter/v1/contact_details.proto", - "../../protos/google/cloud/securitycenter/v1/container.proto", - "../../protos/google/cloud/securitycenter/v1/database.proto", - "../../protos/google/cloud/securitycenter/v1/effective_security_health_analytics_custom_module.proto", - "../../protos/google/cloud/securitycenter/v1/exfiltration.proto", - "../../protos/google/cloud/securitycenter/v1/external_system.proto", - "../../protos/google/cloud/securitycenter/v1/file.proto", - "../../protos/google/cloud/securitycenter/v1/finding.proto", - "../../protos/google/cloud/securitycenter/v1/folder.proto", - "../../protos/google/cloud/securitycenter/v1/iam_binding.proto", - "../../protos/google/cloud/securitycenter/v1/indicator.proto", - "../../protos/google/cloud/securitycenter/v1/kernel_rootkit.proto", - "../../protos/google/cloud/securitycenter/v1/kubernetes.proto", - "../../protos/google/cloud/securitycenter/v1/label.proto", - "../../protos/google/cloud/securitycenter/v1/mitre_attack.proto", - "../../protos/google/cloud/securitycenter/v1/mute_config.proto", - "../../protos/google/cloud/securitycenter/v1/notification_config.proto", - "../../protos/google/cloud/securitycenter/v1/notification_message.proto", - "../../protos/google/cloud/securitycenter/v1/organization_settings.proto", - "../../protos/google/cloud/securitycenter/v1/process.proto", - "../../protos/google/cloud/securitycenter/v1/resource.proto", - "../../protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto", - "../../protos/google/cloud/securitycenter/v1/security_health_analytics_custom_config.proto", - "../../protos/google/cloud/securitycenter/v1/security_health_analytics_custom_module.proto", - "../../protos/google/cloud/securitycenter/v1/security_marks.proto", - "../../protos/google/cloud/securitycenter/v1/securitycenter_service.proto", - "../../protos/google/cloud/securitycenter/v1/source.proto", - "../../protos/google/cloud/securitycenter/v1/vulnerability.proto" -] diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-securitycenter/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index ca4c3d3425f..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const securitycenter = require('@google-cloud/security-center'); - -function main() { - const securityCenterClient = new securitycenter.SecurityCenterClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-securitycenter/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 323502f7e2f..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {SecurityCenterClient} from '@google-cloud/security-center'; - -// check that the client class type name can be used -function doStuffWithSecurityCenterClient(client: SecurityCenterClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const securityCenterClient = new SecurityCenterClient(); - doStuffWithSecurityCenterClient(securityCenterClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/system-test/install.ts b/owl-bot-staging/google-cloud-securitycenter/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/test/gapic_security_center_v1.ts b/owl-bot-staging/google-cloud-securitycenter/v1/test/gapic_security_center_v1.ts deleted file mode 100644 index 75ca6ea3649..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/test/gapic_security_center_v1.ts +++ /dev/null @@ -1,8298 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as securitycenterModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.SecurityCenterClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = securitycenterModule.v1.SecurityCenterClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = securitycenterModule.v1.SecurityCenterClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = securitycenterModule.v1.SecurityCenterClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new securitycenterModule.v1.SecurityCenterClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.securityCenterStub, undefined); - await client.initialize(); - assert(client.securityCenterStub); - }); - - it('has close method for the initialized client', done => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.securityCenterStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.securityCenterStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createSecurityHealthAnalyticsCustomModule', () => { - it('invokes createSecurityHealthAnalyticsCustomModule without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateSecurityHealthAnalyticsCustomModuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateSecurityHealthAnalyticsCustomModuleRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule() - ); - client.innerApiCalls.createSecurityHealthAnalyticsCustomModule = stubSimpleCall(expectedResponse); - const [response] = await client.createSecurityHealthAnalyticsCustomModule(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSecurityHealthAnalyticsCustomModule without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateSecurityHealthAnalyticsCustomModuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateSecurityHealthAnalyticsCustomModuleRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule() - ); - client.innerApiCalls.createSecurityHealthAnalyticsCustomModule = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSecurityHealthAnalyticsCustomModule( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSecurityHealthAnalyticsCustomModule with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateSecurityHealthAnalyticsCustomModuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateSecurityHealthAnalyticsCustomModuleRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSecurityHealthAnalyticsCustomModule = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSecurityHealthAnalyticsCustomModule(request), expectedError); - const actualRequest = (client.innerApiCalls.createSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSecurityHealthAnalyticsCustomModule with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateSecurityHealthAnalyticsCustomModuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateSecurityHealthAnalyticsCustomModuleRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createSecurityHealthAnalyticsCustomModule(request), expectedError); - }); - }); - - describe('createSource', () => { - it('invokes createSource without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.Source() - ); - client.innerApiCalls.createSource = stubSimpleCall(expectedResponse); - const [response] = await client.createSource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSource without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.Source() - ); - client.innerApiCalls.createSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSource( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSource with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSource(request), expectedError); - const actualRequest = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSource with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createSource(request), expectedError); - }); - }); - - describe('createFinding', () => { - it('invokes createFinding without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateFindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.Finding() - ); - client.innerApiCalls.createFinding = stubSimpleCall(expectedResponse); - const [response] = await client.createFinding(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFinding without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateFindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.Finding() - ); - client.innerApiCalls.createFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFinding( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFinding with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateFindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createFinding(request), expectedError); - const actualRequest = (client.innerApiCalls.createFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFinding with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateFindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createFinding(request), expectedError); - }); - }); - - describe('createMuteConfig', () => { - it('invokes createMuteConfig without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateMuteConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateMuteConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.MuteConfig() - ); - client.innerApiCalls.createMuteConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createMuteConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMuteConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMuteConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMuteConfig without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateMuteConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateMuteConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.MuteConfig() - ); - client.innerApiCalls.createMuteConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMuteConfig( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IMuteConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMuteConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMuteConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMuteConfig with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateMuteConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateMuteConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMuteConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createMuteConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createMuteConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMuteConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMuteConfig with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateMuteConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateMuteConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createMuteConfig(request), expectedError); - }); - }); - - describe('createNotificationConfig', () => { - it('invokes createNotificationConfig without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateNotificationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.NotificationConfig() - ); - client.innerApiCalls.createNotificationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createNotificationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNotificationConfig without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateNotificationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.NotificationConfig() - ); - client.innerApiCalls.createNotificationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createNotificationConfig( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.INotificationConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNotificationConfig with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateNotificationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNotificationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createNotificationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNotificationConfig with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateNotificationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createNotificationConfig(request), expectedError); - }); - }); - - describe('deleteMuteConfig', () => { - it('invokes deleteMuteConfig without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.DeleteMuteConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteMuteConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteMuteConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteMuteConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMuteConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMuteConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMuteConfig without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.DeleteMuteConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteMuteConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteMuteConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMuteConfig( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMuteConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMuteConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMuteConfig with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.DeleteMuteConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteMuteConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMuteConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteMuteConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteMuteConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMuteConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMuteConfig with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.DeleteMuteConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteMuteConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteMuteConfig(request), expectedError); - }); - }); - - describe('deleteNotificationConfig', () => { - it('invokes deleteNotificationConfig without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteNotificationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteNotificationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNotificationConfig without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteNotificationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteNotificationConfig( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNotificationConfig with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNotificationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteNotificationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNotificationConfig with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteNotificationConfig(request), expectedError); - }); - }); - - describe('deleteSecurityHealthAnalyticsCustomModule', () => { - it('invokes deleteSecurityHealthAnalyticsCustomModule without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.DeleteSecurityHealthAnalyticsCustomModuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteSecurityHealthAnalyticsCustomModuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSecurityHealthAnalyticsCustomModule(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSecurityHealthAnalyticsCustomModule without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.DeleteSecurityHealthAnalyticsCustomModuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteSecurityHealthAnalyticsCustomModuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSecurityHealthAnalyticsCustomModule( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSecurityHealthAnalyticsCustomModule with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.DeleteSecurityHealthAnalyticsCustomModuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteSecurityHealthAnalyticsCustomModuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSecurityHealthAnalyticsCustomModule(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSecurityHealthAnalyticsCustomModule with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.DeleteSecurityHealthAnalyticsCustomModuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteSecurityHealthAnalyticsCustomModuleRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteSecurityHealthAnalyticsCustomModule(request), expectedError); - }); - }); - - describe('getBigQueryExport', () => { - it('invokes getBigQueryExport without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetBigQueryExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetBigQueryExportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.BigQueryExport() - ); - client.innerApiCalls.getBigQueryExport = stubSimpleCall(expectedResponse); - const [response] = await client.getBigQueryExport(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBigQueryExport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBigQueryExport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBigQueryExport without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetBigQueryExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetBigQueryExportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.BigQueryExport() - ); - client.innerApiCalls.getBigQueryExport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBigQueryExport( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IBigQueryExport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBigQueryExport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBigQueryExport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBigQueryExport with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetBigQueryExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetBigQueryExportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBigQueryExport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBigQueryExport(request), expectedError); - const actualRequest = (client.innerApiCalls.getBigQueryExport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBigQueryExport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBigQueryExport with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetBigQueryExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetBigQueryExportRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBigQueryExport(request), expectedError); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getIamPolicy(request), expectedError); - }); - }); - - describe('getMuteConfig', () => { - it('invokes getMuteConfig without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetMuteConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetMuteConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.MuteConfig() - ); - client.innerApiCalls.getMuteConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getMuteConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMuteConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMuteConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMuteConfig without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetMuteConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetMuteConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.MuteConfig() - ); - client.innerApiCalls.getMuteConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMuteConfig( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IMuteConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMuteConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMuteConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMuteConfig with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetMuteConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetMuteConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMuteConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMuteConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getMuteConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMuteConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMuteConfig with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetMuteConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetMuteConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getMuteConfig(request), expectedError); - }); - }); - - describe('getNotificationConfig', () => { - it('invokes getNotificationConfig without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetNotificationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.NotificationConfig() - ); - client.innerApiCalls.getNotificationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getNotificationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationConfig without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetNotificationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.NotificationConfig() - ); - client.innerApiCalls.getNotificationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNotificationConfig( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.INotificationConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationConfig with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetNotificationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNotificationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNotificationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationConfig with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetNotificationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getNotificationConfig(request), expectedError); - }); - }); - - describe('getOrganizationSettings', () => { - it('invokes getOrganizationSettings without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.OrganizationSettings() - ); - client.innerApiCalls.getOrganizationSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getOrganizationSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOrganizationSettings without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.OrganizationSettings() - ); - client.innerApiCalls.getOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getOrganizationSettings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IOrganizationSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOrganizationSettings with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getOrganizationSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getOrganizationSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOrganizationSettings with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getOrganizationSettings(request), expectedError); - }); - }); - - describe('getEffectiveSecurityHealthAnalyticsCustomModule', () => { - it('invokes getEffectiveSecurityHealthAnalyticsCustomModule without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule() - ); - client.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule = stubSimpleCall(expectedResponse); - const [response] = await client.getEffectiveSecurityHealthAnalyticsCustomModule(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getEffectiveSecurityHealthAnalyticsCustomModule without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule() - ); - client.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getEffectiveSecurityHealthAnalyticsCustomModule( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getEffectiveSecurityHealthAnalyticsCustomModule with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEffectiveSecurityHealthAnalyticsCustomModule(request), expectedError); - const actualRequest = (client.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEffectiveSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getEffectiveSecurityHealthAnalyticsCustomModule with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getEffectiveSecurityHealthAnalyticsCustomModule(request), expectedError); - }); - }); - - describe('getSecurityHealthAnalyticsCustomModule', () => { - it('invokes getSecurityHealthAnalyticsCustomModule without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetSecurityHealthAnalyticsCustomModuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetSecurityHealthAnalyticsCustomModuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule() - ); - client.innerApiCalls.getSecurityHealthAnalyticsCustomModule = stubSimpleCall(expectedResponse); - const [response] = await client.getSecurityHealthAnalyticsCustomModule(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSecurityHealthAnalyticsCustomModule without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetSecurityHealthAnalyticsCustomModuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetSecurityHealthAnalyticsCustomModuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule() - ); - client.innerApiCalls.getSecurityHealthAnalyticsCustomModule = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSecurityHealthAnalyticsCustomModule( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSecurityHealthAnalyticsCustomModule with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetSecurityHealthAnalyticsCustomModuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetSecurityHealthAnalyticsCustomModuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSecurityHealthAnalyticsCustomModule = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSecurityHealthAnalyticsCustomModule(request), expectedError); - const actualRequest = (client.innerApiCalls.getSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSecurityHealthAnalyticsCustomModule with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetSecurityHealthAnalyticsCustomModuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetSecurityHealthAnalyticsCustomModuleRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSecurityHealthAnalyticsCustomModule(request), expectedError); - }); - }); - - describe('getSource', () => { - it('invokes getSource without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.Source() - ); - client.innerApiCalls.getSource = stubSimpleCall(expectedResponse); - const [response] = await client.getSource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSource without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.Source() - ); - client.innerApiCalls.getSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSource( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSource with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSource(request), expectedError); - const actualRequest = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSource with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSource(request), expectedError); - }); - }); - - describe('setFindingState', () => { - it('invokes setFindingState without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.SetFindingStateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.SetFindingStateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.Finding() - ); - client.innerApiCalls.setFindingState = stubSimpleCall(expectedResponse); - const [response] = await client.setFindingState(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setFindingState without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.SetFindingStateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.SetFindingStateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.Finding() - ); - client.innerApiCalls.setFindingState = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setFindingState( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setFindingState with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.SetFindingStateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.SetFindingStateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setFindingState = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setFindingState(request), expectedError); - const actualRequest = (client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setFindingState with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.SetFindingStateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.SetFindingStateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setFindingState(request), expectedError); - }); - }); - - describe('setMute', () => { - it('invokes setMute without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.SetMuteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.SetMuteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.Finding() - ); - client.innerApiCalls.setMute = stubSimpleCall(expectedResponse); - const [response] = await client.setMute(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setMute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMute without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.SetMuteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.SetMuteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.Finding() - ); - client.innerApiCalls.setMute = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setMute( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setMute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMute with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.SetMuteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.SetMuteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setMute = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setMute(request), expectedError); - const actualRequest = (client.innerApiCalls.setMute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setMute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setMute with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.SetMuteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.SetMuteRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setMute(request), expectedError); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setIamPolicy(request), expectedError); - }); - }); - - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); - const [response] = await client.testIamPermissions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request), expectedError); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.testIamPermissions(request), expectedError); - }); - }); - - describe('updateExternalSystem', () => { - it('invokes updateExternalSystem without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateExternalSystemRequest() - ); - request.externalSystem ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateExternalSystemRequest', ['externalSystem', 'name']); - request.externalSystem.name = defaultValue1; - const expectedHeaderRequestParams = `external_system.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ExternalSystem() - ); - client.innerApiCalls.updateExternalSystem = stubSimpleCall(expectedResponse); - const [response] = await client.updateExternalSystem(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateExternalSystem as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExternalSystem as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateExternalSystem without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateExternalSystemRequest() - ); - request.externalSystem ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateExternalSystemRequest', ['externalSystem', 'name']); - request.externalSystem.name = defaultValue1; - const expectedHeaderRequestParams = `external_system.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ExternalSystem() - ); - client.innerApiCalls.updateExternalSystem = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateExternalSystem( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IExternalSystem|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateExternalSystem as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExternalSystem as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateExternalSystem with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateExternalSystemRequest() - ); - request.externalSystem ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateExternalSystemRequest', ['externalSystem', 'name']); - request.externalSystem.name = defaultValue1; - const expectedHeaderRequestParams = `external_system.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateExternalSystem = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateExternalSystem(request), expectedError); - const actualRequest = (client.innerApiCalls.updateExternalSystem as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExternalSystem as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateExternalSystem with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateExternalSystemRequest() - ); - request.externalSystem ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateExternalSystemRequest', ['externalSystem', 'name']); - request.externalSystem.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateExternalSystem(request), expectedError); - }); - }); - - describe('updateFinding', () => { - it('invokes updateFinding without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateFindingRequest() - ); - request.finding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateFindingRequest', ['finding', 'name']); - request.finding.name = defaultValue1; - const expectedHeaderRequestParams = `finding.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.Finding() - ); - client.innerApiCalls.updateFinding = stubSimpleCall(expectedResponse); - const [response] = await client.updateFinding(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFinding without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateFindingRequest() - ); - request.finding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateFindingRequest', ['finding', 'name']); - request.finding.name = defaultValue1; - const expectedHeaderRequestParams = `finding.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.Finding() - ); - client.innerApiCalls.updateFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFinding( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFinding with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateFindingRequest() - ); - request.finding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateFindingRequest', ['finding', 'name']); - request.finding.name = defaultValue1; - const expectedHeaderRequestParams = `finding.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateFinding(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFinding with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateFindingRequest() - ); - request.finding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateFindingRequest', ['finding', 'name']); - request.finding.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateFinding(request), expectedError); - }); - }); - - describe('updateMuteConfig', () => { - it('invokes updateMuteConfig without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateMuteConfigRequest() - ); - request.muteConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateMuteConfigRequest', ['muteConfig', 'name']); - request.muteConfig.name = defaultValue1; - const expectedHeaderRequestParams = `mute_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.MuteConfig() - ); - client.innerApiCalls.updateMuteConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateMuteConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMuteConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMuteConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMuteConfig without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateMuteConfigRequest() - ); - request.muteConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateMuteConfigRequest', ['muteConfig', 'name']); - request.muteConfig.name = defaultValue1; - const expectedHeaderRequestParams = `mute_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.MuteConfig() - ); - client.innerApiCalls.updateMuteConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMuteConfig( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IMuteConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMuteConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMuteConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMuteConfig with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateMuteConfigRequest() - ); - request.muteConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateMuteConfigRequest', ['muteConfig', 'name']); - request.muteConfig.name = defaultValue1; - const expectedHeaderRequestParams = `mute_config.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMuteConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateMuteConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMuteConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMuteConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMuteConfig with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateMuteConfigRequest() - ); - request.muteConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateMuteConfigRequest', ['muteConfig', 'name']); - request.muteConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateMuteConfig(request), expectedError); - }); - }); - - describe('updateNotificationConfig', () => { - it('invokes updateNotificationConfig without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest() - ); - request.notificationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest', ['notificationConfig', 'name']); - request.notificationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `notification_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.NotificationConfig() - ); - client.innerApiCalls.updateNotificationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateNotificationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNotificationConfig without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest() - ); - request.notificationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest', ['notificationConfig', 'name']); - request.notificationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `notification_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.NotificationConfig() - ); - client.innerApiCalls.updateNotificationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateNotificationConfig( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.INotificationConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNotificationConfig with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest() - ); - request.notificationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest', ['notificationConfig', 'name']); - request.notificationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `notification_config.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNotificationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateNotificationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNotificationConfig with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest() - ); - request.notificationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest', ['notificationConfig', 'name']); - request.notificationConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateNotificationConfig(request), expectedError); - }); - }); - - describe('updateOrganizationSettings', () => { - it('invokes updateOrganizationSettings without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest() - ); - request.organizationSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); - request.organizationSettings.name = defaultValue1; - const expectedHeaderRequestParams = `organization_settings.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.OrganizationSettings() - ); - client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateOrganizationSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateOrganizationSettings without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest() - ); - request.organizationSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); - request.organizationSettings.name = defaultValue1; - const expectedHeaderRequestParams = `organization_settings.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.OrganizationSettings() - ); - client.innerApiCalls.updateOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateOrganizationSettings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IOrganizationSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateOrganizationSettings with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest() - ); - request.organizationSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); - request.organizationSettings.name = defaultValue1; - const expectedHeaderRequestParams = `organization_settings.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateOrganizationSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateOrganizationSettings with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest() - ); - request.organizationSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); - request.organizationSettings.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateOrganizationSettings(request), expectedError); - }); - }); - - describe('updateSecurityHealthAnalyticsCustomModule', () => { - it('invokes updateSecurityHealthAnalyticsCustomModule without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateSecurityHealthAnalyticsCustomModuleRequest() - ); - request.securityHealthAnalyticsCustomModule ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSecurityHealthAnalyticsCustomModuleRequest', ['securityHealthAnalyticsCustomModule', 'name']); - request.securityHealthAnalyticsCustomModule.name = defaultValue1; - const expectedHeaderRequestParams = `security_health_analytics_custom_module.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule() - ); - client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule = stubSimpleCall(expectedResponse); - const [response] = await client.updateSecurityHealthAnalyticsCustomModule(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSecurityHealthAnalyticsCustomModule without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateSecurityHealthAnalyticsCustomModuleRequest() - ); - request.securityHealthAnalyticsCustomModule ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSecurityHealthAnalyticsCustomModuleRequest', ['securityHealthAnalyticsCustomModule', 'name']); - request.securityHealthAnalyticsCustomModule.name = defaultValue1; - const expectedHeaderRequestParams = `security_health_analytics_custom_module.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule() - ); - client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSecurityHealthAnalyticsCustomModule( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSecurityHealthAnalyticsCustomModule with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateSecurityHealthAnalyticsCustomModuleRequest() - ); - request.securityHealthAnalyticsCustomModule ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSecurityHealthAnalyticsCustomModuleRequest', ['securityHealthAnalyticsCustomModule', 'name']); - request.securityHealthAnalyticsCustomModule.name = defaultValue1; - const expectedHeaderRequestParams = `security_health_analytics_custom_module.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSecurityHealthAnalyticsCustomModule(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSecurityHealthAnalyticsCustomModule with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateSecurityHealthAnalyticsCustomModuleRequest() - ); - request.securityHealthAnalyticsCustomModule ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSecurityHealthAnalyticsCustomModuleRequest', ['securityHealthAnalyticsCustomModule', 'name']); - request.securityHealthAnalyticsCustomModule.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSecurityHealthAnalyticsCustomModule(request), expectedError); - }); - }); - - describe('updateSource', () => { - it('invokes updateSource without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedHeaderRequestParams = `source.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.Source() - ); - client.innerApiCalls.updateSource = stubSimpleCall(expectedResponse); - const [response] = await client.updateSource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSource without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedHeaderRequestParams = `source.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.Source() - ); - client.innerApiCalls.updateSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSource( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSource with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedHeaderRequestParams = `source.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSource(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSource with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSource(request), expectedError); - }); - }); - - describe('updateSecurityMarks', () => { - it('invokes updateSecurityMarks without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest() - ); - request.securityMarks ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); - request.securityMarks.name = defaultValue1; - const expectedHeaderRequestParams = `security_marks.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.SecurityMarks() - ); - client.innerApiCalls.updateSecurityMarks = stubSimpleCall(expectedResponse); - const [response] = await client.updateSecurityMarks(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSecurityMarks without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest() - ); - request.securityMarks ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); - request.securityMarks.name = defaultValue1; - const expectedHeaderRequestParams = `security_marks.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.SecurityMarks() - ); - client.innerApiCalls.updateSecurityMarks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSecurityMarks( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISecurityMarks|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSecurityMarks with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest() - ); - request.securityMarks ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); - request.securityMarks.name = defaultValue1; - const expectedHeaderRequestParams = `security_marks.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSecurityMarks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSecurityMarks(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSecurityMarks with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest() - ); - request.securityMarks ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); - request.securityMarks.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSecurityMarks(request), expectedError); - }); - }); - - describe('createBigQueryExport', () => { - it('invokes createBigQueryExport without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateBigQueryExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateBigQueryExportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.BigQueryExport() - ); - client.innerApiCalls.createBigQueryExport = stubSimpleCall(expectedResponse); - const [response] = await client.createBigQueryExport(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBigQueryExport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBigQueryExport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBigQueryExport without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateBigQueryExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateBigQueryExportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.BigQueryExport() - ); - client.innerApiCalls.createBigQueryExport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBigQueryExport( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IBigQueryExport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBigQueryExport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBigQueryExport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBigQueryExport with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateBigQueryExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateBigQueryExportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBigQueryExport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createBigQueryExport(request), expectedError); - const actualRequest = (client.innerApiCalls.createBigQueryExport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBigQueryExport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBigQueryExport with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.CreateBigQueryExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.CreateBigQueryExportRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createBigQueryExport(request), expectedError); - }); - }); - - describe('deleteBigQueryExport', () => { - it('invokes deleteBigQueryExport without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.DeleteBigQueryExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteBigQueryExportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBigQueryExport = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBigQueryExport(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBigQueryExport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBigQueryExport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBigQueryExport without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.DeleteBigQueryExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteBigQueryExportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBigQueryExport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBigQueryExport( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBigQueryExport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBigQueryExport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBigQueryExport with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.DeleteBigQueryExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteBigQueryExportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBigQueryExport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteBigQueryExport(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBigQueryExport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBigQueryExport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBigQueryExport with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.DeleteBigQueryExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.DeleteBigQueryExportRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteBigQueryExport(request), expectedError); - }); - }); - - describe('updateBigQueryExport', () => { - it('invokes updateBigQueryExport without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest() - ); - request.bigQueryExport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest', ['bigQueryExport', 'name']); - request.bigQueryExport.name = defaultValue1; - const expectedHeaderRequestParams = `big_query_export.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.BigQueryExport() - ); - client.innerApiCalls.updateBigQueryExport = stubSimpleCall(expectedResponse); - const [response] = await client.updateBigQueryExport(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBigQueryExport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBigQueryExport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBigQueryExport without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest() - ); - request.bigQueryExport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest', ['bigQueryExport', 'name']); - request.bigQueryExport.name = defaultValue1; - const expectedHeaderRequestParams = `big_query_export.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.BigQueryExport() - ); - client.innerApiCalls.updateBigQueryExport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBigQueryExport( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IBigQueryExport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBigQueryExport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBigQueryExport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBigQueryExport with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest() - ); - request.bigQueryExport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest', ['bigQueryExport', 'name']); - request.bigQueryExport.name = defaultValue1; - const expectedHeaderRequestParams = `big_query_export.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBigQueryExport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateBigQueryExport(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBigQueryExport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBigQueryExport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBigQueryExport with closed client', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest() - ); - request.bigQueryExport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest', ['bigQueryExport', 'name']); - request.bigQueryExport.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateBigQueryExport(request), expectedError); - }); - }); - - describe('bulkMuteFindings', () => { - it('invokes bulkMuteFindings without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.BulkMuteFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.BulkMuteFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.bulkMuteFindings = stubLongRunningCall(expectedResponse); - const [operation] = await client.bulkMuteFindings(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.bulkMuteFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.bulkMuteFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes bulkMuteFindings without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.BulkMuteFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.BulkMuteFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.bulkMuteFindings = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.bulkMuteFindings( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.bulkMuteFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.bulkMuteFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes bulkMuteFindings with call error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.BulkMuteFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.BulkMuteFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.bulkMuteFindings = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.bulkMuteFindings(request), expectedError); - const actualRequest = (client.innerApiCalls.bulkMuteFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.bulkMuteFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes bulkMuteFindings with LRO error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.BulkMuteFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.BulkMuteFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.bulkMuteFindings = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.bulkMuteFindings(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.bulkMuteFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.bulkMuteFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkBulkMuteFindingsProgress without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBulkMuteFindingsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBulkMuteFindingsProgress with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBulkMuteFindingsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('runAssetDiscovery', () => { - it('invokes runAssetDiscovery without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(expectedResponse); - const [operation] = await client.runAssetDiscovery(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runAssetDiscovery without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runAssetDiscovery( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runAssetDiscovery with call error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.runAssetDiscovery(request), expectedError); - const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runAssetDiscovery with LRO error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.runAssetDiscovery(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRunAssetDiscoveryProgress without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRunAssetDiscoveryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRunAssetDiscoveryProgress with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRunAssetDiscoveryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('groupAssets', () => { - it('invokes groupAssets without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - ]; - client.innerApiCalls.groupAssets = stubSimpleCall(expectedResponse); - const [response] = await client.groupAssets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes groupAssets without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - ]; - client.innerApiCalls.groupAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.groupAssets( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IGroupResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes groupAssets with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.groupAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.groupAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes groupAssetsStream without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - ]; - client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.groupAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.GroupResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); - assert( - (client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes groupAssetsStream with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.groupAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.GroupResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); - assert( - (client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with groupAssets without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - ]; - client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.IGroupResult[] = []; - const iterable = client.groupAssetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with groupAssets with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.groupAssetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1.IGroupResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('groupFindings', () => { - it('invokes groupFindings without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - ]; - client.innerApiCalls.groupFindings = stubSimpleCall(expectedResponse); - const [response] = await client.groupFindings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes groupFindings without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - ]; - client.innerApiCalls.groupFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.groupFindings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IGroupResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes groupFindings with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.groupFindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.groupFindings(request), expectedError); - const actualRequest = (client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes groupFindingsStream without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - ]; - client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.groupFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.GroupResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); - assert( - (client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes groupFindingsStream with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.groupFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.GroupResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); - assert( - (client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with groupFindings without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - ]; - client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.IGroupResult[] = []; - const iterable = client.groupFindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with groupFindings with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.groupFindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1.IGroupResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listAssets', () => { - it('invokes listAssets without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - ]; - client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); - const [response] = await client.listAssets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssets without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - ]; - client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAssets( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssets with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssetsStream without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - ]; - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAssetsStream with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAssets without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - ]; - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[] = []; - const iterable = client.listAssetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAssets with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAssetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listDescendantSecurityHealthAnalyticsCustomModules', () => { - it('invokes listDescendantSecurityHealthAnalyticsCustomModules without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - ]; - client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules = stubSimpleCall(expectedResponse); - const [response] = await client.listDescendantSecurityHealthAnalyticsCustomModules(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDescendantSecurityHealthAnalyticsCustomModules without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - ]; - client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDescendantSecurityHealthAnalyticsCustomModules( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDescendantSecurityHealthAnalyticsCustomModules with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDescendantSecurityHealthAnalyticsCustomModules(request), expectedError); - const actualRequest = (client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDescendantSecurityHealthAnalyticsCustomModulesStream without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - ]; - client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDescendantSecurityHealthAnalyticsCustomModulesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules, request)); - assert( - (client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDescendantSecurityHealthAnalyticsCustomModulesStream with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDescendantSecurityHealthAnalyticsCustomModulesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDescendantSecurityHealthAnalyticsCustomModules, request)); - assert( - (client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDescendantSecurityHealthAnalyticsCustomModules without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - ]; - client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[] = []; - const iterable = client.listDescendantSecurityHealthAnalyticsCustomModulesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDescendantSecurityHealthAnalyticsCustomModules with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListDescendantSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDescendantSecurityHealthAnalyticsCustomModulesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDescendantSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listFindings', () => { - it('invokes listFindings without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - ]; - client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); - const [response] = await client.listFindings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindings without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - ]; - client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindings with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindings(request), expectedError); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingsStream without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - ]; - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFindingsStream with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFindings without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - ]; - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult[] = []; - const iterable = client.listFindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFindings with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listMuteConfigs', () => { - it('invokes listMuteConfigs without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListMuteConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListMuteConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - ]; - client.innerApiCalls.listMuteConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listMuteConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMuteConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMuteConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMuteConfigs without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListMuteConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListMuteConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - ]; - client.innerApiCalls.listMuteConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMuteConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IMuteConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMuteConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMuteConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMuteConfigs with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListMuteConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListMuteConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMuteConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMuteConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listMuteConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMuteConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMuteConfigsStream without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListMuteConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListMuteConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - ]; - client.descriptors.page.listMuteConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMuteConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.MuteConfig[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.MuteConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMuteConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMuteConfigs, request)); - assert( - (client.descriptors.page.listMuteConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listMuteConfigsStream with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListMuteConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListMuteConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMuteConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMuteConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.MuteConfig[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.MuteConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMuteConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMuteConfigs, request)); - assert( - (client.descriptors.page.listMuteConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMuteConfigs without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListMuteConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListMuteConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - ]; - client.descriptors.page.listMuteConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.IMuteConfig[] = []; - const iterable = client.listMuteConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMuteConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMuteConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMuteConfigs with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListMuteConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListMuteConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMuteConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMuteConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1.IMuteConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMuteConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMuteConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listNotificationConfigs', () => { - it('invokes listNotificationConfigs without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListNotificationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - ]; - client.innerApiCalls.listNotificationConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listNotificationConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotificationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationConfigs without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListNotificationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - ]; - client.innerApiCalls.listNotificationConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNotificationConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.INotificationConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotificationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationConfigs with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListNotificationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNotificationConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNotificationConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listNotificationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationConfigsStream without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListNotificationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - ]; - client.descriptors.page.listNotificationConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNotificationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.NotificationConfig[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.NotificationConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listNotificationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationConfigs, request)); - assert( - (client.descriptors.page.listNotificationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNotificationConfigsStream with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListNotificationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotificationConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNotificationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.NotificationConfig[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.NotificationConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNotificationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationConfigs, request)); - assert( - (client.descriptors.page.listNotificationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNotificationConfigs without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListNotificationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - ]; - client.descriptors.page.listNotificationConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.INotificationConfig[] = []; - const iterable = client.listNotificationConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNotificationConfigs with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListNotificationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotificationConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNotificationConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1.INotificationConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listEffectiveSecurityHealthAnalyticsCustomModules', () => { - it('invokes listEffectiveSecurityHealthAnalyticsCustomModules without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), - ]; - client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules = stubSimpleCall(expectedResponse); - const [response] = await client.listEffectiveSecurityHealthAnalyticsCustomModules(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEffectiveSecurityHealthAnalyticsCustomModules without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), - ]; - client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listEffectiveSecurityHealthAnalyticsCustomModules( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEffectiveSecurityHealthAnalyticsCustomModules with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listEffectiveSecurityHealthAnalyticsCustomModules(request), expectedError); - const actualRequest = (client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEffectiveSecurityHealthAnalyticsCustomModulesStream without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), - ]; - client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listEffectiveSecurityHealthAnalyticsCustomModulesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules, request)); - assert( - (client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listEffectiveSecurityHealthAnalyticsCustomModulesStream with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listEffectiveSecurityHealthAnalyticsCustomModulesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listEffectiveSecurityHealthAnalyticsCustomModules, request)); - assert( - (client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listEffectiveSecurityHealthAnalyticsCustomModules without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.EffectiveSecurityHealthAnalyticsCustomModule()), - ]; - client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule[] = []; - const iterable = client.listEffectiveSecurityHealthAnalyticsCustomModulesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listEffectiveSecurityHealthAnalyticsCustomModules with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listEffectiveSecurityHealthAnalyticsCustomModulesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1.IEffectiveSecurityHealthAnalyticsCustomModule[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listEffectiveSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listSecurityHealthAnalyticsCustomModules', () => { - it('invokes listSecurityHealthAnalyticsCustomModules without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - ]; - client.innerApiCalls.listSecurityHealthAnalyticsCustomModules = stubSimpleCall(expectedResponse); - const [response] = await client.listSecurityHealthAnalyticsCustomModules(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSecurityHealthAnalyticsCustomModules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSecurityHealthAnalyticsCustomModules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSecurityHealthAnalyticsCustomModules without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - ]; - client.innerApiCalls.listSecurityHealthAnalyticsCustomModules = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSecurityHealthAnalyticsCustomModules( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSecurityHealthAnalyticsCustomModules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSecurityHealthAnalyticsCustomModules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSecurityHealthAnalyticsCustomModules with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSecurityHealthAnalyticsCustomModules = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSecurityHealthAnalyticsCustomModules(request), expectedError); - const actualRequest = (client.innerApiCalls.listSecurityHealthAnalyticsCustomModules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSecurityHealthAnalyticsCustomModules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSecurityHealthAnalyticsCustomModulesStream without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - ]; - client.descriptors.page.listSecurityHealthAnalyticsCustomModules.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSecurityHealthAnalyticsCustomModulesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSecurityHealthAnalyticsCustomModules.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSecurityHealthAnalyticsCustomModules, request)); - assert( - (client.descriptors.page.listSecurityHealthAnalyticsCustomModules.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listSecurityHealthAnalyticsCustomModulesStream with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSecurityHealthAnalyticsCustomModules.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSecurityHealthAnalyticsCustomModulesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSecurityHealthAnalyticsCustomModules.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSecurityHealthAnalyticsCustomModules, request)); - assert( - (client.descriptors.page.listSecurityHealthAnalyticsCustomModules.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSecurityHealthAnalyticsCustomModules without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityHealthAnalyticsCustomModule()), - ]; - client.descriptors.page.listSecurityHealthAnalyticsCustomModules.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[] = []; - const iterable = client.listSecurityHealthAnalyticsCustomModulesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSecurityHealthAnalyticsCustomModules with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSecurityHealthAnalyticsCustomModulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSecurityHealthAnalyticsCustomModules.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSecurityHealthAnalyticsCustomModulesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1.ISecurityHealthAnalyticsCustomModule[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSecurityHealthAnalyticsCustomModules.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listSources', () => { - it('invokes listSources without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - ]; - client.innerApiCalls.listSources = stubSimpleCall(expectedResponse); - const [response] = await client.listSources(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSources without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - ]; - client.innerApiCalls.listSources = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSources( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISource[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSources with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSources = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSources(request), expectedError); - const actualRequest = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSourcesStream without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - ]; - client.descriptors.page.listSources.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.Source[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.Source) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSources, request)); - assert( - (client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listSourcesStream with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSources.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.Source[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.Source) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSources, request)); - assert( - (client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSources without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - ]; - client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.ISource[] = []; - const iterable = client.listSourcesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSources with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSourcesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1.ISource[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listBigQueryExports', () => { - it('invokes listBigQueryExports without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListBigQueryExportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListBigQueryExportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - ]; - client.innerApiCalls.listBigQueryExports = stubSimpleCall(expectedResponse); - const [response] = await client.listBigQueryExports(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBigQueryExports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBigQueryExports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBigQueryExports without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListBigQueryExportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListBigQueryExportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - ]; - client.innerApiCalls.listBigQueryExports = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBigQueryExports( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IBigQueryExport[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBigQueryExports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBigQueryExports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBigQueryExports with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListBigQueryExportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListBigQueryExportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBigQueryExports = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBigQueryExports(request), expectedError); - const actualRequest = (client.innerApiCalls.listBigQueryExports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBigQueryExports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBigQueryExportsStream without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListBigQueryExportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListBigQueryExportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - ]; - client.descriptors.page.listBigQueryExports.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBigQueryExportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.BigQueryExport[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.BigQueryExport) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listBigQueryExports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBigQueryExports, request)); - assert( - (client.descriptors.page.listBigQueryExports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBigQueryExportsStream with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListBigQueryExportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListBigQueryExportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBigQueryExports.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBigQueryExportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.BigQueryExport[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.BigQueryExport) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBigQueryExports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBigQueryExports, request)); - assert( - (client.descriptors.page.listBigQueryExports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBigQueryExports without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListBigQueryExportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListBigQueryExportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - ]; - client.descriptors.page.listBigQueryExports.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.IBigQueryExport[] = []; - const iterable = client.listBigQueryExportsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBigQueryExports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBigQueryExports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBigQueryExports with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1.ListBigQueryExportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1.ListBigQueryExportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBigQueryExports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBigQueryExportsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1.IBigQueryExport[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBigQueryExports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBigQueryExports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('folderAsset', () => { - const fakePath = "/rendered/path/folderAsset"; - const expectedParameters = { - folder: "folderValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderAssetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAssetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAssetPath', () => { - const result = client.folderAssetPath("folderValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAssetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAssetName', () => { - const result = client.matchFolderFromFolderAssetName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromFolderAssetName', () => { - const result = client.matchAssetFromFolderAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.folderAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAssetSecurityMarks', () => { - const fakePath = "/rendered/path/folderAssetSecurityMarks"; - const expectedParameters = { - folder: "folderValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderAssetSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAssetSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAssetSecurityMarksPath', () => { - const result = client.folderAssetSecurityMarksPath("folderValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAssetSecurityMarksName', () => { - const result = client.matchFolderFromFolderAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromFolderAssetSecurityMarksName', () => { - const result = client.matchAssetFromFolderAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderExport', () => { - const fakePath = "/rendered/path/folderExport"; - const expectedParameters = { - folder: "folderValue", - export: "exportValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderExportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderExportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderExportPath', () => { - const result = client.folderExportPath("folderValue", "exportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderExportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderExportName', () => { - const result = client.matchFolderFromFolderExportName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderExportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExportFromFolderExportName', () => { - const result = client.matchExportFromFolderExportName(fakePath); - assert.strictEqual(result, "exportValue"); - assert((client.pathTemplates.folderExportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderMuteConfig', () => { - const fakePath = "/rendered/path/folderMuteConfig"; - const expectedParameters = { - folder: "folderValue", - mute_config: "muteConfigValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderMuteConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderMuteConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderMuteConfigPath', () => { - const result = client.folderMuteConfigPath("folderValue", "muteConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderMuteConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderMuteConfigName', () => { - const result = client.matchFolderFromFolderMuteConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderMuteConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMuteConfigFromFolderMuteConfigName', () => { - const result = client.matchMuteConfigFromFolderMuteConfigName(fakePath); - assert.strictEqual(result, "muteConfigValue"); - assert((client.pathTemplates.folderMuteConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderNotificationConfig', () => { - const fakePath = "/rendered/path/folderNotificationConfig"; - const expectedParameters = { - folder: "folderValue", - notification_config: "notificationConfigValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderNotificationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationConfigPath', () => { - const result = client.folderNotificationConfigPath("folderValue", "notificationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationConfigName', () => { - const result = client.matchFolderFromFolderNotificationConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationConfigFromFolderNotificationConfigName', () => { - const result = client.matchNotificationConfigFromFolderNotificationConfigName(fakePath); - assert.strictEqual(result, "notificationConfigValue"); - assert((client.pathTemplates.folderNotificationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSecurityHealthAnalyticsSettingsCustomModule', () => { - const fakePath = "/rendered/path/folderSecurityHealthAnalyticsSettingsCustomModule"; - const expectedParameters = { - folder: "folderValue", - custom_module: "customModuleValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSecurityHealthAnalyticsSettingsCustomModulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSecurityHealthAnalyticsSettingsCustomModulePath', () => { - const result = client.folderSecurityHealthAnalyticsSettingsCustomModulePath("folderValue", "customModuleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSecurityHealthAnalyticsSettingsCustomModulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSecurityHealthAnalyticsSettingsCustomModuleName', () => { - const result = client.matchFolderFromFolderSecurityHealthAnalyticsSettingsCustomModuleName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCustomModuleFromFolderSecurityHealthAnalyticsSettingsCustomModuleName', () => { - const result = client.matchCustomModuleFromFolderSecurityHealthAnalyticsSettingsCustomModuleName(fakePath); - assert.strictEqual(result, "customModuleValue"); - assert((client.pathTemplates.folderSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSecurityHealthAnalyticsSettingsEffectiveCustomModule', () => { - const fakePath = "/rendered/path/folderSecurityHealthAnalyticsSettingsEffectiveCustomModule"; - const expectedParameters = { - folder: "folderValue", - effective_custom_module: "effectiveCustomModuleValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePath', () => { - const result = client.folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePath("folderValue", "effectiveCustomModuleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName', () => { - const result = client.matchFolderFromFolderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEffectiveCustomModuleFromFolderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName', () => { - const result = client.matchEffectiveCustomModuleFromFolderSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(fakePath); - assert.strictEqual(result, "effectiveCustomModuleValue"); - assert((client.pathTemplates.folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSource', () => { - const fakePath = "/rendered/path/folderSource"; - const expectedParameters = { - folder: "folderValue", - source: "sourceValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSourcePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSourcePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSourcePath', () => { - const result = client.folderSourcePath("folderValue", "sourceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSourcePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSourceName', () => { - const result = client.matchFolderFromFolderSourceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromFolderSourceName', () => { - const result = client.matchSourceFromFolderSourceName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.folderSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSourceFinding', () => { - const fakePath = "/rendered/path/folderSourceFinding"; - const expectedParameters = { - folder: "folderValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSourceFindingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSourceFindingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSourceFindingPath', () => { - const result = client.folderSourceFindingPath("folderValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSourceFindingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSourceFindingName', () => { - const result = client.matchFolderFromFolderSourceFindingName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromFolderSourceFindingName', () => { - const result = client.matchSourceFromFolderSourceFindingName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromFolderSourceFindingName', () => { - const result = client.matchFindingFromFolderSourceFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSourceFindingExternalsystem', () => { - const fakePath = "/rendered/path/folderSourceFindingExternalsystem"; - const expectedParameters = { - folder: "folderValue", - source: "sourceValue", - finding: "findingValue", - externalsystem: "externalsystemValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSourceFindingExternalsystemPath', () => { - const result = client.folderSourceFindingExternalsystemPath("folderValue", "sourceValue", "findingValue", "externalsystemValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSourceFindingExternalsystemName', () => { - const result = client.matchFolderFromFolderSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromFolderSourceFindingExternalsystemName', () => { - const result = client.matchSourceFromFolderSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromFolderSourceFindingExternalsystemName', () => { - const result = client.matchFindingFromFolderSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExternalsystemFromFolderSourceFindingExternalsystemName', () => { - const result = client.matchExternalsystemFromFolderSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "externalsystemValue"); - assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSourceFindingSecurityMarks', () => { - const fakePath = "/rendered/path/folderSourceFindingSecurityMarks"; - const expectedParameters = { - folder: "folderValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSourceFindingSecurityMarksPath', () => { - const result = client.folderSourceFindingSecurityMarksPath("folderValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSourceFindingSecurityMarksName', () => { - const result = client.matchFolderFromFolderSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromFolderSourceFindingSecurityMarksName', () => { - const result = client.matchSourceFromFolderSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromFolderSourceFindingSecurityMarksName', () => { - const result = client.matchFindingFromFolderSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organization', () => { - const fakePath = "/rendered/path/organization"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationPath', () => { - const result = client.organizationPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationName', () => { - const result = client.matchOrganizationFromOrganizationName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAsset', () => { - const fakePath = "/rendered/path/organizationAsset"; - const expectedParameters = { - organization: "organizationValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationAssetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAssetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAssetPath', () => { - const result = client.organizationAssetPath("organizationValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAssetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAssetName', () => { - const result = client.matchOrganizationFromOrganizationAssetName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromOrganizationAssetName', () => { - const result = client.matchAssetFromOrganizationAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.organizationAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAssetSecurityMarks', () => { - const fakePath = "/rendered/path/organizationAssetSecurityMarks"; - const expectedParameters = { - organization: "organizationValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAssetSecurityMarksPath', () => { - const result = client.organizationAssetSecurityMarksPath("organizationValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAssetSecurityMarksName', () => { - const result = client.matchOrganizationFromOrganizationAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromOrganizationAssetSecurityMarksName', () => { - const result = client.matchAssetFromOrganizationAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationExport', () => { - const fakePath = "/rendered/path/organizationExport"; - const expectedParameters = { - organization: "organizationValue", - export: "exportValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationExportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationExportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationExportPath', () => { - const result = client.organizationExportPath("organizationValue", "exportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationExportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationExportName', () => { - const result = client.matchOrganizationFromOrganizationExportName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationExportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExportFromOrganizationExportName', () => { - const result = client.matchExportFromOrganizationExportName(fakePath); - assert.strictEqual(result, "exportValue"); - assert((client.pathTemplates.organizationExportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationMuteConfig', () => { - const fakePath = "/rendered/path/organizationMuteConfig"; - const expectedParameters = { - organization: "organizationValue", - mute_config: "muteConfigValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationMuteConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationMuteConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationMuteConfigPath', () => { - const result = client.organizationMuteConfigPath("organizationValue", "muteConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationMuteConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationMuteConfigName', () => { - const result = client.matchOrganizationFromOrganizationMuteConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationMuteConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMuteConfigFromOrganizationMuteConfigName', () => { - const result = client.matchMuteConfigFromOrganizationMuteConfigName(fakePath); - assert.strictEqual(result, "muteConfigValue"); - assert((client.pathTemplates.organizationMuteConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationNotificationConfig', () => { - const fakePath = "/rendered/path/organizationNotificationConfig"; - const expectedParameters = { - organization: "organizationValue", - notification_config: "notificationConfigValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationNotificationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationConfigPath', () => { - const result = client.organizationNotificationConfigPath("organizationValue", "notificationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationConfigName', () => { - const result = client.matchOrganizationFromOrganizationNotificationConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationConfigFromOrganizationNotificationConfigName', () => { - const result = client.matchNotificationConfigFromOrganizationNotificationConfigName(fakePath); - assert.strictEqual(result, "notificationConfigValue"); - assert((client.pathTemplates.organizationNotificationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSecurityHealthAnalyticsSettings', () => { - const fakePath = "/rendered/path/organizationSecurityHealthAnalyticsSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSecurityHealthAnalyticsSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSecurityHealthAnalyticsSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSecurityHealthAnalyticsSettingsPath', () => { - const result = client.organizationSecurityHealthAnalyticsSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSecurityHealthAnalyticsSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSecurityHealthAnalyticsSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSecurityHealthAnalyticsSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSecurityHealthAnalyticsSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSecurityHealthAnalyticsSettingsCustomModule', () => { - const fakePath = "/rendered/path/organizationSecurityHealthAnalyticsSettingsCustomModule"; - const expectedParameters = { - organization: "organizationValue", - custom_module: "customModuleValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSecurityHealthAnalyticsSettingsCustomModulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSecurityHealthAnalyticsSettingsCustomModulePath', () => { - const result = client.organizationSecurityHealthAnalyticsSettingsCustomModulePath("organizationValue", "customModuleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSecurityHealthAnalyticsSettingsCustomModulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSecurityHealthAnalyticsSettingsCustomModuleName', () => { - const result = client.matchOrganizationFromOrganizationSecurityHealthAnalyticsSettingsCustomModuleName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCustomModuleFromOrganizationSecurityHealthAnalyticsSettingsCustomModuleName', () => { - const result = client.matchCustomModuleFromOrganizationSecurityHealthAnalyticsSettingsCustomModuleName(fakePath); - assert.strictEqual(result, "customModuleValue"); - assert((client.pathTemplates.organizationSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSecurityHealthAnalyticsSettingsEffectiveCustomModule', () => { - const fakePath = "/rendered/path/organizationSecurityHealthAnalyticsSettingsEffectiveCustomModule"; - const expectedParameters = { - organization: "organizationValue", - effective_custom_module: "effectiveCustomModuleValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePath', () => { - const result = client.organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePath("organizationValue", "effectiveCustomModuleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName', () => { - const result = client.matchOrganizationFromOrganizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEffectiveCustomModuleFromOrganizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName', () => { - const result = client.matchEffectiveCustomModuleFromOrganizationSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(fakePath); - assert.strictEqual(result, "effectiveCustomModuleValue"); - assert((client.pathTemplates.organizationSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSettings', () => { - const fakePath = "/rendered/path/organizationSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSettingsPath', () => { - const result = client.organizationSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSource', () => { - const fakePath = "/rendered/path/organizationSource"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSourcePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSourcePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSourcePath', () => { - const result = client.organizationSourcePath("organizationValue", "sourceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSourcePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSourceName', () => { - const result = client.matchOrganizationFromOrganizationSourceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromOrganizationSourceName', () => { - const result = client.matchSourceFromOrganizationSourceName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.organizationSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSourceFinding', () => { - const fakePath = "/rendered/path/organizationSourceFinding"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSourceFindingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSourceFindingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSourceFindingPath', () => { - const result = client.organizationSourceFindingPath("organizationValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSourceFindingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSourceFindingName', () => { - const result = client.matchOrganizationFromOrganizationSourceFindingName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromOrganizationSourceFindingName', () => { - const result = client.matchSourceFromOrganizationSourceFindingName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromOrganizationSourceFindingName', () => { - const result = client.matchFindingFromOrganizationSourceFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSourceFindingExternalsystem', () => { - const fakePath = "/rendered/path/organizationSourceFindingExternalsystem"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - finding: "findingValue", - externalsystem: "externalsystemValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSourceFindingExternalsystemPath', () => { - const result = client.organizationSourceFindingExternalsystemPath("organizationValue", "sourceValue", "findingValue", "externalsystemValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSourceFindingExternalsystemName', () => { - const result = client.matchOrganizationFromOrganizationSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromOrganizationSourceFindingExternalsystemName', () => { - const result = client.matchSourceFromOrganizationSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromOrganizationSourceFindingExternalsystemName', () => { - const result = client.matchFindingFromOrganizationSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExternalsystemFromOrganizationSourceFindingExternalsystemName', () => { - const result = client.matchExternalsystemFromOrganizationSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "externalsystemValue"); - assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSourceFindingSecurityMarks', () => { - const fakePath = "/rendered/path/organizationSourceFindingSecurityMarks"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSourceFindingSecurityMarksPath', () => { - const result = client.organizationSourceFindingSecurityMarksPath("organizationValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSourceFindingSecurityMarksName', () => { - const result = client.matchOrganizationFromOrganizationSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromOrganizationSourceFindingSecurityMarksName', () => { - const result = client.matchSourceFromOrganizationSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromOrganizationSourceFindingSecurityMarksName', () => { - const result = client.matchFindingFromOrganizationSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAsset', () => { - const fakePath = "/rendered/path/projectAsset"; - const expectedParameters = { - project: "projectValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAssetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAssetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAssetPath', () => { - const result = client.projectAssetPath("projectValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAssetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAssetName', () => { - const result = client.matchProjectFromProjectAssetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromProjectAssetName', () => { - const result = client.matchAssetFromProjectAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.projectAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAssetSecurityMarks', () => { - const fakePath = "/rendered/path/projectAssetSecurityMarks"; - const expectedParameters = { - project: "projectValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAssetSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAssetSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAssetSecurityMarksPath', () => { - const result = client.projectAssetSecurityMarksPath("projectValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAssetSecurityMarksName', () => { - const result = client.matchProjectFromProjectAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromProjectAssetSecurityMarksName', () => { - const result = client.matchAssetFromProjectAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectExport', () => { - const fakePath = "/rendered/path/projectExport"; - const expectedParameters = { - project: "projectValue", - export: "exportValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectExportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectExportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectExportPath', () => { - const result = client.projectExportPath("projectValue", "exportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectExportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectExportName', () => { - const result = client.matchProjectFromProjectExportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectExportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExportFromProjectExportName', () => { - const result = client.matchExportFromProjectExportName(fakePath); - assert.strictEqual(result, "exportValue"); - assert((client.pathTemplates.projectExportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectMuteConfig', () => { - const fakePath = "/rendered/path/projectMuteConfig"; - const expectedParameters = { - project: "projectValue", - mute_config: "muteConfigValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectMuteConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectMuteConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectMuteConfigPath', () => { - const result = client.projectMuteConfigPath("projectValue", "muteConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectMuteConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectMuteConfigName', () => { - const result = client.matchProjectFromProjectMuteConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectMuteConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMuteConfigFromProjectMuteConfigName', () => { - const result = client.matchMuteConfigFromProjectMuteConfigName(fakePath); - assert.strictEqual(result, "muteConfigValue"); - assert((client.pathTemplates.projectMuteConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectNotificationConfig', () => { - const fakePath = "/rendered/path/projectNotificationConfig"; - const expectedParameters = { - project: "projectValue", - notification_config: "notificationConfigValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectNotificationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationConfigPath', () => { - const result = client.projectNotificationConfigPath("projectValue", "notificationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationConfigName', () => { - const result = client.matchProjectFromProjectNotificationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationConfigFromProjectNotificationConfigName', () => { - const result = client.matchNotificationConfigFromProjectNotificationConfigName(fakePath); - assert.strictEqual(result, "notificationConfigValue"); - assert((client.pathTemplates.projectNotificationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSecurityHealthAnalyticsSettingsCustomModule', () => { - const fakePath = "/rendered/path/projectSecurityHealthAnalyticsSettingsCustomModule"; - const expectedParameters = { - project: "projectValue", - custom_module: "customModuleValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSecurityHealthAnalyticsSettingsCustomModulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSecurityHealthAnalyticsSettingsCustomModulePath', () => { - const result = client.projectSecurityHealthAnalyticsSettingsCustomModulePath("projectValue", "customModuleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSecurityHealthAnalyticsSettingsCustomModulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSecurityHealthAnalyticsSettingsCustomModuleName', () => { - const result = client.matchProjectFromProjectSecurityHealthAnalyticsSettingsCustomModuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCustomModuleFromProjectSecurityHealthAnalyticsSettingsCustomModuleName', () => { - const result = client.matchCustomModuleFromProjectSecurityHealthAnalyticsSettingsCustomModuleName(fakePath); - assert.strictEqual(result, "customModuleValue"); - assert((client.pathTemplates.projectSecurityHealthAnalyticsSettingsCustomModulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSecurityHealthAnalyticsSettingsEffectiveCustomModule', () => { - const fakePath = "/rendered/path/projectSecurityHealthAnalyticsSettingsEffectiveCustomModule"; - const expectedParameters = { - project: "projectValue", - effective_custom_module: "effectiveCustomModuleValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePath', () => { - const result = client.projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePath("projectValue", "effectiveCustomModuleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName', () => { - const result = client.matchProjectFromProjectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEffectiveCustomModuleFromProjectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName', () => { - const result = client.matchEffectiveCustomModuleFromProjectSecurityHealthAnalyticsSettingsEffectiveCustomModuleName(fakePath); - assert.strictEqual(result, "effectiveCustomModuleValue"); - assert((client.pathTemplates.projectSecurityHealthAnalyticsSettingsEffectiveCustomModulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSource', () => { - const fakePath = "/rendered/path/projectSource"; - const expectedParameters = { - project: "projectValue", - source: "sourceValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSourcePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSourcePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSourcePath', () => { - const result = client.projectSourcePath("projectValue", "sourceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSourcePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSourceName', () => { - const result = client.matchProjectFromProjectSourceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromProjectSourceName', () => { - const result = client.matchSourceFromProjectSourceName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.projectSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSourceFinding', () => { - const fakePath = "/rendered/path/projectSourceFinding"; - const expectedParameters = { - project: "projectValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSourceFindingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSourceFindingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSourceFindingPath', () => { - const result = client.projectSourceFindingPath("projectValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSourceFindingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSourceFindingName', () => { - const result = client.matchProjectFromProjectSourceFindingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromProjectSourceFindingName', () => { - const result = client.matchSourceFromProjectSourceFindingName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromProjectSourceFindingName', () => { - const result = client.matchFindingFromProjectSourceFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSourceFindingExternalsystem', () => { - const fakePath = "/rendered/path/projectSourceFindingExternalsystem"; - const expectedParameters = { - project: "projectValue", - source: "sourceValue", - finding: "findingValue", - externalsystem: "externalsystemValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSourceFindingExternalsystemPath', () => { - const result = client.projectSourceFindingExternalsystemPath("projectValue", "sourceValue", "findingValue", "externalsystemValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSourceFindingExternalsystemName', () => { - const result = client.matchProjectFromProjectSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromProjectSourceFindingExternalsystemName', () => { - const result = client.matchSourceFromProjectSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromProjectSourceFindingExternalsystemName', () => { - const result = client.matchFindingFromProjectSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExternalsystemFromProjectSourceFindingExternalsystemName', () => { - const result = client.matchExternalsystemFromProjectSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "externalsystemValue"); - assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSourceFindingSecurityMarks', () => { - const fakePath = "/rendered/path/projectSourceFindingSecurityMarks"; - const expectedParameters = { - project: "projectValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSourceFindingSecurityMarksPath', () => { - const result = client.projectSourceFindingSecurityMarksPath("projectValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSourceFindingSecurityMarksName', () => { - const result = client.matchProjectFromProjectSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromProjectSourceFindingSecurityMarksName', () => { - const result = client.matchSourceFromProjectSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromProjectSourceFindingSecurityMarksName', () => { - const result = client.matchFindingFromProjectSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/tsconfig.json b/owl-bot-staging/google-cloud-securitycenter/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/webpack.config.js b/owl-bot-staging/google-cloud-securitycenter/v1/webpack.config.js deleted file mode 100644 index 4aeca8bf63a..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 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 -// -// https://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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'SecurityCenter', - filename: './security-center.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/.eslintignore b/owl-bot-staging/google-cloud-securitycenter/v1beta1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-securitycenter/v1beta1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/.gitignore b/owl-bot-staging/google-cloud-securitycenter/v1beta1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/.jsdoc.js deleted file mode 100644 index 4d5ad9781e7..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2023 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/security-center', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/.mocharc.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/README.md b/owl-bot-staging/google-cloud-securitycenter/v1beta1/README.md deleted file mode 100644 index 73f34764a12..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Securitycenter: Nodejs Client diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/linkinator.config.json b/owl-bot-staging/google-cloud-securitycenter/v1beta1/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/package.json b/owl-bot-staging/google-cloud-securitycenter/v1beta1/package.json deleted file mode 100644 index efcfeb4e7ad..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/security-center", - "version": "0.1.0", - "description": "Securitycenter client for Node.js", - "repository": "googleapis/nodejs-securitycenter", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google securitycenter", - "securitycenter", - "security center" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.5.7" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^4.0.0", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.1.2", - "mocha": "^10.2.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.0.1", - "ts-loader": "^8.4.0", - "typescript": "^4.8.4", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/asset.proto b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/asset.proto deleted file mode 100644 index 89792501700..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/asset.proto +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2020 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1beta1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1beta1/security_marks.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/securitycenter/apiv1beta1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1beta1"; - -// Security Command Center representation of a Google Cloud -// resource. -// -// The Asset is a Security Command Center resource that captures information -// about a single Google Cloud resource. All modifications to an Asset are only -// within the context of Security Command Center and don't affect the referenced -// Google Cloud resource. -message Asset { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/Asset" - pattern: "organizations/{organization}/assets/{asset}" - }; - - // Security Command Center managed properties. These properties are managed by - // Security Command Center and cannot be modified by the user. - message SecurityCenterProperties { - // Immutable. The full resource name of the Google Cloud resource this asset - // represents. This field is immutable after create time. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // The type of the Google Cloud resource. Examples include: APPLICATION, - // PROJECT, and ORGANIZATION. This is a case insensitive field defined by - // Security Command Center and/or the producer of the resource and is - // immutable after create time. - string resource_type = 2; - - // The full resource name of the immediate parent of the resource. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_parent = 3; - - // The full resource name of the project the resource belongs to. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_project = 4; - - // Owners of the Google Cloud resource. - repeated string resource_owners = 5; - } - - // The relative resource name of this asset. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/assets/{asset_id}". - string name = 1; - - // Security Command Center managed properties. These properties are managed by - // Security Command Center and cannot be modified by the user. - SecurityCenterProperties security_center_properties = 2; - - // Resource managed properties. These properties are managed and defined by - // the Google Cloud resource and cannot be modified by the user. - map resource_properties = 7; - - // User specified security marks. These marks are entirely managed by the user - // and come from the SecurityMarks resource that belongs to the asset. - SecurityMarks security_marks = 8; - - // The time at which the asset was created in Security Command Center. - google.protobuf.Timestamp create_time = 9; - - // The time at which the asset was last updated, added, or deleted in Security - // Command Center. - google.protobuf.Timestamp update_time = 10; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/finding.proto b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/finding.proto deleted file mode 100644 index 66609f3f27d..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/finding.proto +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2020 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1beta1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1beta1/security_marks.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/securitycenter/apiv1beta1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1beta1"; - -// Security Command Center finding. -// -// A finding is a record of assessment data (security, risk, health or privacy) -// ingested into Security Command Center for presentation, notification, -// analysis, policy testing, and enforcement. For example, an XSS vulnerability -// in an App Engine application is a finding. -message Finding { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/Finding" - pattern: "organizations/{organization}/sources/{source}/findings/{finding}" - }; - - // The state of the finding. - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // The finding requires attention and has not been addressed yet. - ACTIVE = 1; - - // The finding has been fixed, triaged as a non-issue or otherwise addressed - // and is no longer active. - INACTIVE = 2; - } - - // The relative resource name of this finding. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}" - string name = 1; - - // Immutable. The relative resource name of the source the finding belongs to. - // See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // This field is immutable after creation time. - // For example: - // "organizations/{organization_id}/sources/{source_id}" - string parent = 2 [(google.api.field_behavior) = IMMUTABLE]; - - // For findings on Google Cloud resources, the full resource - // name of the Google Cloud resource this finding is for. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - // When the finding is for a non-Google Cloud resource, the resourceName can - // be a customer or partner defined string. This field is immutable after - // creation time. - string resource_name = 3; - - // The state of the finding. - State state = 4; - - // The additional taxonomy group within findings from a given source. - // This field is immutable after creation time. - // Example: "XSS_FLASH_INJECTION" - string category = 5; - - // The URI that, if available, points to a web page outside of Security - // Command Center where additional information about the finding can be found. - // This field is guaranteed to be either empty or a well formed URL. - string external_uri = 6; - - // Source specific properties. These properties are managed by the source - // that writes the finding. The key names in the source_properties map must be - // between 1 and 255 characters, and must start with a letter and contain - // alphanumeric characters or underscores only. - map source_properties = 7; - - // Output only. User specified security marks. These marks are entirely - // managed by the user and come from the SecurityMarks resource that belongs - // to the finding. - SecurityMarks security_marks = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The time at which the event took place, or when an update to the finding - // occurred. For example, if the finding represents an open firewall it would - // capture the time the detector believes the firewall became open. The - // accuracy is determined by the detector. If the finding were to be resolved - // afterward, this time would reflect when the finding was resolved. - google.protobuf.Timestamp event_time = 9; - - // The time at which the finding was created in Security Command Center. - google.protobuf.Timestamp create_time = 10; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/organization_settings.proto b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/organization_settings.proto deleted file mode 100644 index 3c9509ba962..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/organization_settings.proto +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2020 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1beta1; - -import "google/api/resource.proto"; - -option go_package = "cloud.google.com/go/securitycenter/apiv1beta1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1beta1"; - -// User specified settings that are attached to the Security Command -// Center organization. -message OrganizationSettings { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/OrganizationSettings" - pattern: "organizations/{organization}/organizationSettings" - }; - - // The configuration used for Asset Discovery runs. - message AssetDiscoveryConfig { - // The mode of inclusion when running Asset Discovery. - // Asset discovery can be limited by explicitly identifying projects to be - // included or excluded. If INCLUDE_ONLY is set, then only those projects - // within the organization and their children are discovered during asset - // discovery. If EXCLUDE is set, then projects that don't match those - // projects are discovered during asset discovery. If neither are set, then - // all projects within the organization are discovered during asset - // discovery. - enum InclusionMode { - // Unspecified. Setting the mode with this value will disable - // inclusion/exclusion filtering for Asset Discovery. - INCLUSION_MODE_UNSPECIFIED = 0; - - // Asset Discovery will capture only the resources within the projects - // specified. All other resources will be ignored. - INCLUDE_ONLY = 1; - - // Asset Discovery will ignore all resources under the projects specified. - // All other resources will be retrieved. - EXCLUDE = 2; - } - - // The project ids to use for filtering asset discovery. - repeated string project_ids = 1; - - // The mode to use for filtering asset discovery. - InclusionMode inclusion_mode = 2; - } - - // The relative resource name of the settings. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/organizationSettings". - string name = 1; - - // A flag that indicates if Asset Discovery should be enabled. If the flag is - // set to `true`, then discovery of assets will occur. If it is set to `false, - // all historical assets will remain, but discovery of future assets will not - // occur. - bool enable_asset_discovery = 2; - - // The configuration used for Asset Discovery runs. - AssetDiscoveryConfig asset_discovery_config = 3; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto deleted file mode 100644 index dfda29a29aa..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2020 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1beta1; - -import "google/protobuf/duration.proto"; - -option go_package = "cloud.google.com/go/securitycenter/apiv1beta1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1beta1"; - -// Response of asset discovery run -message RunAssetDiscoveryResponse { - // The state of an asset discovery run. - enum State { - // Asset discovery run state was unspecified. - STATE_UNSPECIFIED = 0; - - // Asset discovery run completed successfully. - COMPLETED = 1; - - // Asset discovery run was cancelled with tasks still pending, as another - // run for the same organization was started with a higher priority. - SUPERSEDED = 2; - - // Asset discovery run was killed and terminated. - TERMINATED = 3; - } - - // The state of an asset discovery run. - State state = 1; - - // The duration between asset discovery run start and end - google.protobuf.Duration duration = 2; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/security_marks.proto b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/security_marks.proto deleted file mode 100644 index 5bae35479a6..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/security_marks.proto +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1beta1; - -import "google/api/resource.proto"; - -option go_package = "cloud.google.com/go/securitycenter/apiv1beta1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1beta1"; - -// User specified security marks that are attached to the parent Security -// Command Center resource. Security marks are scoped within a Security Command -// Center organization -- they can be modified and viewed by all users who have -// proper permissions on the organization. -message SecurityMarks { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/SecurityMarks" - pattern: "organizations/{organization}/assets/{asset}/securityMarks" - pattern: "organizations/{organization}/sources/{source}/findings/{finding}/securityMarks" - }; - - // The relative resource name of the SecurityMarks. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Examples: - // "organizations/{organization_id}/assets/{asset_id}/securityMarks" - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks". - string name = 1; - - // Mutable user specified security marks belonging to the parent resource. - // Constraints are as follows: - // - // * Keys and values are treated as case insensitive - // * Keys must be between 1 - 256 characters (inclusive) - // * Keys must be letters, numbers, underscores, or dashes - // * Values have leading and trailing whitespace trimmed, remaining - // characters must be between 1 - 4096 characters (inclusive) - map marks = 2; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto deleted file mode 100644 index e45ac6df448..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto +++ /dev/null @@ -1,823 +0,0 @@ -// Copyright 2020 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1beta1/asset.proto"; -import "google/cloud/securitycenter/v1beta1/finding.proto"; -import "google/cloud/securitycenter/v1beta1/organization_settings.proto"; -import "google/cloud/securitycenter/v1beta1/security_marks.proto"; -import "google/cloud/securitycenter/v1beta1/source.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/securitycenter/apiv1beta1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1beta1"; - -// V1 Beta APIs for Security Center service. -service SecurityCenter { - option (google.api.default_host) = "securitycenter.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a source. - rpc CreateSource(CreateSourceRequest) returns (Source) { - option (google.api.http) = { - post: "/v1beta1/{parent=organizations/*}/sources" - body: "source" - }; - option (google.api.method_signature) = "parent,source"; - } - - // Creates a finding. The corresponding source must exist for finding creation - // to succeed. - rpc CreateFinding(CreateFindingRequest) returns (Finding) { - option (google.api.http) = { - post: "/v1beta1/{parent=organizations/*/sources/*}/findings" - body: "finding" - }; - option (google.api.method_signature) = "parent,finding_id,finding"; - } - - // Gets the access control policy on the specified Source. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1beta1/{resource=organizations/*/sources/*}:getIamPolicy" - body: "*" - }; - option (google.api.method_signature) = "resource"; - } - - // Gets the settings for an organization. - rpc GetOrganizationSettings(GetOrganizationSettingsRequest) returns (OrganizationSettings) { - option (google.api.http) = { - get: "/v1beta1/{name=organizations/*/organizationSettings}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a source. - rpc GetSource(GetSourceRequest) returns (Source) { - option (google.api.http) = { - get: "/v1beta1/{name=organizations/*/sources/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Filters an organization's assets and groups them by their specified - // properties. - rpc GroupAssets(GroupAssetsRequest) returns (GroupAssetsResponse) { - option (google.api.http) = { - post: "/v1beta1/{parent=organizations/*}/assets:group" - body: "*" - }; - } - - // Filters an organization or source's findings and groups them by their - // specified properties. - // - // To group across all sources provide a `-` as the source id. - // Example: /v1beta1/organizations/{organization_id}/sources/-/findings - rpc GroupFindings(GroupFindingsRequest) returns (GroupFindingsResponse) { - option (google.api.http) = { - post: "/v1beta1/{parent=organizations/*/sources/*}/findings:group" - body: "*" - }; - option (google.api.method_signature) = "parent,group_by"; - } - - // Lists an organization's assets. - rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=organizations/*}/assets" - }; - } - - // Lists an organization or source's findings. - // - // To list across all sources provide a `-` as the source id. - // Example: /v1beta1/organizations/{organization_id}/sources/-/findings - rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=organizations/*/sources/*}/findings" - }; - } - - // Lists all sources belonging to an organization. - rpc ListSources(ListSourcesRequest) returns (ListSourcesResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=organizations/*}/sources" - }; - option (google.api.method_signature) = "parent"; - } - - // Runs asset discovery. The discovery is tracked with a long-running - // operation. - // - // This API can only be called with limited frequency for an organization. If - // it is called too frequently the caller will receive a TOO_MANY_REQUESTS - // error. - rpc RunAssetDiscovery(RunAssetDiscoveryRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{parent=organizations/*}/assets:runDiscovery" - body: "*" - }; - option (google.api.method_signature) = "parent"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Empty" - }; - } - - // Updates the state of a finding. - rpc SetFindingState(SetFindingStateRequest) returns (Finding) { - option (google.api.http) = { - post: "/v1beta1/{name=organizations/*/sources/*/findings/*}:setState" - body: "*" - }; - option (google.api.method_signature) = "name,state,start_time"; - } - - // Sets the access control policy on the specified Source. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1beta1/{resource=organizations/*/sources/*}:setIamPolicy" - body: "*" - }; - option (google.api.method_signature) = "resource,policy"; - } - - // Returns the permissions that a caller has on the specified source. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1beta1/{resource=organizations/*/sources/*}:testIamPermissions" - body: "*" - }; - option (google.api.method_signature) = "resource,permissions"; - } - - // Creates or updates a finding. The corresponding source must exist for a - // finding creation to succeed. - rpc UpdateFinding(UpdateFindingRequest) returns (Finding) { - option (google.api.http) = { - patch: "/v1beta1/{finding.name=organizations/*/sources/*/findings/*}" - body: "finding" - }; - option (google.api.method_signature) = "finding"; - } - - // Updates an organization's settings. - rpc UpdateOrganizationSettings(UpdateOrganizationSettingsRequest) returns (OrganizationSettings) { - option (google.api.http) = { - patch: "/v1beta1/{organization_settings.name=organizations/*/organizationSettings}" - body: "organization_settings" - }; - option (google.api.method_signature) = "organization_settings"; - } - - // Updates a source. - rpc UpdateSource(UpdateSourceRequest) returns (Source) { - option (google.api.http) = { - patch: "/v1beta1/{source.name=organizations/*/sources/*}" - body: "source" - }; - option (google.api.method_signature) = "source"; - } - - // Updates security marks. - rpc UpdateSecurityMarks(UpdateSecurityMarksRequest) returns (SecurityMarks) { - option (google.api.http) = { - patch: "/v1beta1/{security_marks.name=organizations/*/assets/*/securityMarks}" - body: "security_marks" - additional_bindings { - patch: "/v1beta1/{security_marks.name=organizations/*/sources/*/findings/*/securityMarks}" - body: "security_marks" - } - }; - option (google.api.method_signature) = "security_marks"; - } -} - -// Request message for creating a finding. -message CreateFindingRequest { - // Required. Resource name of the new finding's parent. Its format should be - // "organizations/[organization_id]/sources/[source_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; - - // Required. Unique identifier provided by the client within the parent scope. - // It must be alphanumeric and less than or equal to 32 characters and - // greater than 0 characters in length. - string finding_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Finding being created. The name and security_marks will be ignored as - // they are both output only fields on this resource. - Finding finding = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for creating a source. -message CreateSourceRequest { - // Required. Resource name of the new source's parent. Its format should be - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // Required. The Source being created, only the display_name and description will be - // used. All other fields will be ignored. - Source source = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for getting organization settings. -message GetOrganizationSettingsRequest { - // Required. Name of the organization to get organization settings for. Its format is - // "organizations/[organization_id]/organizationSettings". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/OrganizationSettings" - } - ]; -} - -// Request message for getting a source. -message GetSourceRequest { - // Required. Relative resource name of the source. Its format is - // "organizations/[organization_id]/source/[source_id]". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; -} - -// Request message for grouping by assets. -message GroupAssetsRequest { - // Required. Name of the organization to groupBy. Its format is - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // Expression that defines the filter to apply across assets. - // The expression is a list of zero or more restrictions combined via logical - // operators `AND` and `OR`. - // Parentheses are not 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 Asset resource. Examples include: - // - // * name - // * security_center_properties.resource_name - // * resource_properties.a_property - // * security_marks.marks.marka - // - // 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. - // - // For example, `resource_properties.size = 100` is a valid filter string. - string filter = 2; - - // Required. Expression that defines what assets fields to use for grouping. The string - // value should follow SQL syntax: comma separated list of fields. For - // example: - // "security_center_properties.resource_project,security_center_properties.project". - // - // The following fields are supported when compare_duration is not set: - // - // * security_center_properties.resource_project - // * security_center_properties.resource_type - // * security_center_properties.resource_parent - // - // The following fields are supported when compare_duration is set: - // - // * security_center_properties.resource_type - string group_by = 3 [(google.api.field_behavior) = REQUIRED]; - - // When compare_duration is set, the Asset's "state" property is updated to - // indicate whether the asset was added, removed, or remained present during - // the compare_duration period of time that precedes the read_time. This is - // the time between (read_time - compare_duration) and read_time. - // - // The state value is derived based on the presence of the asset at the two - // points in time. Intermediate state changes between the two times don't - // affect the result. For example, the results aren't affected if the asset is - // removed and re-created again. - // - // Possible "state" values when compare_duration is specified: - // - // * "ADDED": indicates that the asset was not present before - // compare_duration, but present at reference_time. - // * "REMOVED": indicates that the asset was present at the start of - // compare_duration, but not present at reference_time. - // * "ACTIVE": indicates that the asset was present at both the - // start and the end of the time period defined by - // compare_duration and reference_time. - // - // This field is ignored if `state` is not a field in `group_by`. - google.protobuf.Duration compare_duration = 4; - - // Time used as a reference point when filtering assets. The filter is limited - // to assets existing at the supplied time and their values are those at that - // specific time. Absence of this field will default to the API's version of - // NOW. - google.protobuf.Timestamp read_time = 5; - - // The value returned by the last `GroupAssetsResponse`; indicates - // that this is a continuation of a prior `GroupAssets` call, and that the - // system should return the next page of data. - string page_token = 7; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 8; -} - -// Response message for grouping by assets. -message GroupAssetsResponse { - // Group results. There exists an element for each existing unique - // combination of property/values. The element contains a count for the number - // of times those specific property/values appear. - repeated GroupResult group_by_results = 1; - - // Time used for executing the groupBy request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; -} - -// Request message for grouping by findings. -message GroupFindingsRequest { - // Required. Name of the source to groupBy. Its format is - // "organizations/[organization_id]/sources/[source_id]". To groupBy across - // all sources provide a source_id of `-`. For example: - // organizations/{organization_id}/sources/- - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; - - // Expression that defines the filter to apply across findings. - // The expression is a list of one or more restrictions combined via logical - // operators `AND` and `OR`. - // Parentheses are not supported, and `OR` has higher precedence than `AND`. - // - // Restrictions have the form ` ` and may have a `-` - // character in front of them to indicate negation. Examples include: - // - // * name - // * source_properties.a_property - // * security_marks.marks.marka - // - // 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. - // - // For example, `source_properties.size = 100` is a valid filter string. - string filter = 2; - - // Required. Expression that defines what assets fields to use for grouping (including - // `state`). The string value should follow SQL syntax: comma separated list - // of fields. For example: - // "parent,resource_name". - // - // The following fields are supported: - // - // * resource_name - // * category - // * state - // * parent - string group_by = 3 [(google.api.field_behavior) = REQUIRED]; - - // Time used as a reference point when filtering findings. The filter is - // limited to findings existing at the supplied time and their values are - // those at that specific time. Absence of this field will default to the - // API's version of NOW. - google.protobuf.Timestamp read_time = 4; - - // The value returned by the last `GroupFindingsResponse`; indicates - // that this is a continuation of a prior `GroupFindings` call, and - // that the system should return the next page of data. - string page_token = 5; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 6; -} - -// Response message for group by findings. -message GroupFindingsResponse { - // Group results. There exists an element for each existing unique - // combination of property/values. The element contains a count for the number - // of times those specific property/values appear. - repeated GroupResult group_by_results = 1; - - // Time used for executing the groupBy request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; -} - -// Result containing the properties and count of a groupBy request. -message GroupResult { - // Properties matching the groupBy fields in the request. - map properties = 1; - - // Total count of resources for the given properties. - int64 count = 2; -} - -// Request message for listing sources. -message ListSourcesRequest { - // Required. Resource name of the parent of sources to list. Its format should be - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // The value returned by the last `ListSourcesResponse`; indicates - // that this is a continuation of a prior `ListSources` call, and - // that the system should return the next page of data. - string page_token = 2; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 7; -} - -// Response message for listing sources. -message ListSourcesResponse { - // Sources belonging to the requested parent. - repeated Source sources = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 2; -} - -// Request message for listing assets. -message ListAssetsRequest { - // Required. Name of the organization assets should belong to. Its format is - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // Expression that defines the filter to apply across assets. - // The expression is a list of zero or more restrictions combined via logical - // operators `AND` and `OR`. - // Parentheses are not 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 Asset resource. Examples include: - // - // * name - // * security_center_properties.resource_name - // * resource_properties.a_property - // * security_marks.marks.marka - // - // 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. - // - // For example, `resource_properties.size = 100` is a valid filter string. - string filter = 2; - - // Expression that defines what fields and order to use for sorting. The - // string value should follow SQL syntax: comma separated list of fields. For - // example: "name,resource_properties.a_property". The default sorting order - // is ascending. To specify descending order for a field, a suffix " desc" - // should be appended to the field name. For example: "name - // desc,resource_properties.a_property". Redundant space characters in the - // syntax are insignificant. "name desc,resource_properties.a_property" and " - // name desc , resource_properties.a_property " are equivalent. - string order_by = 3; - - // Time used as a reference point when filtering assets. The filter is limited - // to assets existing at the supplied time and their values are those at that - // specific time. Absence of this field will default to the API's version of - // NOW. - google.protobuf.Timestamp read_time = 4; - - // When compare_duration is set, the ListAssetResult's "state" attribute is - // updated to indicate whether the asset was added, removed, or remained - // present during the compare_duration period of time that precedes the - // read_time. This is the time between (read_time - - // compare_duration) and read_time. - // - // The state value is derived based on the presence of the asset at the two - // points in time. Intermediate state changes between the two times don't - // affect the result. For example, the results aren't affected if the asset is - // removed and re-created again. - // - // Possible "state" values when compare_duration is specified: - // - // * "ADDED": indicates that the asset was not present before - // compare_duration, but present at read_time. - // * "REMOVED": indicates that the asset was present at the start of - // compare_duration, but not present at read_time. - // * "ACTIVE": indicates that the asset was present at both the - // start and the end of the time period defined by - // compare_duration and read_time. - // - // If compare_duration is not specified, then the only possible state is - // "UNUSED", which indicates that the asset is present at read_time. - google.protobuf.Duration compare_duration = 5; - - // Optional. A field mask to specify the ListAssetsResult fields to be listed in the - // response. - // An empty field mask will list all fields. - google.protobuf.FieldMask field_mask = 7 [(google.api.field_behavior) = OPTIONAL]; - - // The value returned by the last `ListAssetsResponse`; indicates - // that this is a continuation of a prior `ListAssets` call, and - // that the system should return the next page of data. - string page_token = 8; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 9; -} - -// Response message for listing assets. -message ListAssetsResponse { - // Result containing the Asset and its State. - message ListAssetsResult { - // State of the asset. - // - // When querying across two points in time this describes - // the change between the two points: ADDED, REMOVED, or ACTIVE. - // If there was no compare_duration supplied in the request the state should - // be: UNUSED - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // Request did not specify use of this field in the result. - UNUSED = 1; - - // Asset was added between the points in time. - ADDED = 2; - - // Asset was removed between the points in time. - REMOVED = 3; - - // Asset was active at both point(s) in time. - ACTIVE = 4; - } - - // Asset matching the search request. - Asset asset = 1; - - // State of the asset. - State state = 2; - } - - // Assets matching the list request. - repeated ListAssetsResult list_assets_results = 1; - - // Time used for executing the list request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of assets matching the query. - int32 total_size = 4; -} - -// Request message for listing findings. -message ListFindingsRequest { - // Required. Name of the source the findings belong to. Its format is - // "organizations/[organization_id]/sources/[source_id]". To list across all - // sources provide a source_id of `-`. For example: - // organizations/{organization_id}/sources/- - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; - - // Expression that defines the filter to apply across findings. - // The expression is a list of one or more restrictions combined via logical - // operators `AND` and `OR`. - // Parentheses are not supported, and `OR` has higher precedence than `AND`. - // - // Restrictions have the form ` ` and may have a `-` - // character in front of them to indicate negation. Examples include: - // - // * name - // * source_properties.a_property - // * security_marks.marks.marka - // - // 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. - // - // For example, `source_properties.size = 100` is a valid filter string. - string filter = 2; - - // Expression that defines what fields and order to use for sorting. The - // string value should follow SQL syntax: comma separated list of fields. For - // example: "name,resource_properties.a_property". The default sorting order - // is ascending. To specify descending order for a field, a suffix " desc" - // should be appended to the field name. For example: "name - // desc,source_properties.a_property". Redundant space characters in the - // syntax are insignificant. "name desc,source_properties.a_property" and " - // name desc , source_properties.a_property " are equivalent. - string order_by = 3; - - // Time used as a reference point when filtering findings. The filter is - // limited to findings existing at the supplied time and their values are - // those at that specific time. Absence of this field will default to the - // API's version of NOW. - google.protobuf.Timestamp read_time = 4; - - // Optional. A field mask to specify the Finding fields to be listed in the response. - // An empty field mask will list all fields. - google.protobuf.FieldMask field_mask = 5 [(google.api.field_behavior) = OPTIONAL]; - - // The value returned by the last `ListFindingsResponse`; indicates - // that this is a continuation of a prior `ListFindings` call, and - // that the system should return the next page of data. - string page_token = 6; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 7; -} - -// Response message for listing findings. -message ListFindingsResponse { - // Findings matching the list request. - repeated Finding findings = 1; - - // Time used for executing the list request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of findings matching the query. - int32 total_size = 4; -} - -// Request message for updating a finding's state. -message SetFindingStateRequest { - // Required. The relative resource name of the finding. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Finding" - } - ]; - - // Required. The desired State of the finding. - Finding.State state = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The time at which the updated state takes effect. - google.protobuf.Timestamp start_time = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for running asset discovery for an organization. -message RunAssetDiscoveryRequest { - // Required. Name of the organization to run asset discovery for. Its format is - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; -} - -// Request message for updating or creating a finding. -message UpdateFindingRequest { - // Required. The finding resource to update or create if it does not already exist. - // parent, security_marks, and update_time will be ignored. - // - // In the case of creation, the finding id portion of the name must - // alphanumeric and less than or equal to 32 characters and greater than 0 - // characters in length. - Finding finding = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the finding resource. This field should - // not be specified when creating a finding. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating an organization's settings. -message UpdateOrganizationSettingsRequest { - // Required. The organization settings resource to update. - OrganizationSettings organization_settings = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the settings resource. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating a source. -message UpdateSourceRequest { - // Required. The source resource to update. - Source source = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the source resource. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating a SecurityMarks resource. -message UpdateSecurityMarksRequest { - // Required. The security marks resource to update. - SecurityMarks security_marks = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the security marks resource. - google.protobuf.FieldMask update_mask = 2; - - // The time at which the updated SecurityMarks take effect. - google.protobuf.Timestamp start_time = 3; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/source.proto b/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/source.proto deleted file mode 100644 index d6fec93631d..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/protos/google/cloud/securitycenter/v1beta1/source.proto +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2020 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1beta1; - -import "google/api/resource.proto"; - -option go_package = "cloud.google.com/go/securitycenter/apiv1beta1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1beta1"; - -// Security Command Center finding source. A finding source -// is an entity or a mechanism that can produce a finding. A source is like a -// container of findings that come from the same scanner, logger, monitor, etc. -message Source { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/Source" - pattern: "organizations/{organization}/sources/{source}" - }; - - // The relative resource name of this source. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/sources/{source_id}" - string name = 1; - - // The source's display name. - // A source's display name must be unique amongst its siblings, for example, - // two sources with the same parent can't share the same display name. - // The display name must have a length between 1 and 64 characters - // (inclusive). - string display_name = 2; - - // The description of the source (max of 1024 characters). - // Example: - // "Web Security Scanner is a web security scanner for common - // vulnerabilities in App Engine applications. It can automatically - // scan and detect four common vulnerabilities, including cross-site-scripting - // (XSS), Flash injection, mixed content (HTTP in HTTPS), and - // outdated/insecure libraries." - string description = 3; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.create_finding.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.create_finding.js deleted file mode 100644 index 4de06256a74..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.create_finding.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, findingId, finding) { - // [START securitycenter_v1beta1_generated_SecurityCenter_CreateFinding_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new finding's parent. Its format should be - * "organizations/[organization_id]/sources/[source_id]". - */ - // const parent = 'abc123' - /** - * Required. Unique identifier provided by the client within the parent scope. - * It must be alphanumeric and less than or equal to 32 characters and - * greater than 0 characters in length. - */ - // const findingId = 'abc123' - /** - * Required. The Finding being created. The name and security_marks will be ignored as - * they are both output only fields on this resource. - */ - // const finding = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateFinding() { - // Construct request - const request = { - parent, - findingId, - finding, - }; - - // Run request - const response = await securitycenterClient.createFinding(request); - console.log(response); - } - - callCreateFinding(); - // [END securitycenter_v1beta1_generated_SecurityCenter_CreateFinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.create_source.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.create_source.js deleted file mode 100644 index 5f7f8ed258c..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.create_source.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, source) { - // [START securitycenter_v1beta1_generated_SecurityCenter_CreateSource_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new source's parent. Its format should be - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - /** - * Required. The Source being created, only the display_name and description will be - * used. All other fields will be ignored. - */ - // const source = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateSource() { - // Construct request - const request = { - parent, - source, - }; - - // Run request - const response = await securitycenterClient.createSource(request); - console.log(response); - } - - callCreateSource(); - // [END securitycenter_v1beta1_generated_SecurityCenter_CreateSource_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_iam_policy.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_iam_policy.js deleted file mode 100644 index 40d4608e605..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_iam_policy.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resource) { - // [START securitycenter_v1beta1_generated_SecurityCenter_GetIamPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - */ - // const options = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await securitycenterClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END securitycenter_v1beta1_generated_SecurityCenter_GetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_organization_settings.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_organization_settings.js deleted file mode 100644 index 5a2f5784f05..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_organization_settings.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1beta1_generated_SecurityCenter_GetOrganizationSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to get organization settings for. Its format is - * "organizations/[organization_id]/organizationSettings". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetOrganizationSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getOrganizationSettings(request); - console.log(response); - } - - callGetOrganizationSettings(); - // [END securitycenter_v1beta1_generated_SecurityCenter_GetOrganizationSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_source.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_source.js deleted file mode 100644 index ffdc4eda51c..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.get_source.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1beta1_generated_SecurityCenter_GetSource_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Relative resource name of the source. Its format is - * "organizations/[organization_id]/source/[source_id]". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetSource() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getSource(request); - console.log(response); - } - - callGetSource(); - // [END securitycenter_v1beta1_generated_SecurityCenter_GetSource_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.group_assets.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.group_assets.js deleted file mode 100644 index eac3b71634f..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.group_assets.js +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, groupBy) { - // [START securitycenter_v1beta1_generated_SecurityCenter_GroupAssets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not 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 Asset resource. Examples include: - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * 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. - * For example, `resource_properties.size = 100` is a valid filter string. - */ - // const filter = 'abc123' - /** - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * The following fields are supported when compare_duration is not set: - * * security_center_properties.resource_project - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * The following fields are supported when compare_duration is set: - * * security_center_properties.resource_type - */ - // const groupBy = 'abc123' - /** - * When compare_duration is set, the Asset's "state" property is updated to - * indicate whether the asset was added, removed, or remained present during - * the compare_duration period of time that precedes the read_time. This is - * the time between (read_time - compare_duration) and read_time. - * The state value is derived based on the presence of the asset at the two - * points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * Possible "state" values when compare_duration is specified: - * * "ADDED": indicates that the asset was not present before - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * This field is ignored if `state` is not a field in `group_by`. - */ - // const compareDuration = {} - /** - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - */ - // const readTime = {} - /** - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGroupAssets() { - // Construct request - const request = { - parent, - groupBy, - }; - - // Run request - const iterable = await securitycenterClient.groupAssetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callGroupAssets(); - // [END securitycenter_v1beta1_generated_SecurityCenter_GroupAssets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.group_findings.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.group_findings.js deleted file mode 100644 index ddcc1f534b0..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.group_findings.js +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, groupBy) { - // [START securitycenter_v1beta1_generated_SecurityCenter_GroupFindings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]". To groupBy across - * all sources provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/- - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * 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. - * For example, `source_properties.size = 100` is a valid filter string. - */ - // const filter = 'abc123' - /** - * Required. Expression that defines what assets fields to use for grouping (including - * `state`). The string value should follow SQL syntax: comma separated list - * of fields. For example: - * "parent,resource_name". - * The following fields are supported: - * * resource_name - * * category - * * state - * * parent - */ - // const groupBy = 'abc123' - /** - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - */ - // const readTime = {} - /** - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGroupFindings() { - // Construct request - const request = { - parent, - groupBy, - }; - - // Run request - const iterable = await securitycenterClient.groupFindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callGroupFindings(); - // [END securitycenter_v1beta1_generated_SecurityCenter_GroupFindings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_assets.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_assets.js deleted file mode 100644 index 8915077aeda..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_assets.js +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1beta1_generated_SecurityCenter_ListAssets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not 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 Asset resource. Examples include: - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * 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. - * For example, `resource_properties.size = 100` is a valid filter string. - */ - // const filter = 'abc123' - /** - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - */ - // const orderBy = 'abc123' - /** - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - */ - // const readTime = {} - /** - * When compare_duration is set, the ListAssetResult's "state" attribute is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - - * compare_duration) and read_time. - * The state value is derived based on the presence of the asset at the two - * points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * Possible "state" values when compare_duration is specified: - * * "ADDED": indicates that the asset was not present before - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * If compare_duration is not specified, then the only possible state is - * "UNUSED", which indicates that the asset is present at read_time. - */ - // const compareDuration = {} - /** - * Optional. A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - */ - // const fieldMask = {} - /** - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListAssets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listAssetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAssets(); - // [END securitycenter_v1beta1_generated_SecurityCenter_ListAssets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_findings.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_findings.js deleted file mode 100644 index 8fc14f840e0..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_findings.js +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1beta1_generated_SecurityCenter_ListFindings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id]". To list across all - * sources provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/- - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * 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. - * For example, `source_properties.size = 100` is a valid filter string. - */ - // const filter = 'abc123' - /** - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - */ - // const orderBy = 'abc123' - /** - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - */ - // const readTime = {} - /** - * Optional. A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - */ - // const fieldMask = {} - /** - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListFindings() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listFindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFindings(); - // [END securitycenter_v1beta1_generated_SecurityCenter_ListFindings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_sources.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_sources.js deleted file mode 100644 index 175607f7e1f..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.list_sources.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1beta1_generated_SecurityCenter_ListSources_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - /** - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListSources() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listSourcesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSources(); - // [END securitycenter_v1beta1_generated_SecurityCenter_ListSources_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.run_asset_discovery.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.run_asset_discovery.js deleted file mode 100644 index 7008016fbf0..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.run_asset_discovery.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to run asset discovery for. Its format is - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callRunAssetDiscovery() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await securitycenterClient.runAssetDiscovery(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRunAssetDiscovery(); - // [END securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.set_finding_state.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.set_finding_state.js deleted file mode 100644 index 14287c126c0..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.set_finding_state.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, state, startTime) { - // [START securitycenter_v1beta1_generated_SecurityCenter_SetFindingState_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the finding. See: - * https://cloud.google.com/apis/design/resource_names#relative_resource_name - * Example: - * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". - */ - // const name = 'abc123' - /** - * Required. The desired State of the finding. - */ - // const state = {} - /** - * Required. The time at which the updated state takes effect. - */ - // const startTime = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callSetFindingState() { - // Construct request - const request = { - name, - state, - startTime, - }; - - // Run request - const response = await securitycenterClient.setFindingState(request); - console.log(response); - } - - callSetFindingState(); - // [END securitycenter_v1beta1_generated_SecurityCenter_SetFindingState_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.set_iam_policy.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.set_iam_policy.js deleted file mode 100644 index 46f44ef33f0..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.set_iam_policy.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resource, policy) { - // [START securitycenter_v1beta1_generated_SecurityCenter_SetIamPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - */ - // const policy = {} - /** - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * `paths: "bindings, etag"` - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await securitycenterClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END securitycenter_v1beta1_generated_SecurityCenter_SetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.test_iam_permissions.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.test_iam_permissions.js deleted file mode 100644 index 8b85e662c11..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.test_iam_permissions.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resource, permissions) { - // [START securitycenter_v1beta1_generated_SecurityCenter_TestIamPermissions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). - */ - // const permissions = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await securitycenterClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END securitycenter_v1beta1_generated_SecurityCenter_TestIamPermissions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_finding.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_finding.js deleted file mode 100644 index 99c4b58a546..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_finding.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(finding) { - // [START securitycenter_v1beta1_generated_SecurityCenter_UpdateFinding_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The finding resource to update or create if it does not already exist. - * parent, security_marks, and update_time will be ignored. - * In the case of creation, the finding id portion of the name must - * alphanumeric and less than or equal to 32 characters and greater than 0 - * characters in length. - */ - // const finding = {} - /** - * The FieldMask to use when updating the finding resource. This field should - * not be specified when creating a finding. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateFinding() { - // Construct request - const request = { - finding, - }; - - // Run request - const response = await securitycenterClient.updateFinding(request); - console.log(response); - } - - callUpdateFinding(); - // [END securitycenter_v1beta1_generated_SecurityCenter_UpdateFinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_organization_settings.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_organization_settings.js deleted file mode 100644 index d48876b5e77..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_organization_settings.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(organizationSettings) { - // [START securitycenter_v1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The organization settings resource to update. - */ - // const organizationSettings = {} - /** - * The FieldMask to use when updating the settings resource. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateOrganizationSettings() { - // Construct request - const request = { - organizationSettings, - }; - - // Run request - const response = await securitycenterClient.updateOrganizationSettings(request); - console.log(response); - } - - callUpdateOrganizationSettings(); - // [END securitycenter_v1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_security_marks.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_security_marks.js deleted file mode 100644 index 4fe37d0989b..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_security_marks.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(securityMarks) { - // [START securitycenter_v1beta1_generated_SecurityCenter_UpdateSecurityMarks_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The security marks resource to update. - */ - // const securityMarks = {} - /** - * The FieldMask to use when updating the security marks resource. - */ - // const updateMask = {} - /** - * The time at which the updated SecurityMarks take effect. - */ - // const startTime = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateSecurityMarks() { - // Construct request - const request = { - securityMarks, - }; - - // Run request - const response = await securitycenterClient.updateSecurityMarks(request); - console.log(response); - } - - callUpdateSecurityMarks(); - // [END securitycenter_v1beta1_generated_SecurityCenter_UpdateSecurityMarks_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_source.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_source.js deleted file mode 100644 index c0f495186cb..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/security_center.update_source.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(source) { - // [START securitycenter_v1beta1_generated_SecurityCenter_UpdateSource_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The source resource to update. - */ - // const source = {} - /** - * The FieldMask to use when updating the source resource. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateSource() { - // Construct request - const request = { - source, - }; - - // Run request - const response = await securitycenterClient.updateSource(request); - console.log(response); - } - - callUpdateSource(); - // [END securitycenter_v1beta1_generated_SecurityCenter_UpdateSource_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json b/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json deleted file mode 100644 index e41fe5b440c..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json +++ /dev/null @@ -1,895 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-securitycenter", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.securitycenter.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_CreateSource_async", - "title": "SecurityCenter createSource Sample", - "origin": "API_DEFINITION", - "description": " Creates a source.", - "canonical": true, - "file": "security_center.create_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSource", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.CreateSource", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "source", - "type": ".google.cloud.securitycenter.v1beta1.Source" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.Source", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateSource", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.CreateSource", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_CreateFinding_async", - "title": "SecurityCenter createFinding Sample", - "origin": "API_DEFINITION", - "description": " Creates a finding. The corresponding source must exist for finding creation to succeed.", - "canonical": true, - "file": "security_center.create_finding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFinding", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.CreateFinding", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "finding_id", - "type": "TYPE_STRING" - }, - { - "name": "finding", - "type": ".google.cloud.securitycenter.v1beta1.Finding" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateFinding", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.CreateFinding", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GetIamPolicy_async", - "title": "SecurityCenter getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the access control policy on the specified Source.", - "canonical": true, - "file": "security_center.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetIamPolicy", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GetOrganizationSettings_async", - "title": "SecurityCenter getOrganizationSettings Sample", - "origin": "API_DEFINITION", - "description": " Gets the settings for an organization.", - "canonical": true, - "file": "security_center.get_organization_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetOrganizationSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.OrganizationSettings", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GetOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetOrganizationSettings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GetSource_async", - "title": "SecurityCenter getSource Sample", - "origin": "API_DEFINITION", - "description": " Gets a source.", - "canonical": true, - "file": "security_center.get_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSource", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetSource", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.Source", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GetSource", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetSource", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GroupAssets_async", - "title": "SecurityCenter groupAssets Sample", - "origin": "API_DEFINITION", - "description": " Filters an organization's assets and groups them by their specified properties.", - "canonical": true, - "file": "security_center.group_assets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 131, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GroupAssets", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GroupAssets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "group_by", - "type": "TYPE_STRING" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.GroupAssetsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GroupAssets", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GroupAssets", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GroupFindings_async", - "title": "SecurityCenter groupFindings Sample", - "origin": "API_DEFINITION", - "description": " Filters an organization or source's findings and groups them by their specified properties. To group across all sources provide a `-` as the source id. Example: /v1beta1/organizations/{organization_id}/sources/-/findings", - "canonical": true, - "file": "security_center.group_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 110, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GroupFindings", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GroupFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "group_by", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.GroupFindingsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GroupFindings", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GroupFindings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_ListAssets_async", - "title": "SecurityCenter listAssets Sample", - "origin": "API_DEFINITION", - "description": " Lists an organization's assets.", - "canonical": true, - "file": "security_center.list_assets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 136, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAssets", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListAssets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "field_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.ListAssetsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "ListAssets", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListAssets", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_ListFindings_async", - "title": "SecurityCenter listFindings Sample", - "origin": "API_DEFINITION", - "description": " Lists an organization or source's findings. To list across all sources provide a `-` as the source id. Example: /v1beta1/organizations/{organization_id}/sources/-/findings", - "canonical": true, - "file": "security_center.list_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 113, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFindings", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "field_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.ListFindingsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "ListFindings", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListFindings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_ListSources_async", - "title": "SecurityCenter listSources Sample", - "origin": "API_DEFINITION", - "description": " Lists all sources belonging to an organization.", - "canonical": true, - "file": "security_center.list_sources.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSources", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListSources", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.ListSourcesResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "ListSources", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListSources", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async", - "title": "SecurityCenter runAssetDiscovery Sample", - "origin": "API_DEFINITION", - "description": " Runs asset discovery. The discovery is tracked with a long-running operation. This API can only be called with limited frequency for an organization. If it is called too frequently the caller will receive a TOO_MANY_REQUESTS error.", - "canonical": true, - "file": "security_center.run_asset_discovery.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RunAssetDiscovery", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.RunAssetDiscovery", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "RunAssetDiscovery", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.RunAssetDiscovery", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_SetFindingState_async", - "title": "SecurityCenter setFindingState Sample", - "origin": "API_DEFINITION", - "description": " Updates the state of a finding.", - "canonical": true, - "file": "security_center.set_finding_state.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetFindingState", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.SetFindingState", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "state", - "type": ".google.cloud.securitycenter.v1beta1.Finding.State" - }, - { - "name": "start_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "SetFindingState", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.SetFindingState", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_SetIamPolicy_async", - "title": "SecurityCenter setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the access control policy on the specified Source.", - "canonical": true, - "file": "security_center.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.SetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "policy", - "type": ".google.iam.v1.Policy" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.SetIamPolicy", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_TestIamPermissions_async", - "title": "SecurityCenter testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Returns the permissions that a caller has on the specified source.", - "canonical": true, - "file": "security_center.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.TestIamPermissions", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_UpdateFinding_async", - "title": "SecurityCenter updateFinding Sample", - "origin": "API_DEFINITION", - "description": " Creates or updates a finding. The corresponding source must exist for a finding creation to succeed.", - "canonical": true, - "file": "security_center.update_finding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFinding", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateFinding", - "async": true, - "parameters": [ - { - "name": "finding", - "type": ".google.cloud.securitycenter.v1beta1.Finding" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateFinding", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateFinding", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async", - "title": "SecurityCenter updateOrganizationSettings Sample", - "origin": "API_DEFINITION", - "description": " Updates an organization's settings.", - "canonical": true, - "file": "security_center.update_organization_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateOrganizationSettings", - "async": true, - "parameters": [ - { - "name": "organization_settings", - "type": ".google.cloud.securitycenter.v1beta1.OrganizationSettings" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.OrganizationSettings", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateOrganizationSettings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_UpdateSource_async", - "title": "SecurityCenter updateSource Sample", - "origin": "API_DEFINITION", - "description": " Updates a source.", - "canonical": true, - "file": "security_center.update_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSource", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateSource", - "async": true, - "parameters": [ - { - "name": "source", - "type": ".google.cloud.securitycenter.v1beta1.Source" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.Source", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateSource", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateSource", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_UpdateSecurityMarks_async", - "title": "SecurityCenter updateSecurityMarks Sample", - "origin": "API_DEFINITION", - "description": " Updates security marks.", - "canonical": true, - "file": "security_center.update_security_marks.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSecurityMarks", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateSecurityMarks", - "async": true, - "parameters": [ - { - "name": "security_marks", - "type": ".google.cloud.securitycenter.v1beta1.SecurityMarks" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "start_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.SecurityMarks", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateSecurityMarks", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateSecurityMarks", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/index.ts b/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/index.ts deleted file mode 100644 index 0efca2458d0..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1beta1 from './v1beta1'; -const SecurityCenterClient = v1beta1.SecurityCenterClient; -type SecurityCenterClient = v1beta1.SecurityCenterClient; -export {v1beta1, SecurityCenterClient}; -export default {v1beta1, SecurityCenterClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/gapic_metadata.json deleted file mode 100644 index 02da4303dc4..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/gapic_metadata.json +++ /dev/null @@ -1,223 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.securitycenter.v1beta1", - "libraryPackage": "@google-cloud/security-center", - "services": { - "SecurityCenter": { - "clients": { - "grpc": { - "libraryClient": "SecurityCenterClient", - "rpcs": { - "CreateSource": { - "methods": [ - "createSource" - ] - }, - "CreateFinding": { - "methods": [ - "createFinding" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "GetOrganizationSettings": { - "methods": [ - "getOrganizationSettings" - ] - }, - "GetSource": { - "methods": [ - "getSource" - ] - }, - "SetFindingState": { - "methods": [ - "setFindingState" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "UpdateFinding": { - "methods": [ - "updateFinding" - ] - }, - "UpdateOrganizationSettings": { - "methods": [ - "updateOrganizationSettings" - ] - }, - "UpdateSource": { - "methods": [ - "updateSource" - ] - }, - "UpdateSecurityMarks": { - "methods": [ - "updateSecurityMarks" - ] - }, - "RunAssetDiscovery": { - "methods": [ - "runAssetDiscovery" - ] - }, - "GroupAssets": { - "methods": [ - "groupAssets", - "groupAssetsStream", - "groupAssetsAsync" - ] - }, - "GroupFindings": { - "methods": [ - "groupFindings", - "groupFindingsStream", - "groupFindingsAsync" - ] - }, - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - }, - "ListSources": { - "methods": [ - "listSources", - "listSourcesStream", - "listSourcesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SecurityCenterClient", - "rpcs": { - "CreateSource": { - "methods": [ - "createSource" - ] - }, - "CreateFinding": { - "methods": [ - "createFinding" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "GetOrganizationSettings": { - "methods": [ - "getOrganizationSettings" - ] - }, - "GetSource": { - "methods": [ - "getSource" - ] - }, - "SetFindingState": { - "methods": [ - "setFindingState" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "UpdateFinding": { - "methods": [ - "updateFinding" - ] - }, - "UpdateOrganizationSettings": { - "methods": [ - "updateOrganizationSettings" - ] - }, - "UpdateSource": { - "methods": [ - "updateSource" - ] - }, - "UpdateSecurityMarks": { - "methods": [ - "updateSecurityMarks" - ] - }, - "RunAssetDiscovery": { - "methods": [ - "runAssetDiscovery" - ] - }, - "GroupAssets": { - "methods": [ - "groupAssets", - "groupAssetsStream", - "groupAssetsAsync" - ] - }, - "GroupFindings": { - "methods": [ - "groupFindings", - "groupFindingsStream", - "groupFindingsAsync" - ] - }, - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - }, - "ListSources": { - "methods": [ - "listSources", - "listSourcesStream", - "listSourcesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/index.ts deleted file mode 100644 index fa3996e6154..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {SecurityCenterClient} from './security_center_client'; diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_client.ts b/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_client.ts deleted file mode 100644 index 321cd279d9d..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_client.ts +++ /dev/null @@ -1,3268 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/security_center_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './security_center_client_config.json'; -const version = require('../../../package.json').version; - -/** - * V1 Beta APIs for Security Center service. - * @class - * @memberof v1beta1 - */ -export class SecurityCenterClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - securityCenterStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SecurityCenterClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SecurityCenterClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SecurityCenterClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - assetPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/assets/{asset}' - ), - findingPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}/findings/{finding}' - ), - organizationPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}' - ), - organizationAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/assets/{asset}/securityMarks' - ), - organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/organizationSettings' - ), - organizationSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks' - ), - sourcePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - groupAssets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), - groupFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), - listAssets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listAssetsResults'), - listFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings'), - listSources: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sources') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=organizations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=organizations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=organizations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/{name=organizations/*/operations}',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const runAssetDiscoveryResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const runAssetDiscoveryMetadata = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - - this.descriptors.longrunning = { - runAssetDiscovery: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - runAssetDiscoveryResponse.decode.bind(runAssetDiscoveryResponse), - runAssetDiscoveryMetadata.decode.bind(runAssetDiscoveryMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.securitycenter.v1beta1.SecurityCenter', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.securityCenterStub) { - return this.securityCenterStub; - } - - // Put together the "service stub" for - // google.cloud.securitycenter.v1beta1.SecurityCenter. - this.securityCenterStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.securitycenter.v1beta1.SecurityCenter') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.securitycenter.v1beta1.SecurityCenter, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const securityCenterStubMethods = - ['createSource', 'createFinding', 'getIamPolicy', 'getOrganizationSettings', 'getSource', 'groupAssets', 'groupFindings', 'listAssets', 'listFindings', 'listSources', 'runAssetDiscovery', 'setFindingState', 'setIamPolicy', 'testIamPermissions', 'updateFinding', 'updateOrganizationSettings', 'updateSource', 'updateSecurityMarks']; - for (const methodName of securityCenterStubMethods) { - const callPromise = this.securityCenterStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.securityCenterStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'securitycenter.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'securitycenter.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new source's parent. Its format should be - * "organizations/[organization_id]". - * @param {google.cloud.securitycenter.v1beta1.Source} request.source - * Required. The Source being created, only the display_name and description will be - * used. All other fields will be ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1beta1.Source | Source}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.create_source.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_CreateSource_async - */ - createSource( - request?: protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|undefined, {}|undefined - ]>; - createSource( - request: protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|null|undefined, - {}|null|undefined>): void; - createSource( - request: protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|null|undefined, - {}|null|undefined>): void; - createSource( - request?: protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createSource(request, options, callback); - } -/** - * Creates a finding. The corresponding source must exist for finding creation - * to succeed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new finding's parent. Its format should be - * "organizations/[organization_id]/sources/[source_id]". - * @param {string} request.findingId - * Required. Unique identifier provided by the client within the parent scope. - * It must be alphanumeric and less than or equal to 32 characters and - * greater than 0 characters in length. - * @param {google.cloud.securitycenter.v1beta1.Finding} request.finding - * Required. The Finding being created. The name and security_marks will be ignored as - * they are both output only fields on this resource. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1beta1.Finding | Finding}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.create_finding.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_CreateFinding_async - */ - createFinding( - request?: protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|undefined, {}|undefined - ]>; - createFinding( - request: protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|null|undefined, - {}|null|undefined>): void; - createFinding( - request: protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|null|undefined, - {}|null|undefined>): void; - createFinding( - request?: protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createFinding(request, options, callback); - } -/** - * Gets the access control policy on the specified Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.get_iam_policy.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GetIamPolicy_async - */ - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize(); - return this.innerApiCalls.getIamPolicy(request, options, callback); - } -/** - * Gets the settings for an organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the organization to get organization settings for. Its format is - * "organizations/[organization_id]/organizationSettings". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1beta1.OrganizationSettings | OrganizationSettings}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.get_organization_settings.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GetOrganizationSettings_async - */ - getOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|undefined, {}|undefined - ]>; - getOrganizationSettings( - request: protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - getOrganizationSettings( - request: protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - getOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getOrganizationSettings(request, options, callback); - } -/** - * Gets a source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Relative resource name of the source. Its format is - * "organizations/[organization_id]/source/[source_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1beta1.Source | Source}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.get_source.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GetSource_async - */ - getSource( - request?: protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|undefined, {}|undefined - ]>; - getSource( - request: protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|null|undefined, - {}|null|undefined>): void; - getSource( - request: protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|null|undefined, - {}|null|undefined>): void; - getSource( - request?: protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getSource(request, options, callback); - } -/** - * Updates the state of a finding. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the finding. See: - * https://cloud.google.com/apis/design/resource_names#relative_resource_name - * Example: - * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". - * @param {google.cloud.securitycenter.v1beta1.Finding.State} request.state - * Required. The desired State of the finding. - * @param {google.protobuf.Timestamp} request.startTime - * Required. The time at which the updated state takes effect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1beta1.Finding | Finding}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.set_finding_state.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_SetFindingState_async - */ - setFindingState( - request?: protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|undefined, {}|undefined - ]>; - setFindingState( - request: protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>): void; - setFindingState( - request: protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>): void; - setFindingState( - request?: protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.setFindingState(request, options, callback); - } -/** - * Sets the access control policy on the specified Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.Policy} request.policy - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param {google.protobuf.FieldMask} request.updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.set_iam_policy.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_SetIamPolicy_async - */ - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize(); - return this.innerApiCalls.setIamPolicy(request, options, callback); - } -/** - * Returns the permissions that a caller has on the specified source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.test_iam_permissions.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_TestIamPermissions_async - */ - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize(); - return this.innerApiCalls.testIamPermissions(request, options, callback); - } -/** - * Creates or updates a finding. The corresponding source must exist for a - * finding creation to succeed. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1beta1.Finding} request.finding - * Required. The finding resource to update or create if it does not already exist. - * parent, security_marks, and update_time will be ignored. - * - * In the case of creation, the finding id portion of the name must - * alphanumeric and less than or equal to 32 characters and greater than 0 - * characters in length. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the finding resource. This field should - * not be specified when creating a finding. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1beta1.Finding | Finding}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.update_finding.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_UpdateFinding_async - */ - updateFinding( - request?: protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|undefined, {}|undefined - ]>; - updateFinding( - request: protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>): void; - updateFinding( - request: protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>): void; - updateFinding( - request?: protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'finding.name': request.finding!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFinding(request, options, callback); - } -/** - * Updates an organization's settings. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1beta1.OrganizationSettings} request.organizationSettings - * Required. The organization settings resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the settings resource. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1beta1.OrganizationSettings | OrganizationSettings}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.update_organization_settings.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async - */ - updateOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|undefined, {}|undefined - ]>; - updateOrganizationSettings( - request: protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateOrganizationSettings( - request: protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'organization_settings.name': request.organizationSettings!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateOrganizationSettings(request, options, callback); - } -/** - * Updates a source. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1beta1.Source} request.source - * Required. The source resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the source resource. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1beta1.Source | Source}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.update_source.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_UpdateSource_async - */ - updateSource( - request?: protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|undefined, {}|undefined - ]>; - updateSource( - request: protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>): void; - updateSource( - request: protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>): void; - updateSource( - request?: protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'source.name': request.source!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSource(request, options, callback); - } -/** - * Updates security marks. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1beta1.SecurityMarks} request.securityMarks - * Required. The security marks resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the security marks resource. - * @param {google.protobuf.Timestamp} request.startTime - * The time at which the updated SecurityMarks take effect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1beta1.SecurityMarks | SecurityMarks}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.update_security_marks.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_UpdateSecurityMarks_async - */ - updateSecurityMarks( - request?: protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|undefined, {}|undefined - ]>; - updateSecurityMarks( - request: protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>): void; - updateSecurityMarks( - request: protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>): void; - updateSecurityMarks( - request?: protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'security_marks.name': request.securityMarks!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSecurityMarks(request, options, callback); - } - -/** - * Runs asset discovery. The discovery is tracked with a long-running - * operation. - * - * This API can only be called with limited frequency for an organization. If - * it is called too frequently the caller will receive a TOO_MANY_REQUESTS - * error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to run asset discovery for. Its format is - * "organizations/[organization_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.run_asset_discovery.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async - */ - runAssetDiscovery( - request?: protos.google.cloud.securitycenter.v1beta1.IRunAssetDiscoveryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - runAssetDiscovery( - request: protos.google.cloud.securitycenter.v1beta1.IRunAssetDiscoveryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runAssetDiscovery( - request: protos.google.cloud.securitycenter.v1beta1.IRunAssetDiscoveryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runAssetDiscovery( - request?: protos.google.cloud.securitycenter.v1beta1.IRunAssetDiscoveryRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.runAssetDiscovery(request, options, callback); - } -/** - * Check the status of the long running operation returned by `runAssetDiscovery()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.run_asset_discovery.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async - */ - async checkRunAssetDiscoveryProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runAssetDiscovery, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Filters an organization's assets and groups them by their specified - * properties. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not 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 Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * For example, `resource_properties.size = 100` is a valid filter string. - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * - * The following fields are supported when compare_duration is not set: - * - * * security_center_properties.resource_project - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * - * The following fields are supported when compare_duration is set: - * - * * security_center_properties.resource_type - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the Asset's "state" property is updated to - * indicate whether the asset was added, removed, or remained present during - * the compare_duration period of time that precedes the read_time. This is - * the time between (read_time - compare_duration) and read_time. - * - * The state value is derived based on the presence of the asset at the two - * points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present before - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * - * This field is ignored if `state` is not a field in `group_by`. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1beta1.GroupResult | GroupResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `groupAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - groupAssets( - request?: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IGroupResult[], - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest|null, - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse - ]>; - groupAssets( - request: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IGroupResult>): void; - groupAssets( - request: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IGroupResult>): void; - groupAssets( - request?: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IGroupResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IGroupResult>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IGroupResult[], - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest|null, - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.groupAssets(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not 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 Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * For example, `resource_properties.size = 100` is a valid filter string. - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * - * The following fields are supported when compare_duration is not set: - * - * * security_center_properties.resource_project - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * - * The following fields are supported when compare_duration is set: - * - * * security_center_properties.resource_type - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the Asset's "state" property is updated to - * indicate whether the asset was added, removed, or remained present during - * the compare_duration period of time that precedes the read_time. This is - * the time between (read_time - compare_duration) and read_time. - * - * The state value is derived based on the presence of the asset at the two - * points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present before - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * - * This field is ignored if `state` is not a field in `group_by`. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1beta1.GroupResult | GroupResult} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `groupAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - groupAssetsStream( - request?: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['groupAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupAssets.createStream( - this.innerApiCalls.groupAssets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `groupAssets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not 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 Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * For example, `resource_properties.size = 100` is a valid filter string. - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * - * The following fields are supported when compare_duration is not set: - * - * * security_center_properties.resource_project - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * - * The following fields are supported when compare_duration is set: - * - * * security_center_properties.resource_type - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the Asset's "state" property is updated to - * indicate whether the asset was added, removed, or remained present during - * the compare_duration period of time that precedes the read_time. This is - * the time between (read_time - compare_duration) and read_time. - * - * The state value is derived based on the presence of the asset at the two - * points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present before - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * - * This field is ignored if `state` is not a field in `group_by`. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1beta1.GroupResult | GroupResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.group_assets.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GroupAssets_async - */ - groupAssetsAsync( - request?: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['groupAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupAssets.asyncIterate( - this.innerApiCalls['groupAssets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Filters an organization or source's findings and groups them by their - * specified properties. - * - * To group across all sources provide a `-` as the source id. - * Example: /v1beta1/organizations/{organization_id}/sources/-/findings - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]". To groupBy across - * all sources provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * For example, `source_properties.size = 100` is a valid filter string. - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping (including - * `state`). The string value should follow SQL syntax: comma separated list - * of fields. For example: - * "parent,resource_name". - * - * The following fields are supported: - * - * * resource_name - * * category - * * state - * * parent - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1beta1.GroupResult | GroupResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `groupFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - groupFindings( - request?: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IGroupResult[], - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest|null, - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse - ]>; - groupFindings( - request: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IGroupResult>): void; - groupFindings( - request: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IGroupResult>): void; - groupFindings( - request?: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IGroupResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IGroupResult>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IGroupResult[], - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest|null, - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.groupFindings(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]". To groupBy across - * all sources provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * For example, `source_properties.size = 100` is a valid filter string. - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping (including - * `state`). The string value should follow SQL syntax: comma separated list - * of fields. For example: - * "parent,resource_name". - * - * The following fields are supported: - * - * * resource_name - * * category - * * state - * * parent - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1beta1.GroupResult | GroupResult} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `groupFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - groupFindingsStream( - request?: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['groupFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupFindings.createStream( - this.innerApiCalls.groupFindings as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `groupFindings`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]". To groupBy across - * all sources provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * For example, `source_properties.size = 100` is a valid filter string. - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping (including - * `state`). The string value should follow SQL syntax: comma separated list - * of fields. For example: - * "parent,resource_name". - * - * The following fields are supported: - * - * * resource_name - * * category - * * state - * * parent - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1beta1.GroupResult | GroupResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.group_findings.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GroupFindings_async - */ - groupFindingsAsync( - request?: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['groupFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupFindings.asyncIterate( - this.innerApiCalls['groupFindings'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists an organization's assets. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not 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 Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * For example, `resource_properties.size = 100` is a valid filter string. - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListAssetResult's "state" attribute is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - - * compare_duration) and read_time. - * - * The state value is derived based on the presence of the asset at the two - * points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present before - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * - * If compare_duration is not specified, then the only possible state is - * "UNUSED", which indicates that the asset is present at read_time. - * @param {google.protobuf.FieldMask} [request.fieldMask] - * Optional. A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult | ListAssetsResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAssets( - request?: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[], - protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest|null, - protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse - ]>; - listAssets( - request: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult>): void; - listAssets( - request: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult>): void; - listAssets( - request?: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[], - protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest|null, - protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listAssets(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not 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 Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * For example, `resource_properties.size = 100` is a valid filter string. - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListAssetResult's "state" attribute is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - - * compare_duration) and read_time. - * - * The state value is derived based on the presence of the asset at the two - * points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present before - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * - * If compare_duration is not specified, then the only possible state is - * "UNUSED", which indicates that the asset is present at read_time. - * @param {google.protobuf.FieldMask} [request.fieldMask] - * Optional. A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult | ListAssetsResult} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAssetsStream( - request?: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssets.createStream( - this.innerApiCalls.listAssets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAssets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not 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 Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * For example, `resource_properties.size = 100` is a valid filter string. - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListAssetResult's "state" attribute is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - - * compare_duration) and read_time. - * - * The state value is derived based on the presence of the asset at the two - * points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present before - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * - * If compare_duration is not specified, then the only possible state is - * "UNUSED", which indicates that the asset is present at read_time. - * @param {google.protobuf.FieldMask} [request.fieldMask] - * Optional. A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult | ListAssetsResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.list_assets.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_ListAssets_async - */ - listAssetsAsync( - request?: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssets.asyncIterate( - this.innerApiCalls['listAssets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists an organization or source's findings. - * - * To list across all sources provide a `-` as the source id. - * Example: /v1beta1/organizations/{organization_id}/sources/-/findings - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id]". To list across all - * sources provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * For example, `source_properties.size = 100` is a valid filter string. - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.FieldMask} [request.fieldMask] - * Optional. A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1beta1.Finding | Finding}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listFindings( - request?: protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IFinding[], - protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest|null, - protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse - ]>; - listFindings( - request: protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IFinding>): void; - listFindings( - request: protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IFinding>): void; - listFindings( - request?: protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IFinding>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IFinding>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IFinding[], - protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest|null, - protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listFindings(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id]". To list across all - * sources provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * For example, `source_properties.size = 100` is a valid filter string. - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.FieldMask} [request.fieldMask] - * Optional. A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1beta1.Finding | Finding} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listFindingsStream( - request?: protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFindings.createStream( - this.innerApiCalls.listFindings as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFindings`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id]". To list across all - * sources provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * For example, `source_properties.size = 100` is a valid filter string. - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.FieldMask} [request.fieldMask] - * Optional. A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1beta1.Finding | Finding}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.list_findings.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_ListFindings_async - */ - listFindingsAsync( - request?: protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFindings.asyncIterate( - this.innerApiCalls['listFindings'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all sources belonging to an organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id]". - * @param {string} request.pageToken - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1beta1.Source | Source}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSourcesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listSources( - request?: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISource[], - protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest|null, - protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse - ]>; - listSources( - request: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.ISource>): void; - listSources( - request: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.ISource>): void; - listSources( - request?: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.ISource>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.ISource>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISource[], - protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest|null, - protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listSources(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id]". - * @param {string} request.pageToken - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1beta1.Source | Source} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSourcesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listSourcesStream( - request?: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSources.createStream( - this.innerApiCalls.listSources as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSources`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id]". - * @param {string} request.pageToken - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1beta1.Source | Source}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.list_sources.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_ListSources_async - */ - listSourcesAsync( - request?: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSources.asyncIterate( - this.innerApiCalls['listSources'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified asset resource name string. - * - * @param {string} organization - * @param {string} asset - * @returns {string} Resource name string. - */ - assetPath(organization:string,asset:string) { - return this.pathTemplates.assetPathTemplate.render({ - organization: organization, - asset: asset, - }); - } - - /** - * Parse the organization from Asset resource. - * - * @param {string} assetName - * A fully-qualified path representing Asset resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromAssetName(assetName: string) { - return this.pathTemplates.assetPathTemplate.match(assetName).organization; - } - - /** - * Parse the asset from Asset resource. - * - * @param {string} assetName - * A fully-qualified path representing Asset resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromAssetName(assetName: string) { - return this.pathTemplates.assetPathTemplate.match(assetName).asset; - } - - /** - * Return a fully-qualified finding resource name string. - * - * @param {string} organization - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - findingPath(organization:string,source:string,finding:string) { - return this.pathTemplates.findingPathTemplate.render({ - organization: organization, - source: source, - finding: finding, - }); - } - - /** - * Parse the organization from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).organization; - } - - /** - * Parse the source from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the source. - */ - matchSourceFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).source; - } - - /** - * Parse the finding from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).finding; - } - - /** - * Return a fully-qualified organization resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationPath(organization:string) { - return this.pathTemplates.organizationPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from Organization resource. - * - * @param {string} organizationName - * A fully-qualified path representing Organization resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationName(organizationName: string) { - return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; - } - - /** - * Return a fully-qualified organizationAssetSecurityMarks resource name string. - * - * @param {string} organization - * @param {string} asset - * @returns {string} Resource name string. - */ - organizationAssetSecurityMarksPath(organization:string,asset:string) { - return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.render({ - organization: organization, - asset: asset, - }); - } - - /** - * Parse the organization from OrganizationAssetSecurityMarks resource. - * - * @param {string} organizationAssetSecurityMarksName - * A fully-qualified path representing organization_asset_securityMarks resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { - return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).organization; - } - - /** - * Parse the asset from OrganizationAssetSecurityMarks resource. - * - * @param {string} organizationAssetSecurityMarksName - * A fully-qualified path representing organization_asset_securityMarks resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { - return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).asset; - } - - /** - * Return a fully-qualified organizationSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSettingsPath(organization:string) { - return this.pathTemplates.organizationSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSettings resource. - * - * @param {string} organizationSettingsName - * A fully-qualified path representing OrganizationSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { - return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSourceFindingSecurityMarks resource name string. - * - * @param {string} organization - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - organizationSourceFindingSecurityMarksPath(organization:string,source:string,finding:string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render({ - organization: organization, - source: source, - finding: finding, - }); - } - - /** - * Parse the organization from OrganizationSourceFindingSecurityMarks resource. - * - * @param {string} organizationSourceFindingSecurityMarksName - * A fully-qualified path representing organization_source_finding_securityMarks resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).organization; - } - - /** - * Parse the source from OrganizationSourceFindingSecurityMarks resource. - * - * @param {string} organizationSourceFindingSecurityMarksName - * A fully-qualified path representing organization_source_finding_securityMarks resource. - * @returns {string} A string representing the source. - */ - matchSourceFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).source; - } - - /** - * Parse the finding from OrganizationSourceFindingSecurityMarks resource. - * - * @param {string} organizationSourceFindingSecurityMarksName - * A fully-qualified path representing organization_source_finding_securityMarks resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).finding; - } - - /** - * Return a fully-qualified source resource name string. - * - * @param {string} organization - * @param {string} source - * @returns {string} Resource name string. - */ - sourcePath(organization:string,source:string) { - return this.pathTemplates.sourcePathTemplate.render({ - organization: organization, - source: source, - }); - } - - /** - * Parse the organization from Source resource. - * - * @param {string} sourceName - * A fully-qualified path representing Source resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromSourceName(sourceName: string) { - return this.pathTemplates.sourcePathTemplate.match(sourceName).organization; - } - - /** - * Parse the source from Source resource. - * - * @param {string} sourceName - * A fully-qualified path representing Source resource. - * @returns {string} A string representing the source. - */ - matchSourceFromSourceName(sourceName: string) { - return this.pathTemplates.sourcePathTemplate.match(sourceName).source; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.securityCenterStub && !this._terminated) { - return this.securityCenterStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_client_config.json b/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_client_config.json deleted file mode 100644 index a1a7e2d9386..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_client_config.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "interfaces": { - "google.cloud.securitycenter.v1beta1.SecurityCenter": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateSource": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateFinding": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetOrganizationSettings": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetSource": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GroupAssets": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GroupFindings": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListAssets": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFindings": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListSources": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "RunAssetDiscovery": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetFindingState": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "TestIamPermissions": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateFinding": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateOrganizationSettings": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSource": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSecurityMarks": { - "timeout_millis": 480000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_proto_list.json b/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_proto_list.json deleted file mode 100644 index d10dce6c60d..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/src/v1beta1/security_center_proto_list.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../protos/google/cloud/securitycenter/v1beta1/asset.proto", - "../../protos/google/cloud/securitycenter/v1beta1/finding.proto", - "../../protos/google/cloud/securitycenter/v1beta1/organization_settings.proto", - "../../protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto", - "../../protos/google/cloud/securitycenter/v1beta1/security_marks.proto", - "../../protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto", - "../../protos/google/cloud/securitycenter/v1beta1/source.proto" -] diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index ca4c3d3425f..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const securitycenter = require('@google-cloud/security-center'); - -function main() { - const securityCenterClient = new securitycenter.SecurityCenterClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 323502f7e2f..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {SecurityCenterClient} from '@google-cloud/security-center'; - -// check that the client class type name can be used -function doStuffWithSecurityCenterClient(client: SecurityCenterClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const securityCenterClient = new SecurityCenterClient(); - doStuffWithSecurityCenterClient(securityCenterClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/test/gapic_security_center_v1beta1.ts b/owl-bot-staging/google-cloud-securitycenter/v1beta1/test/gapic_security_center_v1beta1.ts deleted file mode 100644 index f71f54bd9bc..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/test/gapic_security_center_v1beta1.ts +++ /dev/null @@ -1,3173 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as securitycenterModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.SecurityCenterClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = securitycenterModule.v1beta1.SecurityCenterClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = securitycenterModule.v1beta1.SecurityCenterClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = securitycenterModule.v1beta1.SecurityCenterClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.securityCenterStub, undefined); - await client.initialize(); - assert(client.securityCenterStub); - }); - - it('has close method for the initialized client', done => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.securityCenterStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.securityCenterStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createSource', () => { - it('invokes createSource without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.Source() - ); - client.innerApiCalls.createSource = stubSimpleCall(expectedResponse); - const [response] = await client.createSource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSource without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.Source() - ); - client.innerApiCalls.createSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSource( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSource with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSource(request), expectedError); - const actualRequest = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSource with closed client', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createSource(request), expectedError); - }); - }); - - describe('createFinding', () => { - it('invokes createFinding without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.CreateFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.CreateFindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.Finding() - ); - client.innerApiCalls.createFinding = stubSimpleCall(expectedResponse); - const [response] = await client.createFinding(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFinding without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.CreateFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.CreateFindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.Finding() - ); - client.innerApiCalls.createFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFinding( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFinding with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.CreateFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.CreateFindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createFinding(request), expectedError); - const actualRequest = (client.innerApiCalls.createFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFinding with closed client', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.CreateFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.CreateFindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createFinding(request), expectedError); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with closed client', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getIamPolicy(request), expectedError); - }); - }); - - describe('getOrganizationSettings', () => { - it('invokes getOrganizationSettings without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.OrganizationSettings() - ); - client.innerApiCalls.getOrganizationSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getOrganizationSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOrganizationSettings without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.OrganizationSettings() - ); - client.innerApiCalls.getOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getOrganizationSettings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOrganizationSettings with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getOrganizationSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getOrganizationSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOrganizationSettings with closed client', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getOrganizationSettings(request), expectedError); - }); - }); - - describe('getSource', () => { - it('invokes getSource without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.Source() - ); - client.innerApiCalls.getSource = stubSimpleCall(expectedResponse); - const [response] = await client.getSource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSource without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.Source() - ); - client.innerApiCalls.getSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSource( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSource with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSource(request), expectedError); - const actualRequest = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSource with closed client', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSource(request), expectedError); - }); - }); - - describe('setFindingState', () => { - it('invokes setFindingState without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.SetFindingStateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.SetFindingStateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.Finding() - ); - client.innerApiCalls.setFindingState = stubSimpleCall(expectedResponse); - const [response] = await client.setFindingState(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setFindingState without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.SetFindingStateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.SetFindingStateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.Finding() - ); - client.innerApiCalls.setFindingState = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setFindingState( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setFindingState with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.SetFindingStateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.SetFindingStateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setFindingState = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setFindingState(request), expectedError); - const actualRequest = (client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setFindingState with closed client', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.SetFindingStateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.SetFindingStateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setFindingState(request), expectedError); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy with closed client', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setIamPolicy(request), expectedError); - }); - }); - - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); - const [response] = await client.testIamPermissions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request), expectedError); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions with closed client', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.testIamPermissions(request), expectedError); - }); - }); - - describe('updateFinding', () => { - it('invokes updateFinding without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.UpdateFindingRequest() - ); - request.finding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateFindingRequest', ['finding', 'name']); - request.finding.name = defaultValue1; - const expectedHeaderRequestParams = `finding.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.Finding() - ); - client.innerApiCalls.updateFinding = stubSimpleCall(expectedResponse); - const [response] = await client.updateFinding(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFinding without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.UpdateFindingRequest() - ); - request.finding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateFindingRequest', ['finding', 'name']); - request.finding.name = defaultValue1; - const expectedHeaderRequestParams = `finding.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.Finding() - ); - client.innerApiCalls.updateFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFinding( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFinding with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.UpdateFindingRequest() - ); - request.finding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateFindingRequest', ['finding', 'name']); - request.finding.name = defaultValue1; - const expectedHeaderRequestParams = `finding.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateFinding(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFinding with closed client', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.UpdateFindingRequest() - ); - request.finding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateFindingRequest', ['finding', 'name']); - request.finding.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateFinding(request), expectedError); - }); - }); - - describe('updateOrganizationSettings', () => { - it('invokes updateOrganizationSettings without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest() - ); - request.organizationSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); - request.organizationSettings.name = defaultValue1; - const expectedHeaderRequestParams = `organization_settings.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.OrganizationSettings() - ); - client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateOrganizationSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateOrganizationSettings without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest() - ); - request.organizationSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); - request.organizationSettings.name = defaultValue1; - const expectedHeaderRequestParams = `organization_settings.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.OrganizationSettings() - ); - client.innerApiCalls.updateOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateOrganizationSettings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateOrganizationSettings with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest() - ); - request.organizationSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); - request.organizationSettings.name = defaultValue1; - const expectedHeaderRequestParams = `organization_settings.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateOrganizationSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateOrganizationSettings with closed client', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest() - ); - request.organizationSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); - request.organizationSettings.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateOrganizationSettings(request), expectedError); - }); - }); - - describe('updateSource', () => { - it('invokes updateSource without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedHeaderRequestParams = `source.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.Source() - ); - client.innerApiCalls.updateSource = stubSimpleCall(expectedResponse); - const [response] = await client.updateSource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSource without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedHeaderRequestParams = `source.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.Source() - ); - client.innerApiCalls.updateSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSource( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSource with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedHeaderRequestParams = `source.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSource(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSource with closed client', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSource(request), expectedError); - }); - }); - - describe('updateSecurityMarks', () => { - it('invokes updateSecurityMarks without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest() - ); - request.securityMarks ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); - request.securityMarks.name = defaultValue1; - const expectedHeaderRequestParams = `security_marks.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.SecurityMarks() - ); - client.innerApiCalls.updateSecurityMarks = stubSimpleCall(expectedResponse); - const [response] = await client.updateSecurityMarks(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSecurityMarks without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest() - ); - request.securityMarks ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); - request.securityMarks.name = defaultValue1; - const expectedHeaderRequestParams = `security_marks.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.SecurityMarks() - ); - client.innerApiCalls.updateSecurityMarks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSecurityMarks( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISecurityMarks|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSecurityMarks with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest() - ); - request.securityMarks ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); - request.securityMarks.name = defaultValue1; - const expectedHeaderRequestParams = `security_marks.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSecurityMarks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSecurityMarks(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSecurityMarks with closed client', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest() - ); - request.securityMarks ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); - request.securityMarks.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSecurityMarks(request), expectedError); - }); - }); - - describe('runAssetDiscovery', () => { - it('invokes runAssetDiscovery without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(expectedResponse); - const [operation] = await client.runAssetDiscovery(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runAssetDiscovery without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runAssetDiscovery( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runAssetDiscovery with call error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.runAssetDiscovery(request), expectedError); - const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runAssetDiscovery with LRO error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.runAssetDiscovery(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRunAssetDiscoveryProgress without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRunAssetDiscoveryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRunAssetDiscoveryProgress with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRunAssetDiscoveryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('groupAssets', () => { - it('invokes groupAssets without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - ]; - client.innerApiCalls.groupAssets = stubSimpleCall(expectedResponse); - const [response] = await client.groupAssets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes groupAssets without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - ]; - client.innerApiCalls.groupAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.groupAssets( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IGroupResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes groupAssets with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.groupAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.groupAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes groupAssetsStream without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - ]; - client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.groupAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.GroupResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); - assert( - (client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes groupAssetsStream with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.groupAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.GroupResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); - assert( - (client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with groupAssets without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - ]; - client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1beta1.IGroupResult[] = []; - const iterable = client.groupAssetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with groupAssets with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.groupAssetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1beta1.IGroupResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('groupFindings', () => { - it('invokes groupFindings without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - ]; - client.innerApiCalls.groupFindings = stubSimpleCall(expectedResponse); - const [response] = await client.groupFindings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes groupFindings without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - ]; - client.innerApiCalls.groupFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.groupFindings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IGroupResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes groupFindings with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.groupFindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.groupFindings(request), expectedError); - const actualRequest = (client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes groupFindingsStream without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - ]; - client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.groupFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.GroupResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); - assert( - (client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes groupFindingsStream with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.groupFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.GroupResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); - assert( - (client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with groupFindings without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - ]; - client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1beta1.IGroupResult[] = []; - const iterable = client.groupFindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with groupFindings with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.groupFindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1beta1.IGroupResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listAssets', () => { - it('invokes listAssets without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - ]; - client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); - const [response] = await client.listAssets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssets without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - ]; - client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAssets( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssets with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssetsStream without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - ]; - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAssetsStream with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAssets without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - ]; - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[] = []; - const iterable = client.listAssetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAssets with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAssetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listFindings', () => { - it('invokes listFindings without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); - const [response] = await client.listFindings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindings without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IFinding[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindings with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindings(request), expectedError); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingsStream without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - ]; - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.Finding[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.Finding) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFindingsStream with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.Finding[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.Finding) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFindings without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - ]; - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1beta1.IFinding[] = []; - const iterable = client.listFindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFindings with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1beta1.IFinding[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listSources', () => { - it('invokes listSources without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - ]; - client.innerApiCalls.listSources = stubSimpleCall(expectedResponse); - const [response] = await client.listSources(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSources without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - ]; - client.innerApiCalls.listSources = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSources( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISource[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSources with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSources = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSources(request), expectedError); - const actualRequest = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSourcesStream without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - ]; - client.descriptors.page.listSources.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.Source[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.Source) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSources, request)); - assert( - (client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listSourcesStream with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSources.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.Source[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.Source) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSources, request)); - assert( - (client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSources without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - ]; - client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1beta1.ISource[] = []; - const iterable = client.listSourcesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSources with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1beta1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSourcesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1beta1.ISource[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('asset', () => { - const fakePath = "/rendered/path/asset"; - const expectedParameters = { - organization: "organizationValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.assetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.assetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('assetPath', () => { - const result = client.assetPath("organizationValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.assetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromAssetName', () => { - const result = client.matchOrganizationFromAssetName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromAssetName', () => { - const result = client.matchAssetFromAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('finding', () => { - const fakePath = "/rendered/path/finding"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.findingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.findingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('findingPath', () => { - const result = client.findingPath("organizationValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.findingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromFindingName', () => { - const result = client.matchOrganizationFromFindingName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromFindingName', () => { - const result = client.matchSourceFromFindingName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromFindingName', () => { - const result = client.matchFindingFromFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organization', () => { - const fakePath = "/rendered/path/organization"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationPath', () => { - const result = client.organizationPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationName', () => { - const result = client.matchOrganizationFromOrganizationName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAssetSecurityMarks', () => { - const fakePath = "/rendered/path/organizationAssetSecurityMarks"; - const expectedParameters = { - organization: "organizationValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAssetSecurityMarksPath', () => { - const result = client.organizationAssetSecurityMarksPath("organizationValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAssetSecurityMarksName', () => { - const result = client.matchOrganizationFromOrganizationAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromOrganizationAssetSecurityMarksName', () => { - const result = client.matchAssetFromOrganizationAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSettings', () => { - const fakePath = "/rendered/path/organizationSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSettingsPath', () => { - const result = client.organizationSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSourceFindingSecurityMarks', () => { - const fakePath = "/rendered/path/organizationSourceFindingSecurityMarks"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSourceFindingSecurityMarksPath', () => { - const result = client.organizationSourceFindingSecurityMarksPath("organizationValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSourceFindingSecurityMarksName', () => { - const result = client.matchOrganizationFromOrganizationSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromOrganizationSourceFindingSecurityMarksName', () => { - const result = client.matchSourceFromOrganizationSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromOrganizationSourceFindingSecurityMarksName', () => { - const result = client.matchFindingFromOrganizationSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('source', () => { - const fakePath = "/rendered/path/source"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - }; - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.sourcePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sourcePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sourcePath', () => { - const result = client.sourcePath("organizationValue", "sourceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sourcePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromSourceName', () => { - const result = client.matchOrganizationFromSourceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.sourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromSourceName', () => { - const result = client.matchSourceFromSourceName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.sourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/tsconfig.json b/owl-bot-staging/google-cloud-securitycenter/v1beta1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1beta1/webpack.config.js b/owl-bot-staging/google-cloud-securitycenter/v1beta1/webpack.config.js deleted file mode 100644 index 4aeca8bf63a..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1beta1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 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 -// -// https://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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'SecurityCenter', - filename: './security-center.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.eslintignore b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.gitignore b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.jsdoc.js deleted file mode 100644 index 4d5ad9781e7..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2023 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/security-center', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.mocharc.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/README.md b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/README.md deleted file mode 100644 index 73f34764a12..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Securitycenter: Nodejs Client diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/linkinator.config.json b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/package.json b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/package.json deleted file mode 100644 index efcfeb4e7ad..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/security-center", - "version": "0.1.0", - "description": "Securitycenter client for Node.js", - "repository": "googleapis/nodejs-securitycenter", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google securitycenter", - "securitycenter", - "security center" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.5.7" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^4.0.0", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.1.2", - "mocha": "^10.2.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.0.1", - "ts-loader": "^8.4.0", - "typescript": "^4.8.4", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/asset.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/asset.proto deleted file mode 100644 index df4a093f15f..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/asset.proto +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2021 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1p1beta1/folder.proto"; -import "google/cloud/securitycenter/v1p1beta1/security_marks.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; - -// Security Command Center representation of a Google Cloud -// resource. -// -// The Asset is a Security Command Center resource that captures information -// about a single Google Cloud resource. All modifications to an Asset are only -// within the context of Security Command Center and don't affect the referenced -// Google Cloud resource. -message Asset { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/Asset" - pattern: "organizations/{organization}/assets/{asset}" - pattern: "folders/{folder}/assets/{asset}" - pattern: "projects/{project}/assets/{asset}" - }; - - // Security Command Center managed properties. These properties are managed by - // Security Command Center and cannot be modified by the user. - message SecurityCenterProperties { - // The full resource name of the Google Cloud resource this asset - // represents. This field is immutable after create time. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_name = 1; - - // The type of the Google Cloud resource. Examples include: APPLICATION, - // PROJECT, and ORGANIZATION. This is a case insensitive field defined by - // Security Command Center and/or the producer of the resource and is - // immutable after create time. - string resource_type = 2; - - // The full resource name of the immediate parent of the resource. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_parent = 3; - - // The full resource name of the project the resource belongs to. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_project = 4; - - // Owners of the Google Cloud resource. - repeated string resource_owners = 5; - - // The user defined display name for this resource. - string resource_display_name = 6; - - // The user defined display name for the parent of this resource. - string resource_parent_display_name = 7; - - // The user defined display name for the project of this resource. - string resource_project_display_name = 8; - - // Contains a Folder message for each folder in the assets ancestry. - // The first folder is the deepest nested folder, and the last folder is the - // folder directly under the Organization. - repeated Folder folders = 10; - } - - // Cloud IAM Policy information associated with the Google Cloud resource - // described by the Security Command Center asset. This information is managed - // and defined by the Google Cloud resource and cannot be modified by the - // user. - message IamPolicy { - // The JSON representation of the Policy associated with the asset. - // See https://cloud.google.com/iam/docs/reference/rest/v1/Policy for - // format details. - string policy_blob = 1; - } - - // The relative resource name of this asset. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/assets/{asset_id}". - string name = 1; - - // Security Command Center managed properties. These properties are managed by - // Security Command Center and cannot be modified by the user. - SecurityCenterProperties security_center_properties = 2; - - // Resource managed properties. These properties are managed and defined by - // the Google Cloud resource and cannot be modified by the user. - map resource_properties = 7; - - // User specified security marks. These marks are entirely managed by the user - // and come from the SecurityMarks resource that belongs to the asset. - SecurityMarks security_marks = 8; - - // The time at which the asset was created in Security Command Center. - google.protobuf.Timestamp create_time = 9; - - // The time at which the asset was last updated or added in Cloud SCC. - google.protobuf.Timestamp update_time = 10; - - // Cloud IAM Policy information associated with the Google Cloud resource - // described by the Security Command Center asset. This information is managed - // and defined by the Google Cloud resource and cannot be modified by the - // user. - IamPolicy iam_policy = 11; - - // The canonical name of the resource. It's either - // "organizations/{organization_id}/assets/{asset_id}", - // "folders/{folder_id}/assets/{asset_id}" or - // "projects/{project_number}/assets/{asset_id}", depending on the closest CRM - // ancestor of the resource. - string canonical_name = 13; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/finding.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/finding.proto deleted file mode 100644 index f88034bb5ad..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/finding.proto +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2021 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1p1beta1/security_marks.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; - -// Security Command Center finding. -// -// A finding is a record of assessment data (security, risk, health or privacy) -// ingested into Security Command Center for presentation, notification, -// analysis, policy testing, and enforcement. For example, an XSS vulnerability -// in an App Engine application is a finding. -message Finding { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/Finding" - pattern: "organizations/{organization}/sources/{source}/findings/{finding}" - pattern: "folders/{folder}/sources/{source}/findings/{finding}" - pattern: "projects/{project}/sources/{source}/findings/{finding}" - }; - - // The state of the finding. - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // The finding requires attention and has not been addressed yet. - ACTIVE = 1; - - // The finding has been fixed, triaged as a non-issue or otherwise addressed - // and is no longer active. - INACTIVE = 2; - } - - // The severity of the finding. This field is managed by the source that - // writes the finding. - enum Severity { - // No severity specified. The default value. - SEVERITY_UNSPECIFIED = 0; - - // Critical severity. - CRITICAL = 1; - - // High severity. - HIGH = 2; - - // Medium severity. - MEDIUM = 3; - - // Low severity. - LOW = 4; - } - - // The relative resource name of this finding. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}" - string name = 1; - - // The relative resource name of the source the finding belongs to. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // This field is immutable after creation time. - // For example: - // "organizations/{organization_id}/sources/{source_id}" - string parent = 2; - - // For findings on Google Cloud resources, the full resource - // name of the Google Cloud resource this finding is for. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - // When the finding is for a non-Google Cloud resource, the resourceName can - // be a customer or partner defined string. This field is immutable after - // creation time. - string resource_name = 3; - - // The state of the finding. - State state = 4; - - // The additional taxonomy group within findings from a given source. - // This field is immutable after creation time. - // Example: "XSS_FLASH_INJECTION" - string category = 5; - - // The URI that, if available, points to a web page outside of Security - // Command Center where additional information about the finding can be found. - // This field is guaranteed to be either empty or a well formed URL. - string external_uri = 6; - - // Source specific properties. These properties are managed by the source - // that writes the finding. The key names in the source_properties map must be - // between 1 and 255 characters, and must start with a letter and contain - // alphanumeric characters or underscores only. - map source_properties = 7; - - // Output only. User specified security marks. These marks are entirely - // managed by the user and come from the SecurityMarks resource that belongs - // to the finding. - SecurityMarks security_marks = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The time at which the event took place, or when an update to the finding - // occurred. For example, if the finding represents an open firewall it would - // capture the time the detector believes the firewall became open. The - // accuracy is determined by the detector. If the finding were to be resolved - // afterward, this time would reflect when the finding was resolved. Must not - // be set to a value greater than the current timestamp. - google.protobuf.Timestamp event_time = 9; - - // The time at which the finding was created in Security Command Center. - google.protobuf.Timestamp create_time = 10; - - // The severity of the finding. This field is managed by the source that - // writes the finding. - Severity severity = 13; - - // The canonical name of the finding. It's either - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", - // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}" or - // "projects/{project_number}/sources/{source_id}/findings/{finding_id}", - // depending on the closest CRM ancestor of the resource associated with the - // finding. - string canonical_name = 14; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/folder.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/folder.proto deleted file mode 100644 index c94f2da69a6..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/folder.proto +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2021 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "FolderProto"; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1Beta1"; - -// Message that contains the resource name and display name of a folder -// resource. -message Folder { - // Full resource name of this folder. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_folder = 1; - - // The user defined display name for this folder. - string resource_folder_display_name = 2; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto deleted file mode 100644 index 87f2dbbc683..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2021 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; -option (google.api.resource_definition) = { - type: "pubsub.googleapis.com/Topic" - pattern: "projects/{project}/topics/{topic}" -}; - -// Security Command Center notification configs. -// -// A notification config is a Security Command Center resource that contains the -// configuration to send notifications for create/update events of findings, -// assets and etc. -message NotificationConfig { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/NotificationConfig" - pattern: "organizations/{organization}/notificationConfigs/{notification_config}" - }; - - // The config for streaming-based notifications, which send each event as soon - // as it is detected. - message StreamingConfig { - // Expression that defines the filter to apply across create/update events - // of assets or findings as specified by the event type. 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. - string filter = 1; - } - - // The type of events. - enum EventType { - // Unspecified event type. - EVENT_TYPE_UNSPECIFIED = 0; - - // Events for findings. - FINDING = 1; - } - - // The relative resource name of this notification config. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/notificationConfigs/notify_public_bucket". - string name = 1; - - // The description of the notification config (max of 1024 characters). - string description = 2; - - // The type of events the config is for, e.g. FINDING. - EventType event_type = 3; - - // The Pub/Sub topic to send notifications to. Its format is - // "projects/[project_id]/topics/[topic]". - string pubsub_topic = 4 [(google.api.resource_reference) = { - type: "pubsub.googleapis.com/Topic" - }]; - - // Output only. The service account that needs "pubsub.topics.publish" - // permission to publish to the Pub/Sub topic. - string service_account = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The config for triggering notifications. - oneof notify_config { - // The config for triggering streaming-based notifications. - StreamingConfig streaming_config = 6; - } -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto deleted file mode 100644 index eb1c43a5778..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/cloud/securitycenter/v1p1beta1/finding.proto"; -import "google/cloud/securitycenter/v1p1beta1/resource.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; - -// Security Command Center's Notification -message NotificationMessage { - // Name of the notification config that generated current notification. - string notification_config_name = 1; - - // Notification Event. - oneof event { - // If it's a Finding based notification config, this field will be - // populated. - Finding finding = 2; - } - - // The Cloud resource tied to the notification. - Resource resource = 3; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto deleted file mode 100644 index b4d26c907a2..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2021 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/api/resource.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; - -// User specified settings that are attached to the Security Command -// Center organization. -message OrganizationSettings { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/OrganizationSettings" - pattern: "organizations/{organization}/organizationSettings" - }; - - // The configuration used for Asset Discovery runs. - message AssetDiscoveryConfig { - // The mode of inclusion when running Asset Discovery. - // Asset discovery can be limited by explicitly identifying projects to be - // included or excluded. If INCLUDE_ONLY is set, then only those projects - // within the organization and their children are discovered during asset - // discovery. If EXCLUDE is set, then projects that don't match those - // projects are discovered during asset discovery. If neither are set, then - // all projects within the organization are discovered during asset - // discovery. - enum InclusionMode { - // Unspecified. Setting the mode with this value will disable - // inclusion/exclusion filtering for Asset Discovery. - INCLUSION_MODE_UNSPECIFIED = 0; - - // Asset Discovery will capture only the resources within the projects - // specified. All other resources will be ignored. - INCLUDE_ONLY = 1; - - // Asset Discovery will ignore all resources under the projects specified. - // All other resources will be retrieved. - EXCLUDE = 2; - } - - // The project ids to use for filtering asset discovery. - repeated string project_ids = 1; - - // The mode to use for filtering asset discovery. - InclusionMode inclusion_mode = 2; - - // The folder ids to use for filtering asset discovery. - // It consists of only digits, e.g., 756619654966. - repeated string folder_ids = 3; - } - - // The relative resource name of the settings. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/organizationSettings". - string name = 1; - - // A flag that indicates if Asset Discovery should be enabled. If the flag is - // set to `true`, then discovery of assets will occur. If it is set to `false, - // all historical assets will remain, but discovery of future assets will not - // occur. - bool enable_asset_discovery = 2; - - // The configuration used for Asset Discovery runs. - AssetDiscoveryConfig asset_discovery_config = 3; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/resource.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/resource.proto deleted file mode 100644 index fd1ef2e266e..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/resource.proto +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2021 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/api/field_behavior.proto"; -import "google/cloud/securitycenter/v1p1beta1/folder.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_outer_classname = "ResourceProto"; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; - -// Information related to the Google Cloud resource. -message Resource { - // The full resource name of the resource. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string name = 1; - - // The full resource name of project that the resource belongs to. - string project = 2; - - // The human readable name of project that the resource belongs to. - string project_display_name = 3; - - // The full resource name of resource's parent. - string parent = 4; - - // The human readable name of resource's parent. - string parent_display_name = 5; - - // Output only. Contains a Folder message for each folder in the assets ancestry. - // The first folder is the deepest nested folder, and the last folder is the - // folder directly under the Organization. - repeated Folder folders = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto deleted file mode 100644 index 96c4f1d1459..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2021 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/protobuf/duration.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; - -// Response of asset discovery run -message RunAssetDiscoveryResponse { - // The state of an asset discovery run. - enum State { - // Asset discovery run state was unspecified. - STATE_UNSPECIFIED = 0; - - // Asset discovery run completed successfully. - COMPLETED = 1; - - // Asset discovery run was cancelled with tasks still pending, as another - // run for the same organization was started with a higher priority. - SUPERSEDED = 2; - - // Asset discovery run was killed and terminated. - TERMINATED = 3; - } - - // The state of an asset discovery run. - State state = 1; - - // The duration between asset discovery run start and end - google.protobuf.Duration duration = 2; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto deleted file mode 100644 index 52762b5be34..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2021 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/api/resource.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; - -// User specified security marks that are attached to the parent Security -// Command Center resource. Security marks are scoped within a Security Command -// Center organization -- they can be modified and viewed by all users who have -// proper permissions on the organization. -message SecurityMarks { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/SecurityMarks" - pattern: "organizations/{organization}/assets/{asset}/securityMarks" - pattern: "organizations/{organization}/sources/{source}/findings/{finding}/securityMarks" - pattern: "folders/{folder}/assets/{asset}/securityMarks" - pattern: "projects/{project}/assets/{asset}/securityMarks" - pattern: "folders/{folder}/sources/{source}/findings/{finding}/securityMarks" - pattern: "projects/{project}/sources/{source}/findings/{finding}/securityMarks" - }; - - // The relative resource name of the SecurityMarks. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Examples: - // "organizations/{organization_id}/assets/{asset_id}/securityMarks" - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks". - string name = 1; - - // Mutable user specified security marks belonging to the parent resource. - // Constraints are as follows: - // - // * Keys and values are treated as case insensitive - // * Keys must be between 1 - 256 characters (inclusive) - // * Keys must be letters, numbers, underscores, or dashes - // * Values have leading and trailing whitespace trimmed, remaining - // characters must be between 1 - 4096 characters (inclusive) - map marks = 2; - - // The canonical name of the marks. - // Examples: - // "organizations/{organization_id}/assets/{asset_id}/securityMarks" - // "folders/{folder_id}/assets/{asset_id}/securityMarks" - // "projects/{project_number}/assets/{asset_id}/securityMarks" - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks" - // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}/securityMarks" - // "projects/{project_number}/sources/{source_id}/findings/{finding_id}/securityMarks" - string canonical_name = 3; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto deleted file mode 100644 index b2fae10eebf..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto +++ /dev/null @@ -1,1351 +0,0 @@ -// Copyright 2021 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import public "google/cloud/securitycenter/v1p1beta1/notification_message.proto"; -import public "google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto"; -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1p1beta1/asset.proto"; -import "google/cloud/securitycenter/v1p1beta1/finding.proto"; -import "google/cloud/securitycenter/v1p1beta1/folder.proto"; -import "google/cloud/securitycenter/v1p1beta1/notification_config.proto"; -import "google/cloud/securitycenter/v1p1beta1/organization_settings.proto"; -import "google/cloud/securitycenter/v1p1beta1/security_marks.proto"; -import "google/cloud/securitycenter/v1p1beta1/source.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; - -// V1p1Beta1 APIs for Security Center service. -service SecurityCenter { - option (google.api.default_host) = "securitycenter.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a source. - rpc CreateSource(CreateSourceRequest) returns (Source) { - option (google.api.http) = { - post: "/v1p1beta1/{parent=organizations/*}/sources" - body: "source" - }; - option (google.api.method_signature) = "parent,source"; - } - - // Creates a finding. The corresponding source must exist for finding - // creation to succeed. - rpc CreateFinding(CreateFindingRequest) returns (Finding) { - option (google.api.http) = { - post: "/v1p1beta1/{parent=organizations/*/sources/*}/findings" - body: "finding" - }; - option (google.api.method_signature) = "parent,finding_id,finding"; - option (google.api.method_signature) = "parent,finding,finding_id"; - } - - // Creates a notification config. - rpc CreateNotificationConfig(CreateNotificationConfigRequest) returns (NotificationConfig) { - option (google.api.http) = { - post: "/v1p1beta1/{parent=organizations/*}/notificationConfigs" - body: "notification_config" - }; - option (google.api.method_signature) = "parent,config_id,notification_config"; - option (google.api.method_signature) = "parent,notification_config"; - } - - // Deletes a notification config. - rpc DeleteNotificationConfig(DeleteNotificationConfigRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1p1beta1/{name=organizations/*/notificationConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets the access control policy on the specified Source. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1p1beta1/{resource=organizations/*/sources/*}:getIamPolicy" - body: "*" - }; - option (google.api.method_signature) = "resource"; - } - - // Gets a notification config. - rpc GetNotificationConfig(GetNotificationConfigRequest) returns (NotificationConfig) { - option (google.api.http) = { - get: "/v1p1beta1/{name=organizations/*/notificationConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets the settings for an organization. - rpc GetOrganizationSettings(GetOrganizationSettingsRequest) returns (OrganizationSettings) { - option (google.api.http) = { - get: "/v1p1beta1/{name=organizations/*/organizationSettings}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a source. - rpc GetSource(GetSourceRequest) returns (Source) { - option (google.api.http) = { - get: "/v1p1beta1/{name=organizations/*/sources/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Filters an organization's assets and groups them by their specified - // properties. - rpc GroupAssets(GroupAssetsRequest) returns (GroupAssetsResponse) { - option (google.api.http) = { - post: "/v1p1beta1/{parent=organizations/*}/assets:group" - body: "*" - additional_bindings { - post: "/v1p1beta1/{parent=folders/*}/assets:group" - body: "*" - } - additional_bindings { - post: "/v1p1beta1/{parent=projects/*}/assets:group" - body: "*" - } - }; - } - - // Filters an organization or source's findings and groups them by their - // specified properties. - // - // To group across all sources provide a `-` as the source id. - // Example: /v1/organizations/{organization_id}/sources/-/findings, - // /v1/folders/{folder_id}/sources/-/findings, - // /v1/projects/{project_id}/sources/-/findings - rpc GroupFindings(GroupFindingsRequest) returns (GroupFindingsResponse) { - option (google.api.http) = { - post: "/v1p1beta1/{parent=organizations/*/sources/*}/findings:group" - body: "*" - additional_bindings { - post: "/v1p1beta1/{parent=folders/*/sources/*}/findings:group" - body: "*" - } - additional_bindings { - post: "/v1p1beta1/{parent=projects/*/sources/*}/findings:group" - body: "*" - } - }; - option (google.api.method_signature) = "parent,group_by"; - } - - // Lists an organization's assets. - rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { - option (google.api.http) = { - get: "/v1p1beta1/{parent=organizations/*}/assets" - additional_bindings { - get: "/v1p1beta1/{parent=folders/*}/assets" - } - additional_bindings { - get: "/v1p1beta1/{parent=projects/*}/assets" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Lists an organization or source's findings. - // - // To list across all sources provide a `-` as the source id. - // Example: /v1p1beta1/organizations/{organization_id}/sources/-/findings - rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { - option (google.api.http) = { - get: "/v1p1beta1/{parent=organizations/*/sources/*}/findings" - additional_bindings { - get: "/v1p1beta1/{parent=folders/*/sources/*}/findings" - } - additional_bindings { - get: "/v1p1beta1/{parent=projects/*/sources/*}/findings" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Lists notification configs. - rpc ListNotificationConfigs(ListNotificationConfigsRequest) returns (ListNotificationConfigsResponse) { - option (google.api.http) = { - get: "/v1p1beta1/{parent=organizations/*}/notificationConfigs" - }; - option (google.api.method_signature) = "parent"; - } - - // Lists all sources belonging to an organization. - rpc ListSources(ListSourcesRequest) returns (ListSourcesResponse) { - option (google.api.http) = { - get: "/v1p1beta1/{parent=organizations/*}/sources" - additional_bindings { - get: "/v1p1beta1/{parent=folders/*}/sources" - } - additional_bindings { - get: "/v1p1beta1/{parent=projects/*}/sources" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Runs asset discovery. The discovery is tracked with a long-running - // operation. - // - // This API can only be called with limited frequency for an organization. If - // it is called too frequently the caller will receive a TOO_MANY_REQUESTS - // error. - rpc RunAssetDiscovery(RunAssetDiscoveryRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1p1beta1/{parent=organizations/*}/assets:runDiscovery" - body: "*" - }; - option (google.api.method_signature) = "parent"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryResponse" - metadata_type: "google.protobuf.Empty" - }; - } - - // Updates the state of a finding. - rpc SetFindingState(SetFindingStateRequest) returns (Finding) { - option (google.api.http) = { - post: "/v1p1beta1/{name=organizations/*/sources/*/findings/*}:setState" - body: "*" - additional_bindings { - post: "/v1p1beta1/{name=folders/*/sources/*/findings/*}:setState" - body: "*" - } - additional_bindings { - post: "/v1p1beta1/{name=projects/*/sources/*/findings/*}:setState" - body: "*" - } - }; - option (google.api.method_signature) = "name,state,start_time"; - } - - // Sets the access control policy on the specified Source. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1p1beta1/{resource=organizations/*/sources/*}:setIamPolicy" - body: "*" - }; - option (google.api.method_signature) = "resource,policy"; - } - - // Returns the permissions that a caller has on the specified source. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1p1beta1/{resource=organizations/*/sources/*}:testIamPermissions" - body: "*" - }; - option (google.api.method_signature) = "resource,permissions"; - } - - // Creates or updates a finding. The corresponding source must exist for a - // finding creation to succeed. - rpc UpdateFinding(UpdateFindingRequest) returns (Finding) { - option (google.api.http) = { - patch: "/v1p1beta1/{finding.name=organizations/*/sources/*/findings/*}" - body: "finding" - additional_bindings { - patch: "/v1p1beta1/{finding.name=folders/*/sources/*/findings/*}" - body: "finding" - } - additional_bindings { - patch: "/v1p1beta1/{finding.name=projects/*/sources/*/findings/*}" - body: "finding" - } - }; - option (google.api.method_signature) = "finding"; - option (google.api.method_signature) = "finding,update_mask"; - } - - // Updates a notification config. The following update - // fields are allowed: description, pubsub_topic, streaming_config.filter - rpc UpdateNotificationConfig(UpdateNotificationConfigRequest) returns (NotificationConfig) { - option (google.api.http) = { - patch: "/v1p1beta1/{notification_config.name=organizations/*/notificationConfigs/*}" - body: "notification_config" - }; - option (google.api.method_signature) = "notification_config"; - option (google.api.method_signature) = "notification_config,update_mask"; - } - - // Updates an organization's settings. - rpc UpdateOrganizationSettings(UpdateOrganizationSettingsRequest) returns (OrganizationSettings) { - option (google.api.http) = { - patch: "/v1p1beta1/{organization_settings.name=organizations/*/organizationSettings}" - body: "organization_settings" - }; - option (google.api.method_signature) = "organization_settings"; - } - - // Updates a source. - rpc UpdateSource(UpdateSourceRequest) returns (Source) { - option (google.api.http) = { - patch: "/v1p1beta1/{source.name=organizations/*/sources/*}" - body: "source" - }; - option (google.api.method_signature) = "source"; - option (google.api.method_signature) = "source,update_mask"; - } - - // Updates security marks. - rpc UpdateSecurityMarks(UpdateSecurityMarksRequest) returns (SecurityMarks) { - option (google.api.http) = { - patch: "/v1p1beta1/{security_marks.name=organizations/*/assets/*/securityMarks}" - body: "security_marks" - additional_bindings { - patch: "/v1p1beta1/{security_marks.name=folders/*/assets/*/securityMarks}" - body: "security_marks" - } - additional_bindings { - patch: "/v1p1beta1/{security_marks.name=projects/*/assets/*/securityMarks}" - body: "security_marks" - } - additional_bindings { - patch: "/v1p1beta1/{security_marks.name=organizations/*/sources/*/findings/*/securityMarks}" - body: "security_marks" - } - additional_bindings { - patch: "/v1p1beta1/{security_marks.name=folders/*/sources/*/findings/*/securityMarks}" - body: "security_marks" - } - additional_bindings { - patch: "/v1p1beta1/{security_marks.name=projects/*/sources/*/findings/*/securityMarks}" - body: "security_marks" - } - }; - option (google.api.method_signature) = "security_marks"; - option (google.api.method_signature) = "security_marks,update_mask"; - } -} - -// Request message for creating a finding. -message CreateFindingRequest { - // Required. Resource name of the new finding's parent. Its format should be - // "organizations/[organization_id]/sources/[source_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; - - // Required. Unique identifier provided by the client within the parent scope. - string finding_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Finding being created. The name and security_marks will be ignored as - // they are both output only fields on this resource. - Finding finding = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for creating a notification config. -message CreateNotificationConfigRequest { - // Required. Resource name of the new notification config's parent. Its format is - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // Required. Unique identifier provided by the client within the parent scope. - // It must be between 1 and 128 characters, and contains alphanumeric - // characters, underscores or hyphens only. - string config_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The notification config being created. The name and the service account - // will be ignored as they are both output only fields on this resource. - NotificationConfig notification_config = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for creating a source. -message CreateSourceRequest { - // Required. Resource name of the new source's parent. Its format should be - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // Required. The Source being created, only the display_name and description will be - // used. All other fields will be ignored. - Source source = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for deleting a notification config. -message DeleteNotificationConfigRequest { - // Required. Name of the notification config to delete. Its format is - // "organizations/[organization_id]/notificationConfigs/[config_id]". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/NotificationConfig" - } - ]; -} - -// Request message for getting a notification config. -message GetNotificationConfigRequest { - // Required. Name of the notification config to get. Its format is - // "organizations/[organization_id]/notificationConfigs/[config_id]". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/NotificationConfig" - } - ]; -} - -// Request message for getting organization settings. -message GetOrganizationSettingsRequest { - // Required. Name of the organization to get organization settings for. Its format is - // "organizations/[organization_id]/organizationSettings". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/OrganizationSettings" - } - ]; -} - -// Request message for getting a source. -message GetSourceRequest { - // Required. Relative resource name of the source. Its format is - // "organizations/[organization_id]/source/[source_id]". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; -} - -// Request message for grouping by assets. -message GroupAssetsRequest { - // Required. Name of the organization to groupBy. Its format is - // "organizations/[organization_id], folders/[folder_id], or - // projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/Asset" - } - ]; - - // Expression that defines the filter to apply across assets. - // 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 Asset resource. Examples include: - // - // * name - // * security_center_properties.resource_name - // * resource_properties.a_property - // * security_marks.marks.marka - // - // 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. - // - // The following field and operator combinations are supported: - // - // * name: `=` - // * update_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `update_time = "2019-06-10T16:07:18-07:00"` - // `update_time = 1560208038000` - // - // * create_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `create_time = "2019-06-10T16:07:18-07:00"` - // `create_time = 1560208038000` - // - // * iam_policy.policy_blob: `=`, `:` - // * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - // * security_marks.marks: `=`, `:` - // * security_center_properties.resource_name: `=`, `:` - // * security_center_properties.resource_name_display_name: `=`, `:` - // * security_center_properties.resource_type: `=`, `:` - // * security_center_properties.resource_parent: `=`, `:` - // * security_center_properties.resource_parent_display_name: `=`, `:` - // * security_center_properties.resource_project: `=`, `:` - // * security_center_properties.resource_project_display_name: `=`, `:` - // * security_center_properties.resource_owners: `=`, `:` - // - // For example, `resource_properties.size = 100` is a valid filter string. - // - // Use a partial match on the empty string to filter based on a property - // existing: `resource_properties.my_property : ""` - // - // Use a negated partial match on the empty string to filter based on a - // property not existing: `-resource_properties.my_property : ""` - string filter = 2; - - // Required. Expression that defines what assets fields to use for grouping. The string - // value should follow SQL syntax: comma separated list of fields. For - // example: - // "security_center_properties.resource_project,security_center_properties.project". - // - // The following fields are supported when compare_duration is not set: - // - // * security_center_properties.resource_project - // * security_center_properties.resource_project_display_name - // * security_center_properties.resource_type - // * security_center_properties.resource_parent - // * security_center_properties.resource_parent_display_name - // - // The following fields are supported when compare_duration is set: - // - // * security_center_properties.resource_type - // * security_center_properties.resource_project_display_name - // * security_center_properties.resource_parent_display_name - string group_by = 3 [(google.api.field_behavior) = REQUIRED]; - - // When compare_duration is set, the GroupResult's "state_change" property is - // updated to indicate whether the asset was added, removed, or remained - // present during the compare_duration period of time that precedes the - // read_time. This is the time between (read_time - compare_duration) and - // read_time. - // - // The state change value is derived based on the presence of the asset at the - // two points in time. Intermediate state changes between the two times don't - // affect the result. For example, the results aren't affected if the asset is - // removed and re-created again. - // - // Possible "state_change" values when compare_duration is specified: - // - // * "ADDED": indicates that the asset was not present at the start of - // compare_duration, but present at reference_time. - // * "REMOVED": indicates that the asset was present at the start of - // compare_duration, but not present at reference_time. - // * "ACTIVE": indicates that the asset was present at both the - // start and the end of the time period defined by - // compare_duration and reference_time. - // - // If compare_duration is not specified, then the only possible state_change - // is "UNUSED", which will be the state_change set for all assets present at - // read_time. - // - // If this field is set then `state_change` must be a specified field in - // `group_by`. - google.protobuf.Duration compare_duration = 4; - - // Time used as a reference point when filtering assets. The filter is limited - // to assets existing at the supplied time and their values are those at that - // specific time. Absence of this field will default to the API's version of - // NOW. - google.protobuf.Timestamp read_time = 5; - - // The value returned by the last `GroupAssetsResponse`; indicates - // that this is a continuation of a prior `GroupAssets` call, and that the - // system should return the next page of data. - string page_token = 7; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 8; -} - -// Response message for grouping by assets. -message GroupAssetsResponse { - // Group results. There exists an element for each existing unique - // combination of property/values. The element contains a count for the number - // of times those specific property/values appear. - repeated GroupResult group_by_results = 1; - - // Time used for executing the groupBy request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of results matching the query. - int32 total_size = 4; -} - -// Request message for grouping by findings. -message GroupFindingsRequest { - // Required. Name of the source to groupBy. Its format is - // "organizations/[organization_id]/sources/[source_id]", - // folders/[folder_id]/sources/[source_id], or - // projects/[project_id]/sources/[source_id]. To groupBy across all sources - // provide a source_id of `-`. For example: - // organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - // or projects/{project_id}/sources/- - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; - - // Expression that defines the filter to apply across findings. - // The expression is a list of one 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. Examples include: - // - // * name - // * source_properties.a_property - // * security_marks.marks.marka - // - // 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. - // - // The following field and operator combinations are supported: - // - // * name: `=` - // * parent: `=`, `:` - // * resource_name: `=`, `:` - // * state: `=`, `:` - // * category: `=`, `:` - // * external_uri: `=`, `:` - // * event_time: `=`, `>`, `<`, `>=`, `<=` - // * severity: `=`, `:` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `event_time = "2019-06-10T16:07:18-07:00"` - // `event_time = 1560208038000` - // - // * security_marks.marks: `=`, `:` - // * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - // - // For example, `source_properties.size = 100` is a valid filter string. - // - // Use a partial match on the empty string to filter based on a property - // existing: `source_properties.my_property : ""` - // - // Use a negated partial match on the empty string to filter based on a - // property not existing: `-source_properties.my_property : ""` - string filter = 2; - - // Required. Expression that defines what assets fields to use for grouping (including - // `state_change`). The string value should follow SQL syntax: comma separated - // list of fields. For example: "parent,resource_name". - // - // The following fields are supported: - // - // * resource_name - // * category - // * state - // * parent - // * severity - // - // The following fields are supported when compare_duration is set: - // - // * state_change - string group_by = 3 [(google.api.field_behavior) = REQUIRED]; - - // Time used as a reference point when filtering findings. The filter is - // limited to findings existing at the supplied time and their values are - // those at that specific time. Absence of this field will default to the - // API's version of NOW. - google.protobuf.Timestamp read_time = 4; - - // When compare_duration is set, the GroupResult's "state_change" attribute is - // updated to indicate whether the finding had its state changed, the - // finding's state remained unchanged, or if the finding was added during the - // compare_duration period of time that precedes the read_time. This is the - // time between (read_time - compare_duration) and read_time. - // - // The state_change value is derived based on the presence and state of the - // finding at the two points in time. Intermediate state changes between the - // two times don't affect the result. For example, the results aren't affected - // if the finding is made inactive and then active again. - // - // Possible "state_change" values when compare_duration is specified: - // - // * "CHANGED": indicates that the finding was present and matched the given - // filter at the start of compare_duration, but changed its - // state at read_time. - // * "UNCHANGED": indicates that the finding was present and matched the given - // filter at the start of compare_duration and did not change - // state at read_time. - // * "ADDED": indicates that the finding did not match the given filter or - // was not present at the start of compare_duration, but was - // present at read_time. - // * "REMOVED": indicates that the finding was present and matched the - // filter at the start of compare_duration, but did not match - // the filter at read_time. - // - // If compare_duration is not specified, then the only possible state_change - // is "UNUSED", which will be the state_change set for all findings present - // at read_time. - // - // If this field is set then `state_change` must be a specified field in - // `group_by`. - google.protobuf.Duration compare_duration = 5; - - // The value returned by the last `GroupFindingsResponse`; indicates - // that this is a continuation of a prior `GroupFindings` call, and - // that the system should return the next page of data. - string page_token = 7; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 8; -} - -// Response message for group by findings. -message GroupFindingsResponse { - // Group results. There exists an element for each existing unique - // combination of property/values. The element contains a count for the number - // of times those specific property/values appear. - repeated GroupResult group_by_results = 1; - - // Time used for executing the groupBy request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of results matching the query. - int32 total_size = 4; -} - -// Result containing the properties and count of a groupBy request. -message GroupResult { - // Properties matching the groupBy fields in the request. - map properties = 1; - - // Total count of resources for the given properties. - int64 count = 2; -} - -// Request message for listing notification configs. -message ListNotificationConfigsRequest { - // Required. Name of the organization to list notification configs. - // Its format is "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // The value returned by the last `ListNotificationConfigsResponse`; indicates - // that this is a continuation of a prior `ListNotificationConfigs` call, and - // that the system should return the next page of data. - string page_token = 2; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 3; -} - -// Response message for listing notification configs. -message ListNotificationConfigsResponse { - // Notification configs belonging to the requested parent. - repeated NotificationConfig notification_configs = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 2; -} - -// Request message for listing sources. -message ListSourcesRequest { - // Required. Resource name of the parent of sources to list. Its format should be - // "organizations/[organization_id], folders/[folder_id], or - // projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/Source" - } - ]; - - // The value returned by the last `ListSourcesResponse`; indicates - // that this is a continuation of a prior `ListSources` call, and - // that the system should return the next page of data. - string page_token = 2; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 7; -} - -// Response message for listing sources. -message ListSourcesResponse { - // Sources belonging to the requested parent. - repeated Source sources = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 2; -} - -// Request message for listing assets. -message ListAssetsRequest { - // Required. Name of the organization assets should belong to. Its format is - // "organizations/[organization_id], folders/[folder_id], or - // projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/Asset" - } - ]; - - // Expression that defines the filter to apply across assets. - // 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 Asset resource. Examples include: - // - // * name - // * security_center_properties.resource_name - // * resource_properties.a_property - // * security_marks.marks.marka - // - // 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. - // - // The following are the allowed field and operator combinations: - // - // * name: `=` - // * update_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `update_time = "2019-06-10T16:07:18-07:00"` - // `update_time = 1560208038000` - // - // * create_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `create_time = "2019-06-10T16:07:18-07:00"` - // `create_time = 1560208038000` - // - // * iam_policy.policy_blob: `=`, `:` - // * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - // * security_marks.marks: `=`, `:` - // * security_center_properties.resource_name: `=`, `:` - // * security_center_properties.resource_display_name: `=`, `:` - // * security_center_properties.resource_type: `=`, `:` - // * security_center_properties.resource_parent: `=`, `:` - // * security_center_properties.resource_parent_display_name: `=`, `:` - // * security_center_properties.resource_project: `=`, `:` - // * security_center_properties.resource_project_display_name: `=`, `:` - // * security_center_properties.resource_owners: `=`, `:` - // - // For example, `resource_properties.size = 100` is a valid filter string. - // - // Use a partial match on the empty string to filter based on a property - // existing: `resource_properties.my_property : ""` - // - // Use a negated partial match on the empty string to filter based on a - // property not existing: `-resource_properties.my_property : ""` - string filter = 2; - - // Expression that defines what fields and order to use for sorting. The - // string value should follow SQL syntax: comma separated list of fields. For - // example: "name,resource_properties.a_property". The default sorting order - // is ascending. To specify descending order for a field, a suffix " desc" - // should be appended to the field name. For example: "name - // desc,resource_properties.a_property". Redundant space characters in the - // syntax are insignificant. "name desc,resource_properties.a_property" and " - // name desc , resource_properties.a_property " are equivalent. - // - // The following fields are supported: - // name - // update_time - // resource_properties - // security_marks.marks - // security_center_properties.resource_name - // security_center_properties.resource_display_name - // security_center_properties.resource_parent - // security_center_properties.resource_parent_display_name - // security_center_properties.resource_project - // security_center_properties.resource_project_display_name - // security_center_properties.resource_type - string order_by = 3; - - // Time used as a reference point when filtering assets. The filter is limited - // to assets existing at the supplied time and their values are those at that - // specific time. Absence of this field will default to the API's version of - // NOW. - google.protobuf.Timestamp read_time = 4; - - // When compare_duration is set, the ListAssetsResult's "state_change" - // attribute is updated to indicate whether the asset was added, removed, or - // remained present during the compare_duration period of time that precedes - // the read_time. This is the time between (read_time - compare_duration) and - // read_time. - // - // The state_change value is derived based on the presence of the asset at the - // two points in time. Intermediate state changes between the two times don't - // affect the result. For example, the results aren't affected if the asset is - // removed and re-created again. - // - // Possible "state_change" values when compare_duration is specified: - // - // * "ADDED": indicates that the asset was not present at the start of - // compare_duration, but present at read_time. - // * "REMOVED": indicates that the asset was present at the start of - // compare_duration, but not present at read_time. - // * "ACTIVE": indicates that the asset was present at both the - // start and the end of the time period defined by - // compare_duration and read_time. - // - // If compare_duration is not specified, then the only possible state_change - // is "UNUSED", which will be the state_change set for all assets present at - // read_time. - google.protobuf.Duration compare_duration = 5; - - // A field mask to specify the ListAssetsResult fields to be listed in the - // response. - // An empty field mask will list all fields. - google.protobuf.FieldMask field_mask = 7; - - // The value returned by the last `ListAssetsResponse`; indicates - // that this is a continuation of a prior `ListAssets` call, and - // that the system should return the next page of data. - string page_token = 8; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 9; -} - -// Response message for listing assets. -message ListAssetsResponse { - // Result containing the Asset and its State. - message ListAssetsResult { - // The change in state of the asset. - // - // When querying across two points in time this describes - // the change between the two points: ADDED, REMOVED, or ACTIVE. - // If there was no compare_duration supplied in the request the state change - // will be: UNUSED - enum StateChange { - // State change is unused, this is the canonical default for this enum. - UNUSED = 0; - - // Asset was added between the points in time. - ADDED = 1; - - // Asset was removed between the points in time. - REMOVED = 2; - - // Asset was present at both point(s) in time. - ACTIVE = 3; - } - - // Asset matching the search request. - Asset asset = 1; - - // State change of the asset between the points in time. - StateChange state_change = 2; - } - - // Assets matching the list request. - repeated ListAssetsResult list_assets_results = 1; - - // Time used for executing the list request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of assets matching the query. - int32 total_size = 4; -} - -// Request message for listing findings. -message ListFindingsRequest { - // Required. Name of the source the findings belong to. Its format is - // "organizations/[organization_id]/sources/[source_id], - // folders/[folder_id]/sources/[source_id], or - // projects/[project_id]/sources/[source_id]". To list across all sources - // provide a source_id of `-`. For example: - // organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - // projects/{projects_id}/sources/- - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; - - // Expression that defines the filter to apply across findings. - // The expression is a list of one 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. Examples include: - // - // * name - // * source_properties.a_property - // * security_marks.marks.marka - // - // 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. - // - // The following field and operator combinations are supported: - // - // * name: `=` - // * parent: `=`, `:` - // * resource_name: `=`, `:` - // * state: `=`, `:` - // * category: `=`, `:` - // * external_uri: `=`, `:` - // * event_time: `=`, `>`, `<`, `>=`, `<=` - // * severity: `=`, `:` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `event_time = "2019-06-10T16:07:18-07:00"` - // `event_time = 1560208038000` - // - // security_marks.marks: `=`, `:` - // source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - // - // For example, `source_properties.size = 100` is a valid filter string. - // - // Use a partial match on the empty string to filter based on a property - // existing: `source_properties.my_property : ""` - // - // Use a negated partial match on the empty string to filter based on a - // property not existing: `-source_properties.my_property : ""` - string filter = 2; - - // Expression that defines what fields and order to use for sorting. The - // string value should follow SQL syntax: comma separated list of fields. For - // example: "name,resource_properties.a_property". The default sorting order - // is ascending. To specify descending order for a field, a suffix " desc" - // should be appended to the field name. For example: "name - // desc,source_properties.a_property". Redundant space characters in the - // syntax are insignificant. "name desc,source_properties.a_property" and " - // name desc , source_properties.a_property " are equivalent. - // - // The following fields are supported: - // name - // parent - // state - // category - // resource_name - // event_time - // source_properties - // security_marks.marks - string order_by = 3; - - // Time used as a reference point when filtering findings. The filter is - // limited to findings existing at the supplied time and their values are - // those at that specific time. Absence of this field will default to the - // API's version of NOW. - google.protobuf.Timestamp read_time = 4; - - // When compare_duration is set, the ListFindingsResult's "state_change" - // attribute is updated to indicate whether the finding had its state changed, - // the finding's state remained unchanged, or if the finding was added in any - // state during the compare_duration period of time that precedes the - // read_time. This is the time between (read_time - compare_duration) and - // read_time. - // - // The state_change value is derived based on the presence and state of the - // finding at the two points in time. Intermediate state changes between the - // two times don't affect the result. For example, the results aren't affected - // if the finding is made inactive and then active again. - // - // Possible "state_change" values when compare_duration is specified: - // - // * "CHANGED": indicates that the finding was present and matched the given - // filter at the start of compare_duration, but changed its - // state at read_time. - // * "UNCHANGED": indicates that the finding was present and matched the given - // filter at the start of compare_duration and did not change - // state at read_time. - // * "ADDED": indicates that the finding did not match the given filter or - // was not present at the start of compare_duration, but was - // present at read_time. - // * "REMOVED": indicates that the finding was present and matched the - // filter at the start of compare_duration, but did not match - // the filter at read_time. - // - // If compare_duration is not specified, then the only possible state_change - // is "UNUSED", which will be the state_change set for all findings present at - // read_time. - google.protobuf.Duration compare_duration = 5; - - // A field mask to specify the Finding fields to be listed in the response. - // An empty field mask will list all fields. - google.protobuf.FieldMask field_mask = 7; - - // The value returned by the last `ListFindingsResponse`; indicates - // that this is a continuation of a prior `ListFindings` call, and - // that the system should return the next page of data. - string page_token = 8; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 9; -} - -// Response message for listing findings. -message ListFindingsResponse { - // Result containing the Finding and its StateChange. - message ListFindingsResult { - // Information related to the Google Cloud resource that is - // associated with this finding. - message Resource { - // The full resource name of the resource. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string name = 1; - - // The full resource name of project that the resource belongs to. - string project_name = 2; - - // The human readable name of project that the resource belongs to. - string project_display_name = 3; - - // The full resource name of resource's parent. - string parent_name = 4; - - // The human readable name of resource's parent. - string parent_display_name = 5; - - // Contains a Folder message for each folder in the assets ancestry. - // The first folder is the deepest nested folder, and the last folder is - // the folder directly under the Organization. - repeated Folder folders = 10; - } - - // The change in state of the finding. - // - // When querying across two points in time this describes - // the change in the finding between the two points: CHANGED, UNCHANGED, - // ADDED, or REMOVED. Findings can not be deleted, so REMOVED implies that - // the finding at timestamp does not match the filter specified, but it did - // at timestamp - compare_duration. If there was no compare_duration - // supplied in the request the state change will be: UNUSED - enum StateChange { - // State change is unused, this is the canonical default for this enum. - UNUSED = 0; - - // The finding has changed state in some way between the points in time - // and existed at both points. - CHANGED = 1; - - // The finding has not changed state between the points in time and - // existed at both points. - UNCHANGED = 2; - - // The finding was created between the points in time. - ADDED = 3; - - // The finding at timestamp does not match the filter specified, but it - // did at timestamp - compare_duration. - REMOVED = 4; - } - - // Finding matching the search request. - Finding finding = 1; - - // State change of the finding between the points in time. - StateChange state_change = 2; - - // Output only. Resource that is associated with this finding. - Resource resource = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Findings matching the list request. - repeated ListFindingsResult list_findings_results = 1; - - // Time used for executing the list request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of findings matching the query. - int32 total_size = 4; -} - -// Request message for updating a finding's state. -message SetFindingStateRequest { - // Required. The relative resource name of the finding. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Finding" - } - ]; - - // Required. The desired State of the finding. - Finding.State state = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The time at which the updated state takes effect. - google.protobuf.Timestamp start_time = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for running asset discovery for an organization. -message RunAssetDiscoveryRequest { - // Required. Name of the organization to run asset discovery for. Its format is - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; -} - -// Request message for updating or creating a finding. -message UpdateFindingRequest { - // Required. The finding resource to update or create if it does not already exist. - // parent, security_marks, and update_time will be ignored. - // - // In the case of creation, the finding id portion of the name must be - // alphanumeric and less than or equal to 32 characters and greater than 0 - // characters in length. - Finding finding = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the finding resource. This field should - // not be specified when creating a finding. - // - // When updating a finding, an empty mask is treated as updating all mutable - // fields and replacing source_properties. Individual source_properties can - // be added/updated by using "source_properties." in the field - // mask. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating a notification config. -message UpdateNotificationConfigRequest { - // Required. The notification config to update. - NotificationConfig notification_config = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the notification config. - // - // If empty all mutable fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating an organization's settings. -message UpdateOrganizationSettingsRequest { - // Required. The organization settings resource to update. - OrganizationSettings organization_settings = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the settings resource. - // - // If empty all mutable fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating a source. -message UpdateSourceRequest { - // Required. The source resource to update. - Source source = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the source resource. - // - // If empty all mutable fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating a SecurityMarks resource. -message UpdateSecurityMarksRequest { - // Required. The security marks resource to update. - SecurityMarks security_marks = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the security marks resource. - // - // The field mask must not contain duplicate fields. - // If empty or set to "marks", all marks will be replaced. Individual - // marks can be updated using "marks.". - google.protobuf.FieldMask update_mask = 2; - - // The time at which the updated SecurityMarks take effect. - // If not set uses current server time. Updates will be applied to the - // SecurityMarks that are active immediately preceding this time. - google.protobuf.Timestamp start_time = 3; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/source.proto b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/source.proto deleted file mode 100644 index bcbc5e62a87..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/source.proto +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2021 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. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/api/resource.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "cloud.google.com/go/securitycenter/apiv1p1beta1/securitycenterpb;securitycenterpb"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; - -// Security Command Center finding source. A finding source -// is an entity or a mechanism that can produce a finding. A source is like a -// container of findings that come from the same scanner, logger, monitor, etc. -message Source { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/Source" - pattern: "organizations/{organization}/sources/{source}" - pattern: "folders/{folder}/sources/{source}" - pattern: "projects/{project}/sources/{source}" - }; - - // The relative resource name of this source. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/sources/{source_id}" - string name = 1; - - // The source's display name. - // A source's display name must be unique amongst its siblings, for example, - // two sources with the same parent can't share the same display name. - // The display name must have a length between 1 and 64 characters - // (inclusive). - string display_name = 2; - - // The description of the source (max of 1024 characters). - // Example: - // "Web Security Scanner is a web security scanner for common - // vulnerabilities in App Engine applications. It can automatically - // scan and detect four common vulnerabilities, including cross-site-scripting - // (XSS), Flash injection, mixed content (HTTP in HTTPS), and - // outdated/insecure libraries." - string description = 3; - - // The canonical name of the finding. It's either - // "organizations/{organization_id}/sources/{source_id}", - // "folders/{folder_id}/sources/{source_id}" or - // "projects/{project_number}/sources/{source_id}", - // depending on the closest CRM ancestor of the resource associated with the - // finding. - string canonical_name = 14; -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_finding.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_finding.js deleted file mode 100644 index 3df65f018d4..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_finding.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, findingId, finding) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_CreateFinding_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new finding's parent. Its format should be - * "organizations/[organization_id]/sources/[source_id]". - */ - // const parent = 'abc123' - /** - * Required. Unique identifier provided by the client within the parent scope. - */ - // const findingId = 'abc123' - /** - * Required. The Finding being created. The name and security_marks will be ignored as - * they are both output only fields on this resource. - */ - // const finding = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateFinding() { - // Construct request - const request = { - parent, - findingId, - finding, - }; - - // Run request - const response = await securitycenterClient.createFinding(request); - console.log(response); - } - - callCreateFinding(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_CreateFinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_notification_config.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_notification_config.js deleted file mode 100644 index 5768d3580d4..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_notification_config.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, configId, notificationConfig) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_CreateNotificationConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new notification config's parent. Its format is - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - /** - * Required. Unique identifier provided by the client within the parent scope. - * It must be between 1 and 128 characters, and contains alphanumeric - * characters, underscores or hyphens only. - */ - // const configId = 'abc123' - /** - * Required. The notification config being created. The name and the service account - * will be ignored as they are both output only fields on this resource. - */ - // const notificationConfig = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateNotificationConfig() { - // Construct request - const request = { - parent, - configId, - notificationConfig, - }; - - // Run request - const response = await securitycenterClient.createNotificationConfig(request); - console.log(response); - } - - callCreateNotificationConfig(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_CreateNotificationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_source.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_source.js deleted file mode 100644 index 6f5123ca148..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.create_source.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, source) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_CreateSource_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new source's parent. Its format should be - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - /** - * Required. The Source being created, only the display_name and description will be - * used. All other fields will be ignored. - */ - // const source = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateSource() { - // Construct request - const request = { - parent, - source, - }; - - // Run request - const response = await securitycenterClient.createSource(request); - console.log(response); - } - - callCreateSource(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_CreateSource_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.delete_notification_config.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.delete_notification_config.js deleted file mode 100644 index b1d0cb91463..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.delete_notification_config.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_DeleteNotificationConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the notification config to delete. Its format is - * "organizations/[organization_id]/notificationConfigs/[config_id]". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callDeleteNotificationConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.deleteNotificationConfig(request); - console.log(response); - } - - callDeleteNotificationConfig(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_DeleteNotificationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_iam_policy.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_iam_policy.js deleted file mode 100644 index 85423c33d91..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_iam_policy.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resource) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_GetIamPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - */ - // const options = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await securitycenterClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_GetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_notification_config.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_notification_config.js deleted file mode 100644 index d72744e6dc5..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_notification_config.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_GetNotificationConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the notification config to get. Its format is - * "organizations/[organization_id]/notificationConfigs/[config_id]". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetNotificationConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getNotificationConfig(request); - console.log(response); - } - - callGetNotificationConfig(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_GetNotificationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_organization_settings.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_organization_settings.js deleted file mode 100644 index 5e2c2ddc9e1..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_organization_settings.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_GetOrganizationSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to get organization settings for. Its format is - * "organizations/[organization_id]/organizationSettings". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetOrganizationSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getOrganizationSettings(request); - console.log(response); - } - - callGetOrganizationSettings(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_GetOrganizationSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_source.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_source.js deleted file mode 100644 index 03fb8bcc620..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.get_source.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_GetSource_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Relative resource name of the source. Its format is - * "organizations/[organization_id]/source/[source_id]". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetSource() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getSource(request); - console.log(response); - } - - callGetSource(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_GetSource_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.group_assets.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.group_assets.js deleted file mode 100644 index be3d0814d8b..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.group_assets.js +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, groupBy) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_GroupAssets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across assets. - * 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 Asset resource. Examples include: - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * 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. - * The following field and operator combinations are supported: - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_name_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * For example, `resource_properties.size = 100` is a valid filter string. - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - */ - // const filter = 'abc123' - /** - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * The following fields are supported when compare_duration is not set: - * * security_center_properties.resource_project - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * * security_center_properties.resource_parent_display_name - * The following fields are supported when compare_duration is set: - * * security_center_properties.resource_type - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_parent_display_name - */ - // const groupBy = 'abc123' - /** - * When compare_duration is set, the GroupResult's "state_change" property is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * The state change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * Possible "state_change" values when compare_duration is specified: - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * If this field is set then `state_change` must be a specified field in - * `group_by`. - */ - // const compareDuration = {} - /** - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - */ - // const readTime = {} - /** - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGroupAssets() { - // Construct request - const request = { - parent, - groupBy, - }; - - // Run request - const iterable = await securitycenterClient.groupAssetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callGroupAssets(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_GroupAssets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.group_findings.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.group_findings.js deleted file mode 100644 index c5a599abd19..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.group_findings.js +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, groupBy) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_GroupFindings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]", - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]. To groupBy across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - * or projects/{project_id}/sources/- - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across findings. - * The expression is a list of one 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. Examples include: - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * 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. - * The following field and operator combinations are supported: - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * * severity: `=`, `:` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * For example, `source_properties.size = 100` is a valid filter string. - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - */ - // const filter = 'abc123' - /** - * Required. Expression that defines what assets fields to use for grouping (including - * `state_change`). The string value should follow SQL syntax: comma separated - * list of fields. For example: "parent,resource_name". - * The following fields are supported: - * * resource_name - * * category - * * state - * * parent - * * severity - * The following fields are supported when compare_duration is set: - * * state_change - */ - // const groupBy = 'abc123' - /** - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - */ - // const readTime = {} - /** - * When compare_duration is set, the GroupResult's "state_change" attribute is - * updated to indicate whether the finding had its state changed, the - * finding's state remained unchanged, or if the finding was added during the - * compare_duration period of time that precedes the read_time. This is the - * time between (read_time - compare_duration) and read_time. - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * Possible "state_change" values when compare_duration is specified: - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present - * at read_time. - * If this field is set then `state_change` must be a specified field in - * `group_by`. - */ - // const compareDuration = {} - /** - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGroupFindings() { - // Construct request - const request = { - parent, - groupBy, - }; - - // Run request - const iterable = await securitycenterClient.groupFindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callGroupFindings(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_GroupFindings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_assets.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_assets.js deleted file mode 100644 index 1115296d82a..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_assets.js +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_ListAssets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across assets. - * 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 Asset resource. Examples include: - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * 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. - * The following are the allowed field and operator combinations: - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * For example, `resource_properties.size = 100` is a valid filter string. - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - */ - // const filter = 'abc123' - /** - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * The following fields are supported: - * name - * update_time - * resource_properties - * security_marks.marks - * security_center_properties.resource_name - * security_center_properties.resource_display_name - * security_center_properties.resource_parent - * security_center_properties.resource_parent_display_name - * security_center_properties.resource_project - * security_center_properties.resource_project_display_name - * security_center_properties.resource_type - */ - // const orderBy = 'abc123' - /** - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - */ - // const readTime = {} - /** - * When compare_duration is set, the ListAssetsResult's "state_change" - * attribute is updated to indicate whether the asset was added, removed, or - * remained present during the compare_duration period of time that precedes - * the read_time. This is the time between (read_time - compare_duration) and - * read_time. - * The state_change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * Possible "state_change" values when compare_duration is specified: - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - */ - // const compareDuration = {} - /** - * A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - */ - // const fieldMask = {} - /** - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListAssets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listAssetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAssets(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_ListAssets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_findings.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_findings.js deleted file mode 100644 index 7aec1ebd9da..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_findings.js +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_ListFindings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id], - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]". To list across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - * projects/{projects_id}/sources/- - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across findings. - * The expression is a list of one 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. Examples include: - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * 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. - * The following field and operator combinations are supported: - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * * severity: `=`, `:` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * security_marks.marks: `=`, `:` - * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * For example, `source_properties.size = 100` is a valid filter string. - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - */ - // const filter = 'abc123' - /** - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * The following fields are supported: - * name - * parent - * state - * category - * resource_name - * event_time - * source_properties - * security_marks.marks - */ - // const orderBy = 'abc123' - /** - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - */ - // const readTime = {} - /** - * When compare_duration is set, the ListFindingsResult's "state_change" - * attribute is updated to indicate whether the finding had its state changed, - * the finding's state remained unchanged, or if the finding was added in any - * state during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * Possible "state_change" values when compare_duration is specified: - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present at - * read_time. - */ - // const compareDuration = {} - /** - * A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - */ - // const fieldMask = {} - /** - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListFindings() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listFindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFindings(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_ListFindings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_notification_configs.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_notification_configs.js deleted file mode 100644 index f5b4a970498..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_notification_configs.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_ListNotificationConfigs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to list notification configs. - * Its format is "organizations/[organization_id]". - */ - // const parent = 'abc123' - /** - * The value returned by the last `ListNotificationConfigsResponse`; indicates - * that this is a continuation of a prior `ListNotificationConfigs` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListNotificationConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listNotificationConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListNotificationConfigs(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_ListNotificationConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_sources.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_sources.js deleted file mode 100644 index 62e89a0b967..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.list_sources.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_ListSources_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - */ - // const parent = 'abc123' - /** - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListSources() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listSourcesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSources(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_ListSources_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.run_asset_discovery.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.run_asset_discovery.js deleted file mode 100644 index 753137e4768..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.run_asset_discovery.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to run asset discovery for. Its format is - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callRunAssetDiscovery() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await securitycenterClient.runAssetDiscovery(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRunAssetDiscovery(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.set_finding_state.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.set_finding_state.js deleted file mode 100644 index d3441869f8e..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.set_finding_state.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, state, startTime) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_SetFindingState_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the finding. See: - * https://cloud.google.com/apis/design/resource_names#relative_resource_name - * Example: - * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". - */ - // const name = 'abc123' - /** - * Required. The desired State of the finding. - */ - // const state = {} - /** - * Required. The time at which the updated state takes effect. - */ - // const startTime = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callSetFindingState() { - // Construct request - const request = { - name, - state, - startTime, - }; - - // Run request - const response = await securitycenterClient.setFindingState(request); - console.log(response); - } - - callSetFindingState(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_SetFindingState_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.set_iam_policy.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.set_iam_policy.js deleted file mode 100644 index e131922facc..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.set_iam_policy.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resource, policy) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_SetIamPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - */ - // const policy = {} - /** - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * `paths: "bindings, etag"` - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await securitycenterClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_SetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.test_iam_permissions.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.test_iam_permissions.js deleted file mode 100644 index 4d9bbb4d4cc..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.test_iam_permissions.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resource, permissions) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_TestIamPermissions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). - */ - // const permissions = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await securitycenterClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_TestIamPermissions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_finding.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_finding.js deleted file mode 100644 index 119392f721a..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_finding.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(finding) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateFinding_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The finding resource to update or create if it does not already exist. - * parent, security_marks, and update_time will be ignored. - * In the case of creation, the finding id portion of the name must be - * alphanumeric and less than or equal to 32 characters and greater than 0 - * characters in length. - */ - // const finding = {} - /** - * The FieldMask to use when updating the finding resource. This field should - * not be specified when creating a finding. - * When updating a finding, an empty mask is treated as updating all mutable - * fields and replacing source_properties. Individual source_properties can - * be added/updated by using "source_properties." in the field - * mask. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateFinding() { - // Construct request - const request = { - finding, - }; - - // Run request - const response = await securitycenterClient.updateFinding(request); - console.log(response); - } - - callUpdateFinding(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateFinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_notification_config.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_notification_config.js deleted file mode 100644 index 27fc14769eb..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_notification_config.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(notificationConfig) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateNotificationConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The notification config to update. - */ - // const notificationConfig = {} - /** - * The FieldMask to use when updating the notification config. - * If empty all mutable fields will be updated. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateNotificationConfig() { - // Construct request - const request = { - notificationConfig, - }; - - // Run request - const response = await securitycenterClient.updateNotificationConfig(request); - console.log(response); - } - - callUpdateNotificationConfig(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateNotificationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_organization_settings.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_organization_settings.js deleted file mode 100644 index c0ce463a1bd..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_organization_settings.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(organizationSettings) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The organization settings resource to update. - */ - // const organizationSettings = {} - /** - * The FieldMask to use when updating the settings resource. - * If empty all mutable fields will be updated. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateOrganizationSettings() { - // Construct request - const request = { - organizationSettings, - }; - - // Run request - const response = await securitycenterClient.updateOrganizationSettings(request); - console.log(response); - } - - callUpdateOrganizationSettings(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_security_marks.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_security_marks.js deleted file mode 100644 index bd99d48ec65..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_security_marks.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(securityMarks) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSecurityMarks_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The security marks resource to update. - */ - // const securityMarks = {} - /** - * The FieldMask to use when updating the security marks resource. - * The field mask must not contain duplicate fields. - * If empty or set to "marks", all marks will be replaced. Individual - * marks can be updated using "marks.". - */ - // const updateMask = {} - /** - * The time at which the updated SecurityMarks take effect. - * If not set uses current server time. Updates will be applied to the - * SecurityMarks that are active immediately preceding this time. - */ - // const startTime = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateSecurityMarks() { - // Construct request - const request = { - securityMarks, - }; - - // Run request - const response = await securitycenterClient.updateSecurityMarks(request); - console.log(response); - } - - callUpdateSecurityMarks(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSecurityMarks_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_source.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_source.js deleted file mode 100644 index c005661cf71..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/security_center.update_source.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(source) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSource_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The source resource to update. - */ - // const source = {} - /** - * The FieldMask to use when updating the source resource. - * If empty all mutable fields will be updated. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateSource() { - // Construct request - const request = { - source, - }; - - // Run request - const response = await securitycenterClient.updateSource(request); - console.log(response); - } - - callUpdateSource(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSource_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json deleted file mode 100644 index 73ceda373e3..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json +++ /dev/null @@ -1,1123 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-securitycenter", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.securitycenter.v1p1beta1", - "version": "v1p1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_CreateSource_async", - "title": "SecurityCenter createSource Sample", - "origin": "API_DEFINITION", - "description": " Creates a source.", - "canonical": true, - "file": "security_center.create_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSource", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateSource", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "source", - "type": ".google.cloud.securitycenter.v1p1beta1.Source" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.Source", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateSource", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateSource", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_CreateFinding_async", - "title": "SecurityCenter createFinding Sample", - "origin": "API_DEFINITION", - "description": " Creates a finding. The corresponding source must exist for finding creation to succeed.", - "canonical": true, - "file": "security_center.create_finding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFinding", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateFinding", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "finding_id", - "type": "TYPE_STRING" - }, - { - "name": "finding", - "type": ".google.cloud.securitycenter.v1p1beta1.Finding" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateFinding", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateFinding", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_CreateNotificationConfig_async", - "title": "SecurityCenter createNotificationConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a notification config.", - "canonical": true, - "file": "security_center.create_notification_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateNotificationConfig", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateNotificationConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "config_id", - "type": "TYPE_STRING" - }, - { - "name": "notification_config", - "type": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateNotificationConfig", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateNotificationConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_DeleteNotificationConfig_async", - "title": "SecurityCenter deleteNotificationConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes a notification config.", - "canonical": true, - "file": "security_center.delete_notification_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteNotificationConfig", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.DeleteNotificationConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "DeleteNotificationConfig", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.DeleteNotificationConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GetIamPolicy_async", - "title": "SecurityCenter getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the access control policy on the specified Source.", - "canonical": true, - "file": "security_center.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetIamPolicy", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GetNotificationConfig_async", - "title": "SecurityCenter getNotificationConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a notification config.", - "canonical": true, - "file": "security_center.get_notification_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNotificationConfig", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetNotificationConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GetNotificationConfig", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetNotificationConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GetOrganizationSettings_async", - "title": "SecurityCenter getOrganizationSettings Sample", - "origin": "API_DEFINITION", - "description": " Gets the settings for an organization.", - "canonical": true, - "file": "security_center.get_organization_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetOrganizationSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.OrganizationSettings", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GetOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetOrganizationSettings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GetSource_async", - "title": "SecurityCenter getSource Sample", - "origin": "API_DEFINITION", - "description": " Gets a source.", - "canonical": true, - "file": "security_center.get_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSource", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetSource", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.Source", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GetSource", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetSource", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GroupAssets_async", - "title": "SecurityCenter groupAssets Sample", - "origin": "API_DEFINITION", - "description": " Filters an organization's assets and groups them by their specified properties.", - "canonical": true, - "file": "security_center.group_assets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 168, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GroupAssets", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GroupAssets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "group_by", - "type": "TYPE_STRING" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.GroupAssetsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GroupAssets", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GroupAssets", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GroupFindings_async", - "title": "SecurityCenter groupFindings Sample", - "origin": "API_DEFINITION", - "description": " Filters an organization or source's findings and groups them by their specified properties. To group across all sources provide a `-` as the source id. Example: /v1/organizations/{organization_id}/sources/-/findings, /v1/folders/{folder_id}/sources/-/findings, /v1/projects/{project_id}/sources/-/findings", - "canonical": true, - "file": "security_center.group_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 164, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GroupFindings", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GroupFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "group_by", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.GroupFindingsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GroupFindings", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GroupFindings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_ListAssets_async", - "title": "SecurityCenter listAssets Sample", - "origin": "API_DEFINITION", - "description": " Lists an organization's assets.", - "canonical": true, - "file": "security_center.list_assets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 177, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAssets", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListAssets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "field_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.ListAssetsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "ListAssets", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListAssets", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_ListFindings_async", - "title": "SecurityCenter listFindings Sample", - "origin": "API_DEFINITION", - "description": " Lists an organization or source's findings. To list across all sources provide a `-` as the source id. Example: /v1p1beta1/organizations/{organization_id}/sources/-/findings", - "canonical": true, - "file": "security_center.list_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 173, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFindings", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "field_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.ListFindingsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "ListFindings", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListFindings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_ListNotificationConfigs_async", - "title": "SecurityCenter listNotificationConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists notification configs.", - "canonical": true, - "file": "security_center.list_notification_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNotificationConfigs", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListNotificationConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "ListNotificationConfigs", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListNotificationConfigs", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_ListSources_async", - "title": "SecurityCenter listSources Sample", - "origin": "API_DEFINITION", - "description": " Lists all sources belonging to an organization.", - "canonical": true, - "file": "security_center.list_sources.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSources", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListSources", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.ListSourcesResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "ListSources", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListSources", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async", - "title": "SecurityCenter runAssetDiscovery Sample", - "origin": "API_DEFINITION", - "description": " Runs asset discovery. The discovery is tracked with a long-running operation. This API can only be called with limited frequency for an organization. If it is called too frequently the caller will receive a TOO_MANY_REQUESTS error.", - "canonical": true, - "file": "security_center.run_asset_discovery.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RunAssetDiscovery", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.RunAssetDiscovery", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "RunAssetDiscovery", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.RunAssetDiscovery", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_SetFindingState_async", - "title": "SecurityCenter setFindingState Sample", - "origin": "API_DEFINITION", - "description": " Updates the state of a finding.", - "canonical": true, - "file": "security_center.set_finding_state.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetFindingState", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.SetFindingState", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "state", - "type": ".google.cloud.securitycenter.v1p1beta1.Finding.State" - }, - { - "name": "start_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "SetFindingState", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.SetFindingState", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_SetIamPolicy_async", - "title": "SecurityCenter setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the access control policy on the specified Source.", - "canonical": true, - "file": "security_center.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.SetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "policy", - "type": ".google.iam.v1.Policy" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.SetIamPolicy", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_TestIamPermissions_async", - "title": "SecurityCenter testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Returns the permissions that a caller has on the specified source.", - "canonical": true, - "file": "security_center.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.TestIamPermissions", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateFinding_async", - "title": "SecurityCenter updateFinding Sample", - "origin": "API_DEFINITION", - "description": " Creates or updates a finding. The corresponding source must exist for a finding creation to succeed.", - "canonical": true, - "file": "security_center.update_finding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFinding", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateFinding", - "async": true, - "parameters": [ - { - "name": "finding", - "type": ".google.cloud.securitycenter.v1p1beta1.Finding" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateFinding", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateFinding", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateNotificationConfig_async", - "title": "SecurityCenter updateNotificationConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates a notification config. The following update fields are allowed: description, pubsub_topic, streaming_config.filter", - "canonical": true, - "file": "security_center.update_notification_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateNotificationConfig", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateNotificationConfig", - "async": true, - "parameters": [ - { - "name": "notification_config", - "type": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateNotificationConfig", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateNotificationConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async", - "title": "SecurityCenter updateOrganizationSettings Sample", - "origin": "API_DEFINITION", - "description": " Updates an organization's settings.", - "canonical": true, - "file": "security_center.update_organization_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateOrganizationSettings", - "async": true, - "parameters": [ - { - "name": "organization_settings", - "type": ".google.cloud.securitycenter.v1p1beta1.OrganizationSettings" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.OrganizationSettings", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateOrganizationSettings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSource_async", - "title": "SecurityCenter updateSource Sample", - "origin": "API_DEFINITION", - "description": " Updates a source.", - "canonical": true, - "file": "security_center.update_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSource", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateSource", - "async": true, - "parameters": [ - { - "name": "source", - "type": ".google.cloud.securitycenter.v1p1beta1.Source" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.Source", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateSource", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateSource", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSecurityMarks_async", - "title": "SecurityCenter updateSecurityMarks Sample", - "origin": "API_DEFINITION", - "description": " Updates security marks.", - "canonical": true, - "file": "security_center.update_security_marks.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSecurityMarks", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateSecurityMarks", - "async": true, - "parameters": [ - { - "name": "security_marks", - "type": ".google.cloud.securitycenter.v1p1beta1.SecurityMarks" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "start_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.SecurityMarks", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateSecurityMarks", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateSecurityMarks", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/index.ts b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/index.ts deleted file mode 100644 index ad859b27d19..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1p1beta1 from './v1p1beta1'; -const SecurityCenterClient = v1p1beta1.SecurityCenterClient; -type SecurityCenterClient = v1p1beta1.SecurityCenterClient; -export {v1p1beta1, SecurityCenterClient}; -export default {v1p1beta1, SecurityCenterClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/gapic_metadata.json deleted file mode 100644 index c0d8ccc6990..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/gapic_metadata.json +++ /dev/null @@ -1,277 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.securitycenter.v1p1beta1", - "libraryPackage": "@google-cloud/security-center", - "services": { - "SecurityCenter": { - "clients": { - "grpc": { - "libraryClient": "SecurityCenterClient", - "rpcs": { - "CreateSource": { - "methods": [ - "createSource" - ] - }, - "CreateFinding": { - "methods": [ - "createFinding" - ] - }, - "CreateNotificationConfig": { - "methods": [ - "createNotificationConfig" - ] - }, - "DeleteNotificationConfig": { - "methods": [ - "deleteNotificationConfig" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "GetNotificationConfig": { - "methods": [ - "getNotificationConfig" - ] - }, - "GetOrganizationSettings": { - "methods": [ - "getOrganizationSettings" - ] - }, - "GetSource": { - "methods": [ - "getSource" - ] - }, - "SetFindingState": { - "methods": [ - "setFindingState" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "UpdateFinding": { - "methods": [ - "updateFinding" - ] - }, - "UpdateNotificationConfig": { - "methods": [ - "updateNotificationConfig" - ] - }, - "UpdateOrganizationSettings": { - "methods": [ - "updateOrganizationSettings" - ] - }, - "UpdateSource": { - "methods": [ - "updateSource" - ] - }, - "UpdateSecurityMarks": { - "methods": [ - "updateSecurityMarks" - ] - }, - "RunAssetDiscovery": { - "methods": [ - "runAssetDiscovery" - ] - }, - "GroupAssets": { - "methods": [ - "groupAssets", - "groupAssetsStream", - "groupAssetsAsync" - ] - }, - "GroupFindings": { - "methods": [ - "groupFindings", - "groupFindingsStream", - "groupFindingsAsync" - ] - }, - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - }, - "ListNotificationConfigs": { - "methods": [ - "listNotificationConfigs", - "listNotificationConfigsStream", - "listNotificationConfigsAsync" - ] - }, - "ListSources": { - "methods": [ - "listSources", - "listSourcesStream", - "listSourcesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SecurityCenterClient", - "rpcs": { - "CreateSource": { - "methods": [ - "createSource" - ] - }, - "CreateFinding": { - "methods": [ - "createFinding" - ] - }, - "CreateNotificationConfig": { - "methods": [ - "createNotificationConfig" - ] - }, - "DeleteNotificationConfig": { - "methods": [ - "deleteNotificationConfig" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "GetNotificationConfig": { - "methods": [ - "getNotificationConfig" - ] - }, - "GetOrganizationSettings": { - "methods": [ - "getOrganizationSettings" - ] - }, - "GetSource": { - "methods": [ - "getSource" - ] - }, - "SetFindingState": { - "methods": [ - "setFindingState" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "UpdateFinding": { - "methods": [ - "updateFinding" - ] - }, - "UpdateNotificationConfig": { - "methods": [ - "updateNotificationConfig" - ] - }, - "UpdateOrganizationSettings": { - "methods": [ - "updateOrganizationSettings" - ] - }, - "UpdateSource": { - "methods": [ - "updateSource" - ] - }, - "UpdateSecurityMarks": { - "methods": [ - "updateSecurityMarks" - ] - }, - "RunAssetDiscovery": { - "methods": [ - "runAssetDiscovery" - ] - }, - "GroupAssets": { - "methods": [ - "groupAssets", - "groupAssetsStream", - "groupAssetsAsync" - ] - }, - "GroupFindings": { - "methods": [ - "groupFindings", - "groupFindingsStream", - "groupFindingsAsync" - ] - }, - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - }, - "ListNotificationConfigs": { - "methods": [ - "listNotificationConfigs", - "listNotificationConfigsStream", - "listNotificationConfigsAsync" - ] - }, - "ListSources": { - "methods": [ - "listSources", - "listSourcesStream", - "listSourcesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/index.ts b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/index.ts deleted file mode 100644 index fa3996e6154..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {SecurityCenterClient} from './security_center_client'; diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_client.ts b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_client.ts deleted file mode 100644 index d56659c1314..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_client.ts +++ /dev/null @@ -1,4943 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1p1beta1/security_center_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './security_center_client_config.json'; -const version = require('../../../package.json').version; - -/** - * V1p1Beta1 APIs for Security Center service. - * @class - * @memberof v1p1beta1 - */ -export class SecurityCenterClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - securityCenterStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SecurityCenterClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SecurityCenterClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SecurityCenterClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - folderAssetPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/assets/{asset}' - ), - folderAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/assets/{asset}/securityMarks' - ), - folderSourcePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sources/{source}' - ), - folderSourceFindingPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sources/{source}/findings/{finding}' - ), - folderSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sources/{source}/findings/{finding}/securityMarks' - ), - notificationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationConfigs/{notification_config}' - ), - organizationPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}' - ), - organizationAssetPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/assets/{asset}' - ), - organizationAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/assets/{asset}/securityMarks' - ), - organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/organizationSettings' - ), - organizationSourcePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}' - ), - organizationSourceFindingPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}/findings/{finding}' - ), - organizationSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks' - ), - projectAssetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/assets/{asset}' - ), - projectAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/assets/{asset}/securityMarks' - ), - projectSourcePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sources/{source}' - ), - projectSourceFindingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sources/{source}/findings/{finding}' - ), - projectSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sources/{source}/findings/{finding}/securityMarks' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - groupAssets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), - groupFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), - listAssets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listAssetsResults'), - listFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listFindingsResults'), - listNotificationConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'notificationConfigs'), - listSources: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sources') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1p1beta1/{name=organizations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1p1beta1/{name=organizations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1p1beta1/{name=organizations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1p1beta1/{name=organizations/*/operations}',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const runAssetDiscoveryResponse = protoFilesRoot.lookup( - '.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryResponse') as gax.protobuf.Type; - const runAssetDiscoveryMetadata = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - - this.descriptors.longrunning = { - runAssetDiscovery: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - runAssetDiscoveryResponse.decode.bind(runAssetDiscoveryResponse), - runAssetDiscoveryMetadata.decode.bind(runAssetDiscoveryMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.securitycenter.v1p1beta1.SecurityCenter', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.securityCenterStub) { - return this.securityCenterStub; - } - - // Put together the "service stub" for - // google.cloud.securitycenter.v1p1beta1.SecurityCenter. - this.securityCenterStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.securitycenter.v1p1beta1.SecurityCenter') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.securitycenter.v1p1beta1.SecurityCenter, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const securityCenterStubMethods = - ['createSource', 'createFinding', 'createNotificationConfig', 'deleteNotificationConfig', 'getIamPolicy', 'getNotificationConfig', 'getOrganizationSettings', 'getSource', 'groupAssets', 'groupFindings', 'listAssets', 'listFindings', 'listNotificationConfigs', 'listSources', 'runAssetDiscovery', 'setFindingState', 'setIamPolicy', 'testIamPermissions', 'updateFinding', 'updateNotificationConfig', 'updateOrganizationSettings', 'updateSource', 'updateSecurityMarks']; - for (const methodName of securityCenterStubMethods) { - const callPromise = this.securityCenterStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.securityCenterStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'securitycenter.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'securitycenter.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new source's parent. Its format should be - * "organizations/[organization_id]". - * @param {google.cloud.securitycenter.v1p1beta1.Source} request.source - * Required. The Source being created, only the display_name and description will be - * used. All other fields will be ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.Source | Source}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.create_source.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_CreateSource_async - */ - createSource( - request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|undefined, {}|undefined - ]>; - createSource( - request: protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|null|undefined, - {}|null|undefined>): void; - createSource( - request: protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|null|undefined, - {}|null|undefined>): void; - createSource( - request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createSource(request, options, callback); - } -/** - * Creates a finding. The corresponding source must exist for finding - * creation to succeed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new finding's parent. Its format should be - * "organizations/[organization_id]/sources/[source_id]". - * @param {string} request.findingId - * Required. Unique identifier provided by the client within the parent scope. - * @param {google.cloud.securitycenter.v1p1beta1.Finding} request.finding - * Required. The Finding being created. The name and security_marks will be ignored as - * they are both output only fields on this resource. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.Finding | Finding}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.create_finding.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_CreateFinding_async - */ - createFinding( - request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|undefined, {}|undefined - ]>; - createFinding( - request: protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|null|undefined, - {}|null|undefined>): void; - createFinding( - request: protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|null|undefined, - {}|null|undefined>): void; - createFinding( - request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createFinding(request, options, callback); - } -/** - * Creates a notification config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new notification config's parent. Its format is - * "organizations/[organization_id]". - * @param {string} request.configId - * Required. Unique identifier provided by the client within the parent scope. - * It must be between 1 and 128 characters, and contains alphanumeric - * characters, underscores or hyphens only. - * @param {google.cloud.securitycenter.v1p1beta1.NotificationConfig} request.notificationConfig - * Required. The notification config being created. The name and the service account - * will be ignored as they are both output only fields on this resource. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.NotificationConfig | NotificationConfig}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.create_notification_config.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_CreateNotificationConfig_async - */ - createNotificationConfig( - request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|undefined, {}|undefined - ]>; - createNotificationConfig( - request: protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - createNotificationConfig( - request: protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - createNotificationConfig( - request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createNotificationConfig(request, options, callback); - } -/** - * Deletes a notification config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the notification config to delete. Its format is - * "organizations/[organization_id]/notificationConfigs/[config_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.protobuf.Empty | Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.delete_notification_config.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_DeleteNotificationConfig_async - */ - deleteNotificationConfig( - request?: protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|undefined, {}|undefined - ]>; - deleteNotificationConfig( - request: protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteNotificationConfig( - request: protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteNotificationConfig( - request?: protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteNotificationConfig(request, options, callback); - } -/** - * Gets the access control policy on the specified Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.get_iam_policy.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GetIamPolicy_async - */ - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize(); - return this.innerApiCalls.getIamPolicy(request, options, callback); - } -/** - * Gets a notification config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the notification config to get. Its format is - * "organizations/[organization_id]/notificationConfigs/[config_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.NotificationConfig | NotificationConfig}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.get_notification_config.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GetNotificationConfig_async - */ - getNotificationConfig( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|undefined, {}|undefined - ]>; - getNotificationConfig( - request: protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - getNotificationConfig( - request: protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - getNotificationConfig( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getNotificationConfig(request, options, callback); - } -/** - * Gets the settings for an organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the organization to get organization settings for. Its format is - * "organizations/[organization_id]/organizationSettings". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.OrganizationSettings | OrganizationSettings}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.get_organization_settings.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GetOrganizationSettings_async - */ - getOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|undefined, {}|undefined - ]>; - getOrganizationSettings( - request: protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - getOrganizationSettings( - request: protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - getOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getOrganizationSettings(request, options, callback); - } -/** - * Gets a source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Relative resource name of the source. Its format is - * "organizations/[organization_id]/source/[source_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.Source | Source}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.get_source.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GetSource_async - */ - getSource( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|undefined, {}|undefined - ]>; - getSource( - request: protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|null|undefined, - {}|null|undefined>): void; - getSource( - request: protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|null|undefined, - {}|null|undefined>): void; - getSource( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getSource(request, options, callback); - } -/** - * Updates the state of a finding. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the finding. See: - * https://cloud.google.com/apis/design/resource_names#relative_resource_name - * Example: - * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". - * @param {google.cloud.securitycenter.v1p1beta1.Finding.State} request.state - * Required. The desired State of the finding. - * @param {google.protobuf.Timestamp} request.startTime - * Required. The time at which the updated state takes effect. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.Finding | Finding}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.set_finding_state.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_SetFindingState_async - */ - setFindingState( - request?: protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|undefined, {}|undefined - ]>; - setFindingState( - request: protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>): void; - setFindingState( - request: protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>): void; - setFindingState( - request?: protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.setFindingState(request, options, callback); - } -/** - * Sets the access control policy on the specified Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.Policy} request.policy - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param {google.protobuf.FieldMask} request.updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.set_iam_policy.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_SetIamPolicy_async - */ - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize(); - return this.innerApiCalls.setIamPolicy(request, options, callback); - } -/** - * Returns the permissions that a caller has on the specified source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.test_iam_permissions.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_TestIamPermissions_async - */ - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize(); - return this.innerApiCalls.testIamPermissions(request, options, callback); - } -/** - * Creates or updates a finding. The corresponding source must exist for a - * finding creation to succeed. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1p1beta1.Finding} request.finding - * Required. The finding resource to update or create if it does not already exist. - * parent, security_marks, and update_time will be ignored. - * - * In the case of creation, the finding id portion of the name must be - * alphanumeric and less than or equal to 32 characters and greater than 0 - * characters in length. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the finding resource. This field should - * not be specified when creating a finding. - * - * When updating a finding, an empty mask is treated as updating all mutable - * fields and replacing source_properties. Individual source_properties can - * be added/updated by using "source_properties." in the field - * mask. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.Finding | Finding}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.update_finding.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateFinding_async - */ - updateFinding( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|undefined, {}|undefined - ]>; - updateFinding( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>): void; - updateFinding( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>): void; - updateFinding( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'finding.name': request.finding!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFinding(request, options, callback); - } -/** - * Updates a notification config. The following update - * fields are allowed: description, pubsub_topic, streaming_config.filter - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1p1beta1.NotificationConfig} request.notificationConfig - * Required. The notification config to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the notification config. - * - * If empty all mutable fields will be updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.NotificationConfig | NotificationConfig}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.update_notification_config.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateNotificationConfig_async - */ - updateNotificationConfig( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|undefined, {}|undefined - ]>; - updateNotificationConfig( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - updateNotificationConfig( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - updateNotificationConfig( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'notification_config.name': request.notificationConfig!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateNotificationConfig(request, options, callback); - } -/** - * Updates an organization's settings. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1p1beta1.OrganizationSettings} request.organizationSettings - * Required. The organization settings resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the settings resource. - * - * If empty all mutable fields will be updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.OrganizationSettings | OrganizationSettings}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.update_organization_settings.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async - */ - updateOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|undefined, {}|undefined - ]>; - updateOrganizationSettings( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateOrganizationSettings( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'organization_settings.name': request.organizationSettings!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateOrganizationSettings(request, options, callback); - } -/** - * Updates a source. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1p1beta1.Source} request.source - * Required. The source resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the source resource. - * - * If empty all mutable fields will be updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.Source | Source}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.update_source.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSource_async - */ - updateSource( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|undefined, {}|undefined - ]>; - updateSource( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>): void; - updateSource( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>): void; - updateSource( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'source.name': request.source!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSource(request, options, callback); - } -/** - * Updates security marks. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1p1beta1.SecurityMarks} request.securityMarks - * Required. The security marks resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the security marks resource. - * - * The field mask must not contain duplicate fields. - * If empty or set to "marks", all marks will be replaced. Individual - * marks can be updated using "marks.". - * @param {google.protobuf.Timestamp} request.startTime - * The time at which the updated SecurityMarks take effect. - * If not set uses current server time. Updates will be applied to the - * SecurityMarks that are active immediately preceding this time. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.securitycenter.v1p1beta1.SecurityMarks | SecurityMarks}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.update_security_marks.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSecurityMarks_async - */ - updateSecurityMarks( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|undefined, {}|undefined - ]>; - updateSecurityMarks( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>): void; - updateSecurityMarks( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>): void; - updateSecurityMarks( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'security_marks.name': request.securityMarks!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSecurityMarks(request, options, callback); - } - -/** - * Runs asset discovery. The discovery is tracked with a long-running - * operation. - * - * This API can only be called with limited frequency for an organization. If - * it is called too frequently the caller will receive a TOO_MANY_REQUESTS - * error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to run asset discovery for. Its format is - * "organizations/[organization_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.run_asset_discovery.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async - */ - runAssetDiscovery( - request?: protos.google.cloud.securitycenter.v1p1beta1.IRunAssetDiscoveryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - runAssetDiscovery( - request: protos.google.cloud.securitycenter.v1p1beta1.IRunAssetDiscoveryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runAssetDiscovery( - request: protos.google.cloud.securitycenter.v1p1beta1.IRunAssetDiscoveryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runAssetDiscovery( - request?: protos.google.cloud.securitycenter.v1p1beta1.IRunAssetDiscoveryRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.runAssetDiscovery(request, options, callback); - } -/** - * Check the status of the long running operation returned by `runAssetDiscovery()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.run_asset_discovery.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async - */ - async checkRunAssetDiscoveryProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runAssetDiscovery, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Filters an organization's assets and groups them by their specified - * properties. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * 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 Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_name_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * - * The following fields are supported when compare_duration is not set: - * - * * security_center_properties.resource_project - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * * security_center_properties.resource_parent_display_name - * - * The following fields are supported when compare_duration is set: - * - * * security_center_properties.resource_type - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_parent_display_name - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" property is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1p1beta1.GroupResult | GroupResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `groupAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - groupAssets( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[], - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse - ]>; - groupAssets( - request: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): void; - groupAssets( - request: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): void; - groupAssets( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[], - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.groupAssets(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * 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 Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_name_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * - * The following fields are supported when compare_duration is not set: - * - * * security_center_properties.resource_project - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * * security_center_properties.resource_parent_display_name - * - * The following fields are supported when compare_duration is set: - * - * * security_center_properties.resource_type - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_parent_display_name - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" property is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1p1beta1.GroupResult | GroupResult} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `groupAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - groupAssetsStream( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['groupAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupAssets.createStream( - this.innerApiCalls.groupAssets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `groupAssets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * 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 Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_name_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * - * The following fields are supported when compare_duration is not set: - * - * * security_center_properties.resource_project - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * * security_center_properties.resource_parent_display_name - * - * The following fields are supported when compare_duration is set: - * - * * security_center_properties.resource_type - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_parent_display_name - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" property is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1p1beta1.GroupResult | GroupResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.group_assets.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GroupAssets_async - */ - groupAssetsAsync( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['groupAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupAssets.asyncIterate( - this.innerApiCalls['groupAssets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Filters an organization or source's findings and groups them by their - * specified properties. - * - * To group across all sources provide a `-` as the source id. - * Example: /v1/organizations/{organization_id}/sources/-/findings, - * /v1/folders/{folder_id}/sources/-/findings, - * /v1/projects/{project_id}/sources/-/findings - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]", - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]. To groupBy across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - * or projects/{project_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one 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. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * * severity: `=`, `:` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping (including - * `state_change`). The string value should follow SQL syntax: comma separated - * list of fields. For example: "parent,resource_name". - * - * The following fields are supported: - * - * * resource_name - * * category - * * state - * * parent - * * severity - * - * The following fields are supported when compare_duration is set: - * - * * state_change - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" attribute is - * updated to indicate whether the finding had its state changed, the - * finding's state remained unchanged, or if the finding was added during the - * compare_duration period of time that precedes the read_time. This is the - * time between (read_time - compare_duration) and read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present - * at read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {string} request.pageToken - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1p1beta1.GroupResult | GroupResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `groupFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - groupFindings( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[], - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse - ]>; - groupFindings( - request: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): void; - groupFindings( - request: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): void; - groupFindings( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[], - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.groupFindings(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]", - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]. To groupBy across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - * or projects/{project_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one 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. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * * severity: `=`, `:` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping (including - * `state_change`). The string value should follow SQL syntax: comma separated - * list of fields. For example: "parent,resource_name". - * - * The following fields are supported: - * - * * resource_name - * * category - * * state - * * parent - * * severity - * - * The following fields are supported when compare_duration is set: - * - * * state_change - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" attribute is - * updated to indicate whether the finding had its state changed, the - * finding's state remained unchanged, or if the finding was added during the - * compare_duration period of time that precedes the read_time. This is the - * time between (read_time - compare_duration) and read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present - * at read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {string} request.pageToken - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1p1beta1.GroupResult | GroupResult} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `groupFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - groupFindingsStream( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['groupFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupFindings.createStream( - this.innerApiCalls.groupFindings as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `groupFindings`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]", - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]. To groupBy across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - * or projects/{project_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one 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. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * * severity: `=`, `:` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping (including - * `state_change`). The string value should follow SQL syntax: comma separated - * list of fields. For example: "parent,resource_name". - * - * The following fields are supported: - * - * * resource_name - * * category - * * state - * * parent - * * severity - * - * The following fields are supported when compare_duration is set: - * - * * state_change - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" attribute is - * updated to indicate whether the finding had its state changed, the - * finding's state remained unchanged, or if the finding was added during the - * compare_duration period of time that precedes the read_time. This is the - * time between (read_time - compare_duration) and read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present - * at read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {string} request.pageToken - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1p1beta1.GroupResult | GroupResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.group_findings.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GroupFindings_async - */ - groupFindingsAsync( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['groupFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupFindings.asyncIterate( - this.innerApiCalls['groupFindings'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists an organization's assets. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * 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 Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following are the allowed field and operator combinations: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * update_time - * resource_properties - * security_marks.marks - * security_center_properties.resource_name - * security_center_properties.resource_display_name - * security_center_properties.resource_parent - * security_center_properties.resource_parent_display_name - * security_center_properties.resource_project - * security_center_properties.resource_project_display_name - * security_center_properties.resource_type - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListAssetsResult's "state_change" - * attribute is updated to indicate whether the asset was added, removed, or - * remained present during the compare_duration period of time that precedes - * the read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult | ListAssetsResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAssets( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[], - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse - ]>; - listAssets( - request: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult>): void; - listAssets( - request: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult>): void; - listAssets( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[], - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listAssets(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * 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 Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following are the allowed field and operator combinations: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * update_time - * resource_properties - * security_marks.marks - * security_center_properties.resource_name - * security_center_properties.resource_display_name - * security_center_properties.resource_parent - * security_center_properties.resource_parent_display_name - * security_center_properties.resource_project - * security_center_properties.resource_project_display_name - * security_center_properties.resource_type - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListAssetsResult's "state_change" - * attribute is updated to indicate whether the asset was added, removed, or - * remained present during the compare_duration period of time that precedes - * the read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult | ListAssetsResult} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAssetsStream( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssets.createStream( - this.innerApiCalls.listAssets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAssets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * 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 Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following are the allowed field and operator combinations: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * update_time - * resource_properties - * security_marks.marks - * security_center_properties.resource_name - * security_center_properties.resource_display_name - * security_center_properties.resource_parent - * security_center_properties.resource_parent_display_name - * security_center_properties.resource_project - * security_center_properties.resource_project_display_name - * security_center_properties.resource_type - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListAssetsResult's "state_change" - * attribute is updated to indicate whether the asset was added, removed, or - * remained present during the compare_duration period of time that precedes - * the read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult | ListAssetsResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.list_assets.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_ListAssets_async - */ - listAssetsAsync( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssets.asyncIterate( - this.innerApiCalls['listAssets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists an organization or source's findings. - * - * To list across all sources provide a `-` as the source id. - * Example: /v1p1beta1/organizations/{organization_id}/sources/-/findings - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id], - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]". To list across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - * projects/{projects_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one 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. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * * severity: `=`, `:` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * security_marks.marks: `=`, `:` - * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * parent - * state - * category - * resource_name - * event_time - * source_properties - * security_marks.marks - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListFindingsResult's "state_change" - * attribute is updated to indicate whether the finding had its state changed, - * the finding's state remained unchanged, or if the finding was added in any - * state during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult | ListFindingsResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listFindings( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[], - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse - ]>; - listFindings( - request: protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult>): void; - listFindings( - request: protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult>): void; - listFindings( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[], - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listFindings(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id], - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]". To list across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - * projects/{projects_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one 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. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * * severity: `=`, `:` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * security_marks.marks: `=`, `:` - * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * parent - * state - * category - * resource_name - * event_time - * source_properties - * security_marks.marks - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListFindingsResult's "state_change" - * attribute is updated to indicate whether the finding had its state changed, - * the finding's state remained unchanged, or if the finding was added in any - * state during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult | ListFindingsResult} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listFindingsStream( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFindings.createStream( - this.innerApiCalls.listFindings as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFindings`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id], - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]". To list across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - * projects/{projects_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one 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. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * 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. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * * severity: `=`, `:` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * security_marks.marks: `=`, `:` - * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * parent - * state - * category - * resource_name - * event_time - * source_properties - * security_marks.marks - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListFindingsResult's "state_change" - * attribute is updated to indicate whether the finding had its state changed, - * the finding's state remained unchanged, or if the finding was added in any - * state during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult | ListFindingsResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.list_findings.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_ListFindings_async - */ - listFindingsAsync( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFindings.asyncIterate( - this.innerApiCalls['listFindings'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists notification configs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to list notification configs. - * Its format is "organizations/[organization_id]". - * @param {string} request.pageToken - * The value returned by the last `ListNotificationConfigsResponse`; indicates - * that this is a continuation of a prior `ListNotificationConfigs` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1p1beta1.NotificationConfig | NotificationConfig}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listNotificationConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listNotificationConfigs( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[], - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse - ]>; - listNotificationConfigs( - request: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig>): void; - listNotificationConfigs( - request: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig>): void; - listNotificationConfigs( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[], - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listNotificationConfigs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to list notification configs. - * Its format is "organizations/[organization_id]". - * @param {string} request.pageToken - * The value returned by the last `ListNotificationConfigsResponse`; indicates - * that this is a continuation of a prior `ListNotificationConfigs` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1p1beta1.NotificationConfig | NotificationConfig} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listNotificationConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listNotificationConfigsStream( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listNotificationConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNotificationConfigs.createStream( - this.innerApiCalls.listNotificationConfigs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listNotificationConfigs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to list notification configs. - * Its format is "organizations/[organization_id]". - * @param {string} request.pageToken - * The value returned by the last `ListNotificationConfigsResponse`; indicates - * that this is a continuation of a prior `ListNotificationConfigs` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1p1beta1.NotificationConfig | NotificationConfig}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.list_notification_configs.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_ListNotificationConfigs_async - */ - listNotificationConfigsAsync( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listNotificationConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNotificationConfigs.asyncIterate( - this.innerApiCalls['listNotificationConfigs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all sources belonging to an organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.pageToken - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.securitycenter.v1p1beta1.Source | Source}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSourcesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listSources( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISource[], - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse - ]>; - listSources( - request: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ISource>): void; - listSources( - request: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ISource>): void; - listSources( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ISource>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ISource>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISource[], - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listSources(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.pageToken - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.securitycenter.v1p1beta1.Source | Source} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSourcesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listSourcesStream( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSources.createStream( - this.innerApiCalls.listSources as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSources`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.pageToken - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.securitycenter.v1p1beta1.Source | Source}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.list_sources.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_ListSources_async - */ - listSourcesAsync( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSources.asyncIterate( - this.innerApiCalls['listSources'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderAsset resource name string. - * - * @param {string} folder - * @param {string} asset - * @returns {string} Resource name string. - */ - folderAssetPath(folder:string,asset:string) { - return this.pathTemplates.folderAssetPathTemplate.render({ - folder: folder, - asset: asset, - }); - } - - /** - * Parse the folder from FolderAsset resource. - * - * @param {string} folderAssetName - * A fully-qualified path representing folder_asset resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAssetName(folderAssetName: string) { - return this.pathTemplates.folderAssetPathTemplate.match(folderAssetName).folder; - } - - /** - * Parse the asset from FolderAsset resource. - * - * @param {string} folderAssetName - * A fully-qualified path representing folder_asset resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromFolderAssetName(folderAssetName: string) { - return this.pathTemplates.folderAssetPathTemplate.match(folderAssetName).asset; - } - - /** - * Return a fully-qualified folderAssetSecurityMarks resource name string. - * - * @param {string} folder - * @param {string} asset - * @returns {string} Resource name string. - */ - folderAssetSecurityMarksPath(folder:string,asset:string) { - return this.pathTemplates.folderAssetSecurityMarksPathTemplate.render({ - folder: folder, - asset: asset, - }); - } - - /** - * Parse the folder from FolderAssetSecurityMarks resource. - * - * @param {string} folderAssetSecurityMarksName - * A fully-qualified path representing folder_asset_securityMarks resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAssetSecurityMarksName(folderAssetSecurityMarksName: string) { - return this.pathTemplates.folderAssetSecurityMarksPathTemplate.match(folderAssetSecurityMarksName).folder; - } - - /** - * Parse the asset from FolderAssetSecurityMarks resource. - * - * @param {string} folderAssetSecurityMarksName - * A fully-qualified path representing folder_asset_securityMarks resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromFolderAssetSecurityMarksName(folderAssetSecurityMarksName: string) { - return this.pathTemplates.folderAssetSecurityMarksPathTemplate.match(folderAssetSecurityMarksName).asset; - } - - /** - * Return a fully-qualified folderSource resource name string. - * - * @param {string} folder - * @param {string} source - * @returns {string} Resource name string. - */ - folderSourcePath(folder:string,source:string) { - return this.pathTemplates.folderSourcePathTemplate.render({ - folder: folder, - source: source, - }); - } - - /** - * Parse the folder from FolderSource resource. - * - * @param {string} folderSourceName - * A fully-qualified path representing folder_source resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSourceName(folderSourceName: string) { - return this.pathTemplates.folderSourcePathTemplate.match(folderSourceName).folder; - } - - /** - * Parse the source from FolderSource resource. - * - * @param {string} folderSourceName - * A fully-qualified path representing folder_source resource. - * @returns {string} A string representing the source. - */ - matchSourceFromFolderSourceName(folderSourceName: string) { - return this.pathTemplates.folderSourcePathTemplate.match(folderSourceName).source; - } - - /** - * Return a fully-qualified folderSourceFinding resource name string. - * - * @param {string} folder - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - folderSourceFindingPath(folder:string,source:string,finding:string) { - return this.pathTemplates.folderSourceFindingPathTemplate.render({ - folder: folder, - source: source, - finding: finding, - }); - } - - /** - * Parse the folder from FolderSourceFinding resource. - * - * @param {string} folderSourceFindingName - * A fully-qualified path representing folder_source_finding resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSourceFindingName(folderSourceFindingName: string) { - return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).folder; - } - - /** - * Parse the source from FolderSourceFinding resource. - * - * @param {string} folderSourceFindingName - * A fully-qualified path representing folder_source_finding resource. - * @returns {string} A string representing the source. - */ - matchSourceFromFolderSourceFindingName(folderSourceFindingName: string) { - return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).source; - } - - /** - * Parse the finding from FolderSourceFinding resource. - * - * @param {string} folderSourceFindingName - * A fully-qualified path representing folder_source_finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromFolderSourceFindingName(folderSourceFindingName: string) { - return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).finding; - } - - /** - * Return a fully-qualified folderSourceFindingSecurityMarks resource name string. - * - * @param {string} folder - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - folderSourceFindingSecurityMarksPath(folder:string,source:string,finding:string) { - return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render({ - folder: folder, - source: source, - finding: finding, - }); - } - - /** - * Parse the folder from FolderSourceFindingSecurityMarks resource. - * - * @param {string} folderSourceFindingSecurityMarksName - * A fully-qualified path representing folder_source_finding_securityMarks resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { - return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).folder; - } - - /** - * Parse the source from FolderSourceFindingSecurityMarks resource. - * - * @param {string} folderSourceFindingSecurityMarksName - * A fully-qualified path representing folder_source_finding_securityMarks resource. - * @returns {string} A string representing the source. - */ - matchSourceFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { - return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).source; - } - - /** - * Parse the finding from FolderSourceFindingSecurityMarks resource. - * - * @param {string} folderSourceFindingSecurityMarksName - * A fully-qualified path representing folder_source_finding_securityMarks resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { - return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).finding; - } - - /** - * Return a fully-qualified notificationConfig resource name string. - * - * @param {string} organization - * @param {string} notification_config - * @returns {string} Resource name string. - */ - notificationConfigPath(organization:string,notificationConfig:string) { - return this.pathTemplates.notificationConfigPathTemplate.render({ - organization: organization, - notification_config: notificationConfig, - }); - } - - /** - * Parse the organization from NotificationConfig resource. - * - * @param {string} notificationConfigName - * A fully-qualified path representing NotificationConfig resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromNotificationConfigName(notificationConfigName: string) { - return this.pathTemplates.notificationConfigPathTemplate.match(notificationConfigName).organization; - } - - /** - * Parse the notification_config from NotificationConfig resource. - * - * @param {string} notificationConfigName - * A fully-qualified path representing NotificationConfig resource. - * @returns {string} A string representing the notification_config. - */ - matchNotificationConfigFromNotificationConfigName(notificationConfigName: string) { - return this.pathTemplates.notificationConfigPathTemplate.match(notificationConfigName).notification_config; - } - - /** - * Return a fully-qualified organization resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationPath(organization:string) { - return this.pathTemplates.organizationPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from Organization resource. - * - * @param {string} organizationName - * A fully-qualified path representing Organization resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationName(organizationName: string) { - return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; - } - - /** - * Return a fully-qualified organizationAsset resource name string. - * - * @param {string} organization - * @param {string} asset - * @returns {string} Resource name string. - */ - organizationAssetPath(organization:string,asset:string) { - return this.pathTemplates.organizationAssetPathTemplate.render({ - organization: organization, - asset: asset, - }); - } - - /** - * Parse the organization from OrganizationAsset resource. - * - * @param {string} organizationAssetName - * A fully-qualified path representing organization_asset resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAssetName(organizationAssetName: string) { - return this.pathTemplates.organizationAssetPathTemplate.match(organizationAssetName).organization; - } - - /** - * Parse the asset from OrganizationAsset resource. - * - * @param {string} organizationAssetName - * A fully-qualified path representing organization_asset resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromOrganizationAssetName(organizationAssetName: string) { - return this.pathTemplates.organizationAssetPathTemplate.match(organizationAssetName).asset; - } - - /** - * Return a fully-qualified organizationAssetSecurityMarks resource name string. - * - * @param {string} organization - * @param {string} asset - * @returns {string} Resource name string. - */ - organizationAssetSecurityMarksPath(organization:string,asset:string) { - return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.render({ - organization: organization, - asset: asset, - }); - } - - /** - * Parse the organization from OrganizationAssetSecurityMarks resource. - * - * @param {string} organizationAssetSecurityMarksName - * A fully-qualified path representing organization_asset_securityMarks resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { - return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).organization; - } - - /** - * Parse the asset from OrganizationAssetSecurityMarks resource. - * - * @param {string} organizationAssetSecurityMarksName - * A fully-qualified path representing organization_asset_securityMarks resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { - return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).asset; - } - - /** - * Return a fully-qualified organizationSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSettingsPath(organization:string) { - return this.pathTemplates.organizationSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSettings resource. - * - * @param {string} organizationSettingsName - * A fully-qualified path representing OrganizationSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { - return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSource resource name string. - * - * @param {string} organization - * @param {string} source - * @returns {string} Resource name string. - */ - organizationSourcePath(organization:string,source:string) { - return this.pathTemplates.organizationSourcePathTemplate.render({ - organization: organization, - source: source, - }); - } - - /** - * Parse the organization from OrganizationSource resource. - * - * @param {string} organizationSourceName - * A fully-qualified path representing organization_source resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSourceName(organizationSourceName: string) { - return this.pathTemplates.organizationSourcePathTemplate.match(organizationSourceName).organization; - } - - /** - * Parse the source from OrganizationSource resource. - * - * @param {string} organizationSourceName - * A fully-qualified path representing organization_source resource. - * @returns {string} A string representing the source. - */ - matchSourceFromOrganizationSourceName(organizationSourceName: string) { - return this.pathTemplates.organizationSourcePathTemplate.match(organizationSourceName).source; - } - - /** - * Return a fully-qualified organizationSourceFinding resource name string. - * - * @param {string} organization - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - organizationSourceFindingPath(organization:string,source:string,finding:string) { - return this.pathTemplates.organizationSourceFindingPathTemplate.render({ - organization: organization, - source: source, - finding: finding, - }); - } - - /** - * Parse the organization from OrganizationSourceFinding resource. - * - * @param {string} organizationSourceFindingName - * A fully-qualified path representing organization_source_finding resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSourceFindingName(organizationSourceFindingName: string) { - return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).organization; - } - - /** - * Parse the source from OrganizationSourceFinding resource. - * - * @param {string} organizationSourceFindingName - * A fully-qualified path representing organization_source_finding resource. - * @returns {string} A string representing the source. - */ - matchSourceFromOrganizationSourceFindingName(organizationSourceFindingName: string) { - return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).source; - } - - /** - * Parse the finding from OrganizationSourceFinding resource. - * - * @param {string} organizationSourceFindingName - * A fully-qualified path representing organization_source_finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromOrganizationSourceFindingName(organizationSourceFindingName: string) { - return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).finding; - } - - /** - * Return a fully-qualified organizationSourceFindingSecurityMarks resource name string. - * - * @param {string} organization - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - organizationSourceFindingSecurityMarksPath(organization:string,source:string,finding:string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render({ - organization: organization, - source: source, - finding: finding, - }); - } - - /** - * Parse the organization from OrganizationSourceFindingSecurityMarks resource. - * - * @param {string} organizationSourceFindingSecurityMarksName - * A fully-qualified path representing organization_source_finding_securityMarks resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).organization; - } - - /** - * Parse the source from OrganizationSourceFindingSecurityMarks resource. - * - * @param {string} organizationSourceFindingSecurityMarksName - * A fully-qualified path representing organization_source_finding_securityMarks resource. - * @returns {string} A string representing the source. - */ - matchSourceFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).source; - } - - /** - * Parse the finding from OrganizationSourceFindingSecurityMarks resource. - * - * @param {string} organizationSourceFindingSecurityMarksName - * A fully-qualified path representing organization_source_finding_securityMarks resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).finding; - } - - /** - * Return a fully-qualified projectAsset resource name string. - * - * @param {string} project - * @param {string} asset - * @returns {string} Resource name string. - */ - projectAssetPath(project:string,asset:string) { - return this.pathTemplates.projectAssetPathTemplate.render({ - project: project, - asset: asset, - }); - } - - /** - * Parse the project from ProjectAsset resource. - * - * @param {string} projectAssetName - * A fully-qualified path representing project_asset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAssetName(projectAssetName: string) { - return this.pathTemplates.projectAssetPathTemplate.match(projectAssetName).project; - } - - /** - * Parse the asset from ProjectAsset resource. - * - * @param {string} projectAssetName - * A fully-qualified path representing project_asset resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromProjectAssetName(projectAssetName: string) { - return this.pathTemplates.projectAssetPathTemplate.match(projectAssetName).asset; - } - - /** - * Return a fully-qualified projectAssetSecurityMarks resource name string. - * - * @param {string} project - * @param {string} asset - * @returns {string} Resource name string. - */ - projectAssetSecurityMarksPath(project:string,asset:string) { - return this.pathTemplates.projectAssetSecurityMarksPathTemplate.render({ - project: project, - asset: asset, - }); - } - - /** - * Parse the project from ProjectAssetSecurityMarks resource. - * - * @param {string} projectAssetSecurityMarksName - * A fully-qualified path representing project_asset_securityMarks resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAssetSecurityMarksName(projectAssetSecurityMarksName: string) { - return this.pathTemplates.projectAssetSecurityMarksPathTemplate.match(projectAssetSecurityMarksName).project; - } - - /** - * Parse the asset from ProjectAssetSecurityMarks resource. - * - * @param {string} projectAssetSecurityMarksName - * A fully-qualified path representing project_asset_securityMarks resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromProjectAssetSecurityMarksName(projectAssetSecurityMarksName: string) { - return this.pathTemplates.projectAssetSecurityMarksPathTemplate.match(projectAssetSecurityMarksName).asset; - } - - /** - * Return a fully-qualified projectSource resource name string. - * - * @param {string} project - * @param {string} source - * @returns {string} Resource name string. - */ - projectSourcePath(project:string,source:string) { - return this.pathTemplates.projectSourcePathTemplate.render({ - project: project, - source: source, - }); - } - - /** - * Parse the project from ProjectSource resource. - * - * @param {string} projectSourceName - * A fully-qualified path representing project_source resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSourceName(projectSourceName: string) { - return this.pathTemplates.projectSourcePathTemplate.match(projectSourceName).project; - } - - /** - * Parse the source from ProjectSource resource. - * - * @param {string} projectSourceName - * A fully-qualified path representing project_source resource. - * @returns {string} A string representing the source. - */ - matchSourceFromProjectSourceName(projectSourceName: string) { - return this.pathTemplates.projectSourcePathTemplate.match(projectSourceName).source; - } - - /** - * Return a fully-qualified projectSourceFinding resource name string. - * - * @param {string} project - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - projectSourceFindingPath(project:string,source:string,finding:string) { - return this.pathTemplates.projectSourceFindingPathTemplate.render({ - project: project, - source: source, - finding: finding, - }); - } - - /** - * Parse the project from ProjectSourceFinding resource. - * - * @param {string} projectSourceFindingName - * A fully-qualified path representing project_source_finding resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSourceFindingName(projectSourceFindingName: string) { - return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).project; - } - - /** - * Parse the source from ProjectSourceFinding resource. - * - * @param {string} projectSourceFindingName - * A fully-qualified path representing project_source_finding resource. - * @returns {string} A string representing the source. - */ - matchSourceFromProjectSourceFindingName(projectSourceFindingName: string) { - return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).source; - } - - /** - * Parse the finding from ProjectSourceFinding resource. - * - * @param {string} projectSourceFindingName - * A fully-qualified path representing project_source_finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromProjectSourceFindingName(projectSourceFindingName: string) { - return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).finding; - } - - /** - * Return a fully-qualified projectSourceFindingSecurityMarks resource name string. - * - * @param {string} project - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - projectSourceFindingSecurityMarksPath(project:string,source:string,finding:string) { - return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render({ - project: project, - source: source, - finding: finding, - }); - } - - /** - * Parse the project from ProjectSourceFindingSecurityMarks resource. - * - * @param {string} projectSourceFindingSecurityMarksName - * A fully-qualified path representing project_source_finding_securityMarks resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { - return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).project; - } - - /** - * Parse the source from ProjectSourceFindingSecurityMarks resource. - * - * @param {string} projectSourceFindingSecurityMarksName - * A fully-qualified path representing project_source_finding_securityMarks resource. - * @returns {string} A string representing the source. - */ - matchSourceFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { - return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).source; - } - - /** - * Parse the finding from ProjectSourceFindingSecurityMarks resource. - * - * @param {string} projectSourceFindingSecurityMarksName - * A fully-qualified path representing project_source_finding_securityMarks resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { - return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).finding; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.securityCenterStub && !this._terminated) { - return this.securityCenterStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_client_config.json b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_client_config.json deleted file mode 100644 index b8821e07010..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_client_config.json +++ /dev/null @@ -1,141 +0,0 @@ -{ - "interfaces": { - "google.cloud.securitycenter.v1p1beta1.SecurityCenter": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateSource": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateFinding": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateNotificationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteNotificationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetNotificationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetOrganizationSettings": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetSource": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GroupAssets": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GroupFindings": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListAssets": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFindings": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListNotificationConfigs": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListSources": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "RunAssetDiscovery": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetFindingState": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "TestIamPermissions": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateFinding": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateNotificationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateOrganizationSettings": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSource": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSecurityMarks": { - "timeout_millis": 480000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_proto_list.json b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_proto_list.json deleted file mode 100644 index dcb821bf6e0..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/src/v1p1beta1/security_center_proto_list.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - "../../protos/google/cloud/securitycenter/v1p1beta1/asset.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/finding.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/folder.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/resource.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/source.proto" -] diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index ca4c3d3425f..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const securitycenter = require('@google-cloud/security-center'); - -function main() { - const securityCenterClient = new securitycenter.SecurityCenterClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 323502f7e2f..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {SecurityCenterClient} from '@google-cloud/security-center'; - -// check that the client class type name can be used -function doStuffWithSecurityCenterClient(client: SecurityCenterClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const securityCenterClient = new SecurityCenterClient(); - doStuffWithSecurityCenterClient(securityCenterClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/test/gapic_security_center_v1p1beta1.ts b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/test/gapic_security_center_v1p1beta1.ts deleted file mode 100644 index 1afa97ffaec..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/test/gapic_security_center_v1p1beta1.ts +++ /dev/null @@ -1,4304 +0,0 @@ -// Copyright 2023 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as securitycenterModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1p1beta1.SecurityCenterClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = securitycenterModule.v1p1beta1.SecurityCenterClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = securitycenterModule.v1p1beta1.SecurityCenterClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = securitycenterModule.v1p1beta1.SecurityCenterClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.securityCenterStub, undefined); - await client.initialize(); - assert(client.securityCenterStub); - }); - - it('has close method for the initialized client', done => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.securityCenterStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.securityCenterStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createSource', () => { - it('invokes createSource without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.Source() - ); - client.innerApiCalls.createSource = stubSimpleCall(expectedResponse); - const [response] = await client.createSource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSource without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.Source() - ); - client.innerApiCalls.createSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSource( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSource with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSource(request), expectedError); - const actualRequest = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSource with closed client', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createSource(request), expectedError); - }); - }); - - describe('createFinding', () => { - it('invokes createFinding without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.Finding() - ); - client.innerApiCalls.createFinding = stubSimpleCall(expectedResponse); - const [response] = await client.createFinding(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFinding without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.Finding() - ); - client.innerApiCalls.createFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFinding( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFinding with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createFinding(request), expectedError); - const actualRequest = (client.innerApiCalls.createFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFinding with closed client', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createFinding(request), expectedError); - }); - }); - - describe('createNotificationConfig', () => { - it('invokes createNotificationConfig without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig() - ); - client.innerApiCalls.createNotificationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createNotificationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNotificationConfig without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig() - ); - client.innerApiCalls.createNotificationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createNotificationConfig( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNotificationConfig with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNotificationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createNotificationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNotificationConfig with closed client', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createNotificationConfig(request), expectedError); - }); - }); - - describe('deleteNotificationConfig', () => { - it('invokes deleteNotificationConfig without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteNotificationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteNotificationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNotificationConfig without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteNotificationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteNotificationConfig( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNotificationConfig with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNotificationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteNotificationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNotificationConfig with closed client', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteNotificationConfig(request), expectedError); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with closed client', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getIamPolicy(request), expectedError); - }); - }); - - describe('getNotificationConfig', () => { - it('invokes getNotificationConfig without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig() - ); - client.innerApiCalls.getNotificationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getNotificationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationConfig without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig() - ); - client.innerApiCalls.getNotificationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNotificationConfig( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationConfig with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNotificationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNotificationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationConfig with closed client', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getNotificationConfig(request), expectedError); - }); - }); - - describe('getOrganizationSettings', () => { - it('invokes getOrganizationSettings without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.OrganizationSettings() - ); - client.innerApiCalls.getOrganizationSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getOrganizationSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOrganizationSettings without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.OrganizationSettings() - ); - client.innerApiCalls.getOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getOrganizationSettings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOrganizationSettings with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getOrganizationSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getOrganizationSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getOrganizationSettings with closed client', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getOrganizationSettings(request), expectedError); - }); - }); - - describe('getSource', () => { - it('invokes getSource without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.Source() - ); - client.innerApiCalls.getSource = stubSimpleCall(expectedResponse); - const [response] = await client.getSource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSource without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.Source() - ); - client.innerApiCalls.getSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSource( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSource with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSource(request), expectedError); - const actualRequest = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSource with closed client', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSource(request), expectedError); - }); - }); - - describe('setFindingState', () => { - it('invokes setFindingState without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.Finding() - ); - client.innerApiCalls.setFindingState = stubSimpleCall(expectedResponse); - const [response] = await client.setFindingState(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setFindingState without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.Finding() - ); - client.innerApiCalls.setFindingState = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setFindingState( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setFindingState with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setFindingState = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setFindingState(request), expectedError); - const actualRequest = (client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setFindingState with closed client', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setFindingState(request), expectedError); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy with closed client', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setIamPolicy(request), expectedError); - }); - }); - - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); - const [response] = await client.testIamPermissions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request), expectedError); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions with closed client', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.testIamPermissions(request), expectedError); - }); - }); - - describe('updateFinding', () => { - it('invokes updateFinding without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest() - ); - request.finding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest', ['finding', 'name']); - request.finding.name = defaultValue1; - const expectedHeaderRequestParams = `finding.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.Finding() - ); - client.innerApiCalls.updateFinding = stubSimpleCall(expectedResponse); - const [response] = await client.updateFinding(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFinding without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest() - ); - request.finding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest', ['finding', 'name']); - request.finding.name = defaultValue1; - const expectedHeaderRequestParams = `finding.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.Finding() - ); - client.innerApiCalls.updateFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFinding( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFinding with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest() - ); - request.finding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest', ['finding', 'name']); - request.finding.name = defaultValue1; - const expectedHeaderRequestParams = `finding.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateFinding(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFinding with closed client', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest() - ); - request.finding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest', ['finding', 'name']); - request.finding.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateFinding(request), expectedError); - }); - }); - - describe('updateNotificationConfig', () => { - it('invokes updateNotificationConfig without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest() - ); - request.notificationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest', ['notificationConfig', 'name']); - request.notificationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `notification_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig() - ); - client.innerApiCalls.updateNotificationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateNotificationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNotificationConfig without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest() - ); - request.notificationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest', ['notificationConfig', 'name']); - request.notificationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `notification_config.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig() - ); - client.innerApiCalls.updateNotificationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateNotificationConfig( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNotificationConfig with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest() - ); - request.notificationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest', ['notificationConfig', 'name']); - request.notificationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `notification_config.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNotificationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateNotificationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateNotificationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNotificationConfig with closed client', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest() - ); - request.notificationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest', ['notificationConfig', 'name']); - request.notificationConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateNotificationConfig(request), expectedError); - }); - }); - - describe('updateOrganizationSettings', () => { - it('invokes updateOrganizationSettings without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest() - ); - request.organizationSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); - request.organizationSettings.name = defaultValue1; - const expectedHeaderRequestParams = `organization_settings.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.OrganizationSettings() - ); - client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateOrganizationSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateOrganizationSettings without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest() - ); - request.organizationSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); - request.organizationSettings.name = defaultValue1; - const expectedHeaderRequestParams = `organization_settings.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.OrganizationSettings() - ); - client.innerApiCalls.updateOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateOrganizationSettings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateOrganizationSettings with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest() - ); - request.organizationSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); - request.organizationSettings.name = defaultValue1; - const expectedHeaderRequestParams = `organization_settings.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateOrganizationSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateOrganizationSettings with closed client', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest() - ); - request.organizationSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest', ['organizationSettings', 'name']); - request.organizationSettings.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateOrganizationSettings(request), expectedError); - }); - }); - - describe('updateSource', () => { - it('invokes updateSource without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedHeaderRequestParams = `source.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.Source() - ); - client.innerApiCalls.updateSource = stubSimpleCall(expectedResponse); - const [response] = await client.updateSource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSource without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedHeaderRequestParams = `source.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.Source() - ); - client.innerApiCalls.updateSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSource( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSource with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedHeaderRequestParams = `source.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSource(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSource with closed client', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSource(request), expectedError); - }); - }); - - describe('updateSecurityMarks', () => { - it('invokes updateSecurityMarks without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest() - ); - request.securityMarks ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); - request.securityMarks.name = defaultValue1; - const expectedHeaderRequestParams = `security_marks.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.SecurityMarks() - ); - client.innerApiCalls.updateSecurityMarks = stubSimpleCall(expectedResponse); - const [response] = await client.updateSecurityMarks(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSecurityMarks without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest() - ); - request.securityMarks ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); - request.securityMarks.name = defaultValue1; - const expectedHeaderRequestParams = `security_marks.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.SecurityMarks() - ); - client.innerApiCalls.updateSecurityMarks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSecurityMarks( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSecurityMarks with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest() - ); - request.securityMarks ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); - request.securityMarks.name = defaultValue1; - const expectedHeaderRequestParams = `security_marks.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSecurityMarks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSecurityMarks(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSecurityMarks with closed client', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest() - ); - request.securityMarks ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest', ['securityMarks', 'name']); - request.securityMarks.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSecurityMarks(request), expectedError); - }); - }); - - describe('runAssetDiscovery', () => { - it('invokes runAssetDiscovery without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(expectedResponse); - const [operation] = await client.runAssetDiscovery(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runAssetDiscovery without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runAssetDiscovery( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runAssetDiscovery with call error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.runAssetDiscovery(request), expectedError); - const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runAssetDiscovery with LRO error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.runAssetDiscovery(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRunAssetDiscoveryProgress without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRunAssetDiscoveryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRunAssetDiscoveryProgress with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRunAssetDiscoveryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('groupAssets', () => { - it('invokes groupAssets without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - ]; - client.innerApiCalls.groupAssets = stubSimpleCall(expectedResponse); - const [response] = await client.groupAssets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes groupAssets without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - ]; - client.innerApiCalls.groupAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.groupAssets( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes groupAssets with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.groupAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.groupAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes groupAssetsStream without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - ]; - client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.groupAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.GroupResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); - assert( - (client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes groupAssetsStream with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.groupAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.GroupResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); - assert( - (client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with groupAssets without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - ]; - client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[] = []; - const iterable = client.groupAssetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with groupAssets with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.groupAssetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('groupFindings', () => { - it('invokes groupFindings without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - ]; - client.innerApiCalls.groupFindings = stubSimpleCall(expectedResponse); - const [response] = await client.groupFindings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes groupFindings without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - ]; - client.innerApiCalls.groupFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.groupFindings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes groupFindings with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.groupFindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.groupFindings(request), expectedError); - const actualRequest = (client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes groupFindingsStream without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - ]; - client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.groupFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.GroupResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); - assert( - (client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes groupFindingsStream with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.groupFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.GroupResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); - assert( - (client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with groupFindings without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - ]; - client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[] = []; - const iterable = client.groupFindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with groupFindings with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.groupFindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listAssets', () => { - it('invokes listAssets without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - ]; - client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); - const [response] = await client.listAssets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssets without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - ]; - client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAssets( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssets with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssetsStream without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - ]; - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAssetsStream with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAssets without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - ]; - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[] = []; - const iterable = client.listAssetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAssets with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAssetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listFindings', () => { - it('invokes listFindings without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - ]; - client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); - const [response] = await client.listFindings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindings without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - ]; - client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindings with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindings(request), expectedError); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingsStream without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - ]; - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFindingsStream with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFindings without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - ]; - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[] = []; - const iterable = client.listFindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFindings with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listNotificationConfigs', () => { - it('invokes listNotificationConfigs without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - ]; - client.innerApiCalls.listNotificationConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listNotificationConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotificationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationConfigs without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - ]; - client.innerApiCalls.listNotificationConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNotificationConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotificationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationConfigs with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNotificationConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNotificationConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listNotificationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationConfigsStream without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - ]; - client.descriptors.page.listNotificationConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNotificationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listNotificationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationConfigs, request)); - assert( - (client.descriptors.page.listNotificationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNotificationConfigsStream with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotificationConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNotificationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNotificationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationConfigs, request)); - assert( - (client.descriptors.page.listNotificationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNotificationConfigs without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - ]; - client.descriptors.page.listNotificationConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[] = []; - const iterable = client.listNotificationConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNotificationConfigs with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotificationConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNotificationConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listSources', () => { - it('invokes listSources without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - ]; - client.innerApiCalls.listSources = stubSimpleCall(expectedResponse); - const [response] = await client.listSources(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSources without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - ]; - client.innerApiCalls.listSources = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSources( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISource[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSources with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSources = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSources(request), expectedError); - const actualRequest = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSourcesStream without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - ]; - client.descriptors.page.listSources.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.Source[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.Source) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSources, request)); - assert( - (client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listSourcesStream with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSources.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.Source[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.Source) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSources, request)); - assert( - (client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSources without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - ]; - client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1p1beta1.ISource[] = []; - const iterable = client.listSourcesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSources with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSourcesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.ISource[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('folderAsset', () => { - const fakePath = "/rendered/path/folderAsset"; - const expectedParameters = { - folder: "folderValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderAssetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAssetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAssetPath', () => { - const result = client.folderAssetPath("folderValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAssetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAssetName', () => { - const result = client.matchFolderFromFolderAssetName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromFolderAssetName', () => { - const result = client.matchAssetFromFolderAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.folderAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAssetSecurityMarks', () => { - const fakePath = "/rendered/path/folderAssetSecurityMarks"; - const expectedParameters = { - folder: "folderValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderAssetSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAssetSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAssetSecurityMarksPath', () => { - const result = client.folderAssetSecurityMarksPath("folderValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAssetSecurityMarksName', () => { - const result = client.matchFolderFromFolderAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromFolderAssetSecurityMarksName', () => { - const result = client.matchAssetFromFolderAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSource', () => { - const fakePath = "/rendered/path/folderSource"; - const expectedParameters = { - folder: "folderValue", - source: "sourceValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSourcePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSourcePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSourcePath', () => { - const result = client.folderSourcePath("folderValue", "sourceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSourcePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSourceName', () => { - const result = client.matchFolderFromFolderSourceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromFolderSourceName', () => { - const result = client.matchSourceFromFolderSourceName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.folderSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSourceFinding', () => { - const fakePath = "/rendered/path/folderSourceFinding"; - const expectedParameters = { - folder: "folderValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSourceFindingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSourceFindingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSourceFindingPath', () => { - const result = client.folderSourceFindingPath("folderValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSourceFindingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSourceFindingName', () => { - const result = client.matchFolderFromFolderSourceFindingName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromFolderSourceFindingName', () => { - const result = client.matchSourceFromFolderSourceFindingName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromFolderSourceFindingName', () => { - const result = client.matchFindingFromFolderSourceFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSourceFindingSecurityMarks', () => { - const fakePath = "/rendered/path/folderSourceFindingSecurityMarks"; - const expectedParameters = { - folder: "folderValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSourceFindingSecurityMarksPath', () => { - const result = client.folderSourceFindingSecurityMarksPath("folderValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSourceFindingSecurityMarksName', () => { - const result = client.matchFolderFromFolderSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromFolderSourceFindingSecurityMarksName', () => { - const result = client.matchSourceFromFolderSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromFolderSourceFindingSecurityMarksName', () => { - const result = client.matchFindingFromFolderSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('notificationConfig', () => { - const fakePath = "/rendered/path/notificationConfig"; - const expectedParameters = { - organization: "organizationValue", - notification_config: "notificationConfigValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.notificationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.notificationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('notificationConfigPath', () => { - const result = client.notificationConfigPath("organizationValue", "notificationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.notificationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromNotificationConfigName', () => { - const result = client.matchOrganizationFromNotificationConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.notificationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationConfigFromNotificationConfigName', () => { - const result = client.matchNotificationConfigFromNotificationConfigName(fakePath); - assert.strictEqual(result, "notificationConfigValue"); - assert((client.pathTemplates.notificationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organization', () => { - const fakePath = "/rendered/path/organization"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationPath', () => { - const result = client.organizationPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationName', () => { - const result = client.matchOrganizationFromOrganizationName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAsset', () => { - const fakePath = "/rendered/path/organizationAsset"; - const expectedParameters = { - organization: "organizationValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationAssetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAssetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAssetPath', () => { - const result = client.organizationAssetPath("organizationValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAssetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAssetName', () => { - const result = client.matchOrganizationFromOrganizationAssetName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromOrganizationAssetName', () => { - const result = client.matchAssetFromOrganizationAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.organizationAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAssetSecurityMarks', () => { - const fakePath = "/rendered/path/organizationAssetSecurityMarks"; - const expectedParameters = { - organization: "organizationValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAssetSecurityMarksPath', () => { - const result = client.organizationAssetSecurityMarksPath("organizationValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAssetSecurityMarksName', () => { - const result = client.matchOrganizationFromOrganizationAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromOrganizationAssetSecurityMarksName', () => { - const result = client.matchAssetFromOrganizationAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSettings', () => { - const fakePath = "/rendered/path/organizationSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSettingsPath', () => { - const result = client.organizationSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSource', () => { - const fakePath = "/rendered/path/organizationSource"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSourcePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSourcePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSourcePath', () => { - const result = client.organizationSourcePath("organizationValue", "sourceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSourcePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSourceName', () => { - const result = client.matchOrganizationFromOrganizationSourceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromOrganizationSourceName', () => { - const result = client.matchSourceFromOrganizationSourceName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.organizationSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSourceFinding', () => { - const fakePath = "/rendered/path/organizationSourceFinding"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSourceFindingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSourceFindingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSourceFindingPath', () => { - const result = client.organizationSourceFindingPath("organizationValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSourceFindingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSourceFindingName', () => { - const result = client.matchOrganizationFromOrganizationSourceFindingName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromOrganizationSourceFindingName', () => { - const result = client.matchSourceFromOrganizationSourceFindingName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromOrganizationSourceFindingName', () => { - const result = client.matchFindingFromOrganizationSourceFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSourceFindingSecurityMarks', () => { - const fakePath = "/rendered/path/organizationSourceFindingSecurityMarks"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSourceFindingSecurityMarksPath', () => { - const result = client.organizationSourceFindingSecurityMarksPath("organizationValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSourceFindingSecurityMarksName', () => { - const result = client.matchOrganizationFromOrganizationSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromOrganizationSourceFindingSecurityMarksName', () => { - const result = client.matchSourceFromOrganizationSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromOrganizationSourceFindingSecurityMarksName', () => { - const result = client.matchFindingFromOrganizationSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAsset', () => { - const fakePath = "/rendered/path/projectAsset"; - const expectedParameters = { - project: "projectValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAssetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAssetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAssetPath', () => { - const result = client.projectAssetPath("projectValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAssetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAssetName', () => { - const result = client.matchProjectFromProjectAssetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromProjectAssetName', () => { - const result = client.matchAssetFromProjectAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.projectAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAssetSecurityMarks', () => { - const fakePath = "/rendered/path/projectAssetSecurityMarks"; - const expectedParameters = { - project: "projectValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAssetSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAssetSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAssetSecurityMarksPath', () => { - const result = client.projectAssetSecurityMarksPath("projectValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAssetSecurityMarksName', () => { - const result = client.matchProjectFromProjectAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromProjectAssetSecurityMarksName', () => { - const result = client.matchAssetFromProjectAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSource', () => { - const fakePath = "/rendered/path/projectSource"; - const expectedParameters = { - project: "projectValue", - source: "sourceValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSourcePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSourcePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSourcePath', () => { - const result = client.projectSourcePath("projectValue", "sourceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSourcePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSourceName', () => { - const result = client.matchProjectFromProjectSourceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromProjectSourceName', () => { - const result = client.matchSourceFromProjectSourceName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.projectSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSourceFinding', () => { - const fakePath = "/rendered/path/projectSourceFinding"; - const expectedParameters = { - project: "projectValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSourceFindingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSourceFindingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSourceFindingPath', () => { - const result = client.projectSourceFindingPath("projectValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSourceFindingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSourceFindingName', () => { - const result = client.matchProjectFromProjectSourceFindingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromProjectSourceFindingName', () => { - const result = client.matchSourceFromProjectSourceFindingName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromProjectSourceFindingName', () => { - const result = client.matchFindingFromProjectSourceFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSourceFindingSecurityMarks', () => { - const fakePath = "/rendered/path/projectSourceFindingSecurityMarks"; - const expectedParameters = { - project: "projectValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSourceFindingSecurityMarksPath', () => { - const result = client.projectSourceFindingSecurityMarksPath("projectValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSourceFindingSecurityMarksName', () => { - const result = client.matchProjectFromProjectSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromProjectSourceFindingSecurityMarksName', () => { - const result = client.matchSourceFromProjectSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromProjectSourceFindingSecurityMarksName', () => { - const result = client.matchFindingFromProjectSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/tsconfig.json b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/webpack.config.js b/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/webpack.config.js deleted file mode 100644 index 4aeca8bf63a..00000000000 --- a/owl-bot-staging/google-cloud-securitycenter/v1p1beta1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 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 -// -// https://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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'SecurityCenter', - filename: './security-center.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/packages/google-cloud-securitycenter/protos/google/cloud/securitycenter/v1/access.proto b/packages/google-cloud-securitycenter/protos/google/cloud/securitycenter/v1/access.proto index 55ff088de8b..d30e670f5a6 100644 --- a/packages/google-cloud-securitycenter/protos/google/cloud/securitycenter/v1/access.proto +++ b/packages/google-cloud-securitycenter/protos/google/cloud/securitycenter/v1/access.proto @@ -28,11 +28,11 @@ option ruby_package = "Google::Cloud::SecurityCenter::V1"; message Access { // Associated email, such as "foo@google.com". // - // The email address of the authenticated user (or service account on behalf - // of third party principal) making the request. For third party identity - // callers, the `principal_subject` field is populated instead of this field. - // For privacy reasons, the principal email address is sometimes redacted. - // For more information, see [Caller identities in audit + // The email address of the authenticated user or a service account acting on + // behalf of a third party principal making the request. For third party + // identity callers, the `principal_subject` field is populated instead of + // this field. For privacy reasons, the principal email address is sometimes + // redacted. For more information, see [Caller identities in audit // logs](https://cloud.google.com/logging/docs/audit#user-id). string principal_email = 1; @@ -42,8 +42,8 @@ message Access { // The caller IP's geolocation, which identifies where the call came from. Geolocation caller_ip_geo = 3; - // What kind of user agent is associated, for example operating system shells, - // embedded or stand-alone applications, etc. + // Type of user agent associated with the finding. For example, an operating + // system shell or an embedded or standalone application. string user_agent_family = 4; // This is the API service that the service account made a call to, e.g. @@ -53,37 +53,36 @@ message Access { // The method that the service account called, e.g. "SetIamPolicy". string method_name = 6; - // A string representing the principal_subject associated with the identity. - // As compared to `principal_email`, supports principals that aren't - // associated with email addresses, such as third party principals. For most - // identities, the format will be `principal://iam.googleapis.com/{identity - // pool name}/subjects/{subject}` except for some GKE identities - // (GKE_WORKLOAD, FREEFORM, GKE_HUB_WORKLOAD) that are still in the legacy - // format `serviceAccount:{identity pool name}[{subject}]` + // A string that represents the principal_subject that is associated with the + // identity. Unlike `principal_email`, `principal_subject` supports principals + // that aren't associated with email addresses, such as third party + // principals. For most identities, the format is + // `principal://iam.googleapis.com/{identity pool name}/subject/{subject}`. + // Some GKE identities, such as GKE_WORKLOAD, FREEFORM, and GKE_HUB_WORKLOAD, + // still use the legacy format `serviceAccount:{identity pool + // name}[{subject}]`. string principal_subject = 7; - // The name of the service account key used to create or exchange - // credentials for authenticating the service account making the request. + // The name of the service account key that was used to create or exchange + // credentials when authenticating the service account that made the request. // This is a scheme-less URI full resource name. For example: // - // "//iam.googleapis.com/projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}" + // "//iam.googleapis.com/projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}". // string service_account_key_name = 8; - // Identity delegation history of an authenticated service account that makes - // the request. It contains information on the real authorities that try to - // access GCP resources by delegating on a service account. When multiple - // authorities are present, they are guaranteed to be sorted based on the - // original ordering of the identity delegation events. + // The identity delegation history of an authenticated service account that + // made the request. The `serviceAccountDelegationInfo[]` object contains + // information about the real authorities that try to access Google Cloud + // resources by delegating on a service account. When multiple authorities are + // present, they are guaranteed to be sorted based on the original ordering of + // the identity delegation events. repeated ServiceAccountDelegationInfo service_account_delegation_info = 9; - // A string that represents the username of a user, user account, or other - // entity involved in the access event. What the entity is and what its role - // in the access event is depends on the finding that this field appears in. - // The entity is likely not an IAM principal, but could be a user that is - // logged into an operating system, if the finding is VM-related, or a user - // that is logged into some type of application that is involved in the - // access event. + // A string that represents a username. The username provided depends on the + // type of the finding and is likely not an IAM principal. For example, this + // can be a system username if the finding is related to a virtual machine, or + // it can be an application login username. string user_name = 11; } diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/cloud_dlp_data_profile.proto b/packages/google-cloud-securitycenter/protos/google/cloud/securitycenter/v1/cloud_dlp_data_profile.proto similarity index 100% rename from owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/cloud_dlp_data_profile.proto rename to packages/google-cloud-securitycenter/protos/google/cloud/securitycenter/v1/cloud_dlp_data_profile.proto diff --git a/owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/cloud_dlp_inspection.proto b/packages/google-cloud-securitycenter/protos/google/cloud/securitycenter/v1/cloud_dlp_inspection.proto similarity index 100% rename from owl-bot-staging/google-cloud-securitycenter/v1/protos/google/cloud/securitycenter/v1/cloud_dlp_inspection.proto rename to packages/google-cloud-securitycenter/protos/google/cloud/securitycenter/v1/cloud_dlp_inspection.proto diff --git a/packages/google-cloud-securitycenter/protos/google/cloud/securitycenter/v1/finding.proto b/packages/google-cloud-securitycenter/protos/google/cloud/securitycenter/v1/finding.proto index 5e2653c5e59..b57b7be4e7a 100644 --- a/packages/google-cloud-securitycenter/protos/google/cloud/securitycenter/v1/finding.proto +++ b/packages/google-cloud-securitycenter/protos/google/cloud/securitycenter/v1/finding.proto @@ -19,6 +19,8 @@ package google.cloud.securitycenter.v1; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/securitycenter/v1/access.proto"; +import "google/cloud/securitycenter/v1/cloud_dlp_data_profile.proto"; +import "google/cloud/securitycenter/v1/cloud_dlp_inspection.proto"; import "google/cloud/securitycenter/v1/compliance.proto"; import "google/cloud/securitycenter/v1/connection.proto"; import "google/cloud/securitycenter/v1/contact_details.proto"; @@ -84,7 +86,8 @@ message Finding { // exploitable, and results in the direct ability to execute arbitrary code, // exfiltrate data, and otherwise gain additional access and privileges to // cloud resources and workloads. Examples include publicly accessible - // unprotected user data, public SSH access with weak or no passwords, etc. + // unprotected user data and public SSH access with weak or no + // passwords. // // Threat: // Indicates a threat that is able to access, modify, or delete data or @@ -170,10 +173,12 @@ message Finding { SCC_ERROR = 5; } - // The relative resource name of this finding. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}" + // The [relative resource + // name](https://cloud.google.com/apis/design/resource_names#relative_resource_name) + // of the finding. Example: + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", + // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}", + // "projects/{project_id}/sources/{source_id}/findings/{finding_id}". string name = 1; // The relative resource name of the source the finding belongs to. See: @@ -247,11 +252,11 @@ message Finding { // The class of the finding. FindingClass finding_class = 17; - // Represents what's commonly known as an Indicator of compromise (IoC) in + // Represents what's commonly known as an *indicator of compromise* (IoC) in // computer forensics. This is an artifact observed on a network or in an // operating system that, with high confidence, indicates a computer - // intrusion. - // Reference: https://en.wikipedia.org/wiki/Indicator_of_compromise + // intrusion. For more information, see [Indicator of + // compromise](https://en.wikipedia.org/wiki/Indicator_of_compromise). Indicator indicator = 18; // Represents vulnerability-specific fields like CVE and CVSS scores. @@ -272,17 +277,16 @@ message Finding { // See: https://attack.mitre.org MitreAttack mitre_attack = 25; - // Access details associated to the Finding, such as more information on the - // caller, which method was accessed, from where, etc. + // Access details associated with the finding, such as more information on the + // caller, which method was accessed, and from where. Access access = 26; // Contains information about the IP connection associated with the finding. repeated Connection connections = 31; - // First known as mute_annotation. Records additional information about the - // mute operation e.g. mute config that muted the finding, user who muted the - // finding, etc. Unlike other attributes of a finding, a finding provider - // shouldn't set the value of mute. + // Records additional information about the mute operation, for example, the + // [mute configuration](/security-command-center/docs/how-to-mute-findings) + // that muted the finding and the user who muted the finding. string mute_initiator = 28; // Represents operating system processes associated with the Finding. @@ -316,16 +320,16 @@ message Finding { // "Event Threat Detection" or "Security Health Analytics". string parent_display_name = 36 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Contains more detail about the finding. + // Contains more details about the finding. string description = 37; - // Represents exfiltration associated with the Finding. + // Represents exfiltrations associated with the finding. Exfiltration exfiltration = 38; - // Represents IAM bindings associated with the Finding. + // Represents IAM bindings associated with the finding. repeated IamBinding iam_bindings = 39; - // Next steps associate to the finding. + // Steps to address the finding. string next_steps = 40; // Unique identifier of the module which generated the finding. @@ -333,8 +337,8 @@ message Finding { // folders/598186756061/securityHealthAnalyticsSettings/customModules/56799441161885 string module_name = 41; - // Containers associated with the finding. containers provides information - // for both Kubernetes and non-Kubernetes containers. + // Containers associated with the finding. This field provides information for + // both Kubernetes and non-Kubernetes containers. repeated Container containers = 42; // Kubernetes resources associated with the finding. @@ -346,6 +350,13 @@ message Finding { // File associated with the finding. repeated File files = 46; - // Kernel Rootkit signature. + // Cloud Data Loss Prevention (Cloud DLP) inspection results that are + // associated with the finding. + CloudDlpInspection cloud_dlp_inspection = 48; + + // Cloud DLP data profile that is associated with the finding. + CloudDlpDataProfile cloud_dlp_data_profile = 49; + + // Signature of the kernel rootkit. KernelRootkit kernel_rootkit = 50; } diff --git a/packages/google-cloud-securitycenter/protos/google/cloud/securitycenter/v1/securitycenter_service.proto b/packages/google-cloud-securitycenter/protos/google/cloud/securitycenter/v1/securitycenter_service.proto index 42db34f29a0..052c9cebccb 100644 --- a/packages/google-cloud-securitycenter/protos/google/cloud/securitycenter/v1/securitycenter_service.proto +++ b/packages/google-cloud-securitycenter/protos/google/cloud/securitycenter/v1/securitycenter_service.proto @@ -599,7 +599,7 @@ service SecurityCenter { // Updates the SecurityHealthAnalyticsCustomModule under the given name based // on the given update mask. Updating the enablement state is supported on // both resident and inherited modules (though resident modules cannot have an - // enablement state of “inherited”). Updating the display name and custom + // enablement state of "inherited"). Updating the display name and custom // config of a module is supported on resident modules only. rpc UpdateSecurityHealthAnalyticsCustomModule( UpdateSecurityHealthAnalyticsCustomModuleRequest) @@ -835,7 +835,7 @@ message CreateNotificationConfigRequest { [(google.api.field_behavior) = REQUIRED]; } -// Request message for creating security health analytics custom modules. +// Request message for creating Security Health Analytics custom modules. message CreateSecurityHealthAnalyticsCustomModuleRequest { // Required. Resource name of the new custom module's parent. Its format is // "organizations/{organization}/securityHealthAnalyticsSettings", @@ -899,7 +899,7 @@ message DeleteNotificationConfigRequest { ]; } -// Request message for deleting security health analytics custom modules. +// Request message for deleting Security Health Analytics custom modules. message DeleteSecurityHealthAnalyticsCustomModuleRequest { // Required. Name of the custom module to delete. Its format is // "organizations/{organization}/securityHealthAnalyticsSettings/customModules/{customModule}", @@ -968,7 +968,7 @@ message GetOrganizationSettingsRequest { ]; } -// Request message for getting effective security health analytics custom +// Request message for getting effective Security Health Analytics custom // modules. message GetEffectiveSecurityHealthAnalyticsCustomModuleRequest { // Required. Name of the effective custom module to get. Its format is @@ -984,7 +984,7 @@ message GetEffectiveSecurityHealthAnalyticsCustomModuleRequest { ]; } -// Request message for getting security health analytics custom modules. +// Request message for getting Security Health Analytics custom modules. message GetSecurityHealthAnalyticsCustomModuleRequest { // Required. Name of the custom module to get. Its format is // "organizations/{organization}/securityHealthAnalyticsSettings/customModules/{customModule}", @@ -1341,7 +1341,7 @@ message GroupResult { int64 count = 2; } -// Request message for listing descendant security health analytics custom +// Request message for listing descendant Security Health Analytics custom // modules. message ListDescendantSecurityHealthAnalyticsCustomModulesRequest { // Required. Name of parent to list descendant custom modules. Its format is @@ -1363,7 +1363,7 @@ message ListDescendantSecurityHealthAnalyticsCustomModulesRequest { string page_token = 3; } -// Response message for listing descendant security health analytics custom +// Response message for listing descendant Security Health Analytics custom // modules. message ListDescendantSecurityHealthAnalyticsCustomModulesResponse { // Custom modules belonging to the requested parent and its descendants. @@ -1444,7 +1444,7 @@ message ListNotificationConfigsResponse { string next_page_token = 2; } -// Request message for listing effective security health analytics custom +// Request message for listing effective Security Health Analytics custom // modules. message ListEffectiveSecurityHealthAnalyticsCustomModulesRequest { // Required. Name of parent to list effective custom modules. Its format is @@ -1466,7 +1466,7 @@ message ListEffectiveSecurityHealthAnalyticsCustomModulesRequest { string page_token = 3; } -// Response message for listing effective security health analytics custom +// Response message for listing effective Security Health Analytics custom // modules. message ListEffectiveSecurityHealthAnalyticsCustomModulesResponse { // Effective custom modules belonging to the requested parent. @@ -1478,7 +1478,7 @@ message ListEffectiveSecurityHealthAnalyticsCustomModulesResponse { string next_page_token = 2; } -// Request message for listing security health analytics custom modules. +// Request message for listing Security Health Analytics custom modules. message ListSecurityHealthAnalyticsCustomModulesRequest { // Required. Name of parent to list custom modules. Its format is // "organizations/{organization}/securityHealthAnalyticsSettings", @@ -1499,7 +1499,7 @@ message ListSecurityHealthAnalyticsCustomModulesRequest { string page_token = 3; } -// Response message for listing security health analytics custom modules. +// Response message for listing Security Health Analytics custom modules. message ListSecurityHealthAnalyticsCustomModulesResponse { // Custom modules belonging to the requested parent. repeated SecurityHealthAnalyticsCustomModule @@ -2092,7 +2092,7 @@ message UpdateOrganizationSettingsRequest { google.protobuf.FieldMask update_mask = 2; } -// Request message for updating security health analytics custom modules. +// Request message for updating Security Health Analytics custom modules. message UpdateSecurityHealthAnalyticsCustomModuleRequest { // Required. The SecurityHealthAnalytics custom module to update. SecurityHealthAnalyticsCustomModule security_health_analytics_custom_module = diff --git a/packages/google-cloud-securitycenter/protos/protos.d.ts b/packages/google-cloud-securitycenter/protos/protos.d.ts index 5707e51983b..5de8ed01e6a 100644 --- a/packages/google-cloud-securitycenter/protos/protos.d.ts +++ b/packages/google-cloud-securitycenter/protos/protos.d.ts @@ -1112,6 +1112,218 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a CloudDlpDataProfile. */ + interface ICloudDlpDataProfile { + + /** CloudDlpDataProfile dataProfile */ + dataProfile?: (string|null); + } + + /** Represents a CloudDlpDataProfile. */ + class CloudDlpDataProfile implements ICloudDlpDataProfile { + + /** + * Constructs a new CloudDlpDataProfile. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.securitycenter.v1.ICloudDlpDataProfile); + + /** CloudDlpDataProfile dataProfile. */ + public dataProfile: string; + + /** + * Creates a new CloudDlpDataProfile instance using the specified properties. + * @param [properties] Properties to set + * @returns CloudDlpDataProfile instance + */ + public static create(properties?: google.cloud.securitycenter.v1.ICloudDlpDataProfile): google.cloud.securitycenter.v1.CloudDlpDataProfile; + + /** + * Encodes the specified CloudDlpDataProfile message. Does not implicitly {@link google.cloud.securitycenter.v1.CloudDlpDataProfile.verify|verify} messages. + * @param message CloudDlpDataProfile message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.securitycenter.v1.ICloudDlpDataProfile, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CloudDlpDataProfile message, length delimited. Does not implicitly {@link google.cloud.securitycenter.v1.CloudDlpDataProfile.verify|verify} messages. + * @param message CloudDlpDataProfile message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.securitycenter.v1.ICloudDlpDataProfile, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CloudDlpDataProfile message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CloudDlpDataProfile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.securitycenter.v1.CloudDlpDataProfile; + + /** + * Decodes a CloudDlpDataProfile message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CloudDlpDataProfile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.securitycenter.v1.CloudDlpDataProfile; + + /** + * Verifies a CloudDlpDataProfile message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CloudDlpDataProfile message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CloudDlpDataProfile + */ + public static fromObject(object: { [k: string]: any }): google.cloud.securitycenter.v1.CloudDlpDataProfile; + + /** + * Creates a plain object from a CloudDlpDataProfile message. Also converts values to other types if specified. + * @param message CloudDlpDataProfile + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.securitycenter.v1.CloudDlpDataProfile, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CloudDlpDataProfile to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CloudDlpDataProfile + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CloudDlpInspection. */ + interface ICloudDlpInspection { + + /** CloudDlpInspection inspectJob */ + inspectJob?: (string|null); + + /** CloudDlpInspection infoType */ + infoType?: (string|null); + + /** CloudDlpInspection infoTypeCount */ + infoTypeCount?: (number|Long|string|null); + + /** CloudDlpInspection fullScan */ + fullScan?: (boolean|null); + } + + /** Represents a CloudDlpInspection. */ + class CloudDlpInspection implements ICloudDlpInspection { + + /** + * Constructs a new CloudDlpInspection. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.securitycenter.v1.ICloudDlpInspection); + + /** CloudDlpInspection inspectJob. */ + public inspectJob: string; + + /** CloudDlpInspection infoType. */ + public infoType: string; + + /** CloudDlpInspection infoTypeCount. */ + public infoTypeCount: (number|Long|string); + + /** CloudDlpInspection fullScan. */ + public fullScan: boolean; + + /** + * Creates a new CloudDlpInspection instance using the specified properties. + * @param [properties] Properties to set + * @returns CloudDlpInspection instance + */ + public static create(properties?: google.cloud.securitycenter.v1.ICloudDlpInspection): google.cloud.securitycenter.v1.CloudDlpInspection; + + /** + * Encodes the specified CloudDlpInspection message. Does not implicitly {@link google.cloud.securitycenter.v1.CloudDlpInspection.verify|verify} messages. + * @param message CloudDlpInspection message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.securitycenter.v1.ICloudDlpInspection, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CloudDlpInspection message, length delimited. Does not implicitly {@link google.cloud.securitycenter.v1.CloudDlpInspection.verify|verify} messages. + * @param message CloudDlpInspection message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.securitycenter.v1.ICloudDlpInspection, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CloudDlpInspection message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CloudDlpInspection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.securitycenter.v1.CloudDlpInspection; + + /** + * Decodes a CloudDlpInspection message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CloudDlpInspection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.securitycenter.v1.CloudDlpInspection; + + /** + * Verifies a CloudDlpInspection message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CloudDlpInspection message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CloudDlpInspection + */ + public static fromObject(object: { [k: string]: any }): google.cloud.securitycenter.v1.CloudDlpInspection; + + /** + * Creates a plain object from a CloudDlpInspection message. Also converts values to other types if specified. + * @param message CloudDlpInspection + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.securitycenter.v1.CloudDlpInspection, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CloudDlpInspection to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CloudDlpInspection + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a Compliance. */ interface ICompliance { @@ -3014,6 +3226,12 @@ export namespace google { /** Finding files */ files?: (google.cloud.securitycenter.v1.IFile[]|null); + /** Finding cloudDlpInspection */ + cloudDlpInspection?: (google.cloud.securitycenter.v1.ICloudDlpInspection|null); + + /** Finding cloudDlpDataProfile */ + cloudDlpDataProfile?: (google.cloud.securitycenter.v1.ICloudDlpDataProfile|null); + /** Finding kernelRootkit */ kernelRootkit?: (google.cloud.securitycenter.v1.IKernelRootkit|null); } @@ -3132,6 +3350,12 @@ export namespace google { /** Finding files. */ public files: google.cloud.securitycenter.v1.IFile[]; + /** Finding cloudDlpInspection. */ + public cloudDlpInspection?: (google.cloud.securitycenter.v1.ICloudDlpInspection|null); + + /** Finding cloudDlpDataProfile. */ + public cloudDlpDataProfile?: (google.cloud.securitycenter.v1.ICloudDlpDataProfile|null); + /** Finding kernelRootkit. */ public kernelRootkit?: (google.cloud.securitycenter.v1.IKernelRootkit|null); diff --git a/packages/google-cloud-securitycenter/protos/protos.js b/packages/google-cloud-securitycenter/protos/protos.js index 6b62f24f387..77ffcdf8905 100644 --- a/packages/google-cloud-securitycenter/protos/protos.js +++ b/packages/google-cloud-securitycenter/protos/protos.js @@ -2885,6 +2885,496 @@ return BigQueryExport; })(); + v1.CloudDlpDataProfile = (function() { + + /** + * Properties of a CloudDlpDataProfile. + * @memberof google.cloud.securitycenter.v1 + * @interface ICloudDlpDataProfile + * @property {string|null} [dataProfile] CloudDlpDataProfile dataProfile + */ + + /** + * Constructs a new CloudDlpDataProfile. + * @memberof google.cloud.securitycenter.v1 + * @classdesc Represents a CloudDlpDataProfile. + * @implements ICloudDlpDataProfile + * @constructor + * @param {google.cloud.securitycenter.v1.ICloudDlpDataProfile=} [properties] Properties to set + */ + function CloudDlpDataProfile(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CloudDlpDataProfile dataProfile. + * @member {string} dataProfile + * @memberof google.cloud.securitycenter.v1.CloudDlpDataProfile + * @instance + */ + CloudDlpDataProfile.prototype.dataProfile = ""; + + /** + * Creates a new CloudDlpDataProfile instance using the specified properties. + * @function create + * @memberof google.cloud.securitycenter.v1.CloudDlpDataProfile + * @static + * @param {google.cloud.securitycenter.v1.ICloudDlpDataProfile=} [properties] Properties to set + * @returns {google.cloud.securitycenter.v1.CloudDlpDataProfile} CloudDlpDataProfile instance + */ + CloudDlpDataProfile.create = function create(properties) { + return new CloudDlpDataProfile(properties); + }; + + /** + * Encodes the specified CloudDlpDataProfile message. Does not implicitly {@link google.cloud.securitycenter.v1.CloudDlpDataProfile.verify|verify} messages. + * @function encode + * @memberof google.cloud.securitycenter.v1.CloudDlpDataProfile + * @static + * @param {google.cloud.securitycenter.v1.ICloudDlpDataProfile} message CloudDlpDataProfile message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloudDlpDataProfile.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dataProfile != null && Object.hasOwnProperty.call(message, "dataProfile")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.dataProfile); + return writer; + }; + + /** + * Encodes the specified CloudDlpDataProfile message, length delimited. Does not implicitly {@link google.cloud.securitycenter.v1.CloudDlpDataProfile.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.securitycenter.v1.CloudDlpDataProfile + * @static + * @param {google.cloud.securitycenter.v1.ICloudDlpDataProfile} message CloudDlpDataProfile message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloudDlpDataProfile.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CloudDlpDataProfile message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.securitycenter.v1.CloudDlpDataProfile + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.securitycenter.v1.CloudDlpDataProfile} CloudDlpDataProfile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloudDlpDataProfile.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.securitycenter.v1.CloudDlpDataProfile(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.dataProfile = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CloudDlpDataProfile message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.securitycenter.v1.CloudDlpDataProfile + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.securitycenter.v1.CloudDlpDataProfile} CloudDlpDataProfile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloudDlpDataProfile.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CloudDlpDataProfile message. + * @function verify + * @memberof google.cloud.securitycenter.v1.CloudDlpDataProfile + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CloudDlpDataProfile.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dataProfile != null && message.hasOwnProperty("dataProfile")) + if (!$util.isString(message.dataProfile)) + return "dataProfile: string expected"; + return null; + }; + + /** + * Creates a CloudDlpDataProfile message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.securitycenter.v1.CloudDlpDataProfile + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.securitycenter.v1.CloudDlpDataProfile} CloudDlpDataProfile + */ + CloudDlpDataProfile.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.securitycenter.v1.CloudDlpDataProfile) + return object; + var message = new $root.google.cloud.securitycenter.v1.CloudDlpDataProfile(); + if (object.dataProfile != null) + message.dataProfile = String(object.dataProfile); + return message; + }; + + /** + * Creates a plain object from a CloudDlpDataProfile message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.securitycenter.v1.CloudDlpDataProfile + * @static + * @param {google.cloud.securitycenter.v1.CloudDlpDataProfile} message CloudDlpDataProfile + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CloudDlpDataProfile.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.dataProfile = ""; + if (message.dataProfile != null && message.hasOwnProperty("dataProfile")) + object.dataProfile = message.dataProfile; + return object; + }; + + /** + * Converts this CloudDlpDataProfile to JSON. + * @function toJSON + * @memberof google.cloud.securitycenter.v1.CloudDlpDataProfile + * @instance + * @returns {Object.} JSON object + */ + CloudDlpDataProfile.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CloudDlpDataProfile + * @function getTypeUrl + * @memberof google.cloud.securitycenter.v1.CloudDlpDataProfile + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CloudDlpDataProfile.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.securitycenter.v1.CloudDlpDataProfile"; + }; + + return CloudDlpDataProfile; + })(); + + v1.CloudDlpInspection = (function() { + + /** + * Properties of a CloudDlpInspection. + * @memberof google.cloud.securitycenter.v1 + * @interface ICloudDlpInspection + * @property {string|null} [inspectJob] CloudDlpInspection inspectJob + * @property {string|null} [infoType] CloudDlpInspection infoType + * @property {number|Long|null} [infoTypeCount] CloudDlpInspection infoTypeCount + * @property {boolean|null} [fullScan] CloudDlpInspection fullScan + */ + + /** + * Constructs a new CloudDlpInspection. + * @memberof google.cloud.securitycenter.v1 + * @classdesc Represents a CloudDlpInspection. + * @implements ICloudDlpInspection + * @constructor + * @param {google.cloud.securitycenter.v1.ICloudDlpInspection=} [properties] Properties to set + */ + function CloudDlpInspection(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CloudDlpInspection inspectJob. + * @member {string} inspectJob + * @memberof google.cloud.securitycenter.v1.CloudDlpInspection + * @instance + */ + CloudDlpInspection.prototype.inspectJob = ""; + + /** + * CloudDlpInspection infoType. + * @member {string} infoType + * @memberof google.cloud.securitycenter.v1.CloudDlpInspection + * @instance + */ + CloudDlpInspection.prototype.infoType = ""; + + /** + * CloudDlpInspection infoTypeCount. + * @member {number|Long} infoTypeCount + * @memberof google.cloud.securitycenter.v1.CloudDlpInspection + * @instance + */ + CloudDlpInspection.prototype.infoTypeCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * CloudDlpInspection fullScan. + * @member {boolean} fullScan + * @memberof google.cloud.securitycenter.v1.CloudDlpInspection + * @instance + */ + CloudDlpInspection.prototype.fullScan = false; + + /** + * Creates a new CloudDlpInspection instance using the specified properties. + * @function create + * @memberof google.cloud.securitycenter.v1.CloudDlpInspection + * @static + * @param {google.cloud.securitycenter.v1.ICloudDlpInspection=} [properties] Properties to set + * @returns {google.cloud.securitycenter.v1.CloudDlpInspection} CloudDlpInspection instance + */ + CloudDlpInspection.create = function create(properties) { + return new CloudDlpInspection(properties); + }; + + /** + * Encodes the specified CloudDlpInspection message. Does not implicitly {@link google.cloud.securitycenter.v1.CloudDlpInspection.verify|verify} messages. + * @function encode + * @memberof google.cloud.securitycenter.v1.CloudDlpInspection + * @static + * @param {google.cloud.securitycenter.v1.ICloudDlpInspection} message CloudDlpInspection message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloudDlpInspection.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inspectJob != null && Object.hasOwnProperty.call(message, "inspectJob")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.inspectJob); + if (message.infoType != null && Object.hasOwnProperty.call(message, "infoType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.infoType); + if (message.infoTypeCount != null && Object.hasOwnProperty.call(message, "infoTypeCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.infoTypeCount); + if (message.fullScan != null && Object.hasOwnProperty.call(message, "fullScan")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.fullScan); + return writer; + }; + + /** + * Encodes the specified CloudDlpInspection message, length delimited. Does not implicitly {@link google.cloud.securitycenter.v1.CloudDlpInspection.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.securitycenter.v1.CloudDlpInspection + * @static + * @param {google.cloud.securitycenter.v1.ICloudDlpInspection} message CloudDlpInspection message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloudDlpInspection.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CloudDlpInspection message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.securitycenter.v1.CloudDlpInspection + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.securitycenter.v1.CloudDlpInspection} CloudDlpInspection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloudDlpInspection.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.securitycenter.v1.CloudDlpInspection(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.inspectJob = reader.string(); + break; + } + case 2: { + message.infoType = reader.string(); + break; + } + case 3: { + message.infoTypeCount = reader.int64(); + break; + } + case 4: { + message.fullScan = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CloudDlpInspection message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.securitycenter.v1.CloudDlpInspection + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.securitycenter.v1.CloudDlpInspection} CloudDlpInspection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloudDlpInspection.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CloudDlpInspection message. + * @function verify + * @memberof google.cloud.securitycenter.v1.CloudDlpInspection + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CloudDlpInspection.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inspectJob != null && message.hasOwnProperty("inspectJob")) + if (!$util.isString(message.inspectJob)) + return "inspectJob: string expected"; + if (message.infoType != null && message.hasOwnProperty("infoType")) + if (!$util.isString(message.infoType)) + return "infoType: string expected"; + if (message.infoTypeCount != null && message.hasOwnProperty("infoTypeCount")) + if (!$util.isInteger(message.infoTypeCount) && !(message.infoTypeCount && $util.isInteger(message.infoTypeCount.low) && $util.isInteger(message.infoTypeCount.high))) + return "infoTypeCount: integer|Long expected"; + if (message.fullScan != null && message.hasOwnProperty("fullScan")) + if (typeof message.fullScan !== "boolean") + return "fullScan: boolean expected"; + return null; + }; + + /** + * Creates a CloudDlpInspection message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.securitycenter.v1.CloudDlpInspection + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.securitycenter.v1.CloudDlpInspection} CloudDlpInspection + */ + CloudDlpInspection.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.securitycenter.v1.CloudDlpInspection) + return object; + var message = new $root.google.cloud.securitycenter.v1.CloudDlpInspection(); + if (object.inspectJob != null) + message.inspectJob = String(object.inspectJob); + if (object.infoType != null) + message.infoType = String(object.infoType); + if (object.infoTypeCount != null) + if ($util.Long) + (message.infoTypeCount = $util.Long.fromValue(object.infoTypeCount)).unsigned = false; + else if (typeof object.infoTypeCount === "string") + message.infoTypeCount = parseInt(object.infoTypeCount, 10); + else if (typeof object.infoTypeCount === "number") + message.infoTypeCount = object.infoTypeCount; + else if (typeof object.infoTypeCount === "object") + message.infoTypeCount = new $util.LongBits(object.infoTypeCount.low >>> 0, object.infoTypeCount.high >>> 0).toNumber(); + if (object.fullScan != null) + message.fullScan = Boolean(object.fullScan); + return message; + }; + + /** + * Creates a plain object from a CloudDlpInspection message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.securitycenter.v1.CloudDlpInspection + * @static + * @param {google.cloud.securitycenter.v1.CloudDlpInspection} message CloudDlpInspection + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CloudDlpInspection.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.inspectJob = ""; + object.infoType = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.infoTypeCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.infoTypeCount = options.longs === String ? "0" : 0; + object.fullScan = false; + } + if (message.inspectJob != null && message.hasOwnProperty("inspectJob")) + object.inspectJob = message.inspectJob; + if (message.infoType != null && message.hasOwnProperty("infoType")) + object.infoType = message.infoType; + if (message.infoTypeCount != null && message.hasOwnProperty("infoTypeCount")) + if (typeof message.infoTypeCount === "number") + object.infoTypeCount = options.longs === String ? String(message.infoTypeCount) : message.infoTypeCount; + else + object.infoTypeCount = options.longs === String ? $util.Long.prototype.toString.call(message.infoTypeCount) : options.longs === Number ? new $util.LongBits(message.infoTypeCount.low >>> 0, message.infoTypeCount.high >>> 0).toNumber() : message.infoTypeCount; + if (message.fullScan != null && message.hasOwnProperty("fullScan")) + object.fullScan = message.fullScan; + return object; + }; + + /** + * Converts this CloudDlpInspection to JSON. + * @function toJSON + * @memberof google.cloud.securitycenter.v1.CloudDlpInspection + * @instance + * @returns {Object.} JSON object + */ + CloudDlpInspection.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CloudDlpInspection + * @function getTypeUrl + * @memberof google.cloud.securitycenter.v1.CloudDlpInspection + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CloudDlpInspection.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.securitycenter.v1.CloudDlpInspection"; + }; + + return CloudDlpInspection; + })(); + v1.Compliance = (function() { /** @@ -7370,6 +7860,8 @@ * @property {google.cloud.securitycenter.v1.IKubernetes|null} [kubernetes] Finding kubernetes * @property {google.cloud.securitycenter.v1.IDatabase|null} [database] Finding database * @property {Array.|null} [files] Finding files + * @property {google.cloud.securitycenter.v1.ICloudDlpInspection|null} [cloudDlpInspection] Finding cloudDlpInspection + * @property {google.cloud.securitycenter.v1.ICloudDlpDataProfile|null} [cloudDlpDataProfile] Finding cloudDlpDataProfile * @property {google.cloud.securitycenter.v1.IKernelRootkit|null} [kernelRootkit] Finding kernelRootkit */ @@ -7677,6 +8169,22 @@ */ Finding.prototype.files = $util.emptyArray; + /** + * Finding cloudDlpInspection. + * @member {google.cloud.securitycenter.v1.ICloudDlpInspection|null|undefined} cloudDlpInspection + * @memberof google.cloud.securitycenter.v1.Finding + * @instance + */ + Finding.prototype.cloudDlpInspection = null; + + /** + * Finding cloudDlpDataProfile. + * @member {google.cloud.securitycenter.v1.ICloudDlpDataProfile|null|undefined} cloudDlpDataProfile + * @memberof google.cloud.securitycenter.v1.Finding + * @instance + */ + Finding.prototype.cloudDlpDataProfile = null; + /** * Finding kernelRootkit. * @member {google.cloud.securitycenter.v1.IKernelRootkit|null|undefined} kernelRootkit @@ -7794,6 +8302,10 @@ if (message.files != null && message.files.length) for (var i = 0; i < message.files.length; ++i) $root.google.cloud.securitycenter.v1.File.encode(message.files[i], writer.uint32(/* id 46, wireType 2 =*/370).fork()).ldelim(); + if (message.cloudDlpInspection != null && Object.hasOwnProperty.call(message, "cloudDlpInspection")) + $root.google.cloud.securitycenter.v1.CloudDlpInspection.encode(message.cloudDlpInspection, writer.uint32(/* id 48, wireType 2 =*/386).fork()).ldelim(); + if (message.cloudDlpDataProfile != null && Object.hasOwnProperty.call(message, "cloudDlpDataProfile")) + $root.google.cloud.securitycenter.v1.CloudDlpDataProfile.encode(message.cloudDlpDataProfile, writer.uint32(/* id 49, wireType 2 =*/394).fork()).ldelim(); if (message.kernelRootkit != null && Object.hasOwnProperty.call(message, "kernelRootkit")) $root.google.cloud.securitycenter.v1.KernelRootkit.encode(message.kernelRootkit, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); return writer; @@ -8039,6 +8551,14 @@ message.files.push($root.google.cloud.securitycenter.v1.File.decode(reader, reader.uint32())); break; } + case 48: { + message.cloudDlpInspection = $root.google.cloud.securitycenter.v1.CloudDlpInspection.decode(reader, reader.uint32()); + break; + } + case 49: { + message.cloudDlpDataProfile = $root.google.cloud.securitycenter.v1.CloudDlpDataProfile.decode(reader, reader.uint32()); + break; + } case 50: { message.kernelRootkit = $root.google.cloud.securitycenter.v1.KernelRootkit.decode(reader, reader.uint32()); break; @@ -8292,6 +8812,16 @@ return "files." + error; } } + if (message.cloudDlpInspection != null && message.hasOwnProperty("cloudDlpInspection")) { + var error = $root.google.cloud.securitycenter.v1.CloudDlpInspection.verify(message.cloudDlpInspection); + if (error) + return "cloudDlpInspection." + error; + } + if (message.cloudDlpDataProfile != null && message.hasOwnProperty("cloudDlpDataProfile")) { + var error = $root.google.cloud.securitycenter.v1.CloudDlpDataProfile.verify(message.cloudDlpDataProfile); + if (error) + return "cloudDlpDataProfile." + error; + } if (message.kernelRootkit != null && message.hasOwnProperty("kernelRootkit")) { var error = $root.google.cloud.securitycenter.v1.KernelRootkit.verify(message.kernelRootkit); if (error) @@ -8583,6 +9113,16 @@ message.files[i] = $root.google.cloud.securitycenter.v1.File.fromObject(object.files[i]); } } + if (object.cloudDlpInspection != null) { + if (typeof object.cloudDlpInspection !== "object") + throw TypeError(".google.cloud.securitycenter.v1.Finding.cloudDlpInspection: object expected"); + message.cloudDlpInspection = $root.google.cloud.securitycenter.v1.CloudDlpInspection.fromObject(object.cloudDlpInspection); + } + if (object.cloudDlpDataProfile != null) { + if (typeof object.cloudDlpDataProfile !== "object") + throw TypeError(".google.cloud.securitycenter.v1.Finding.cloudDlpDataProfile: object expected"); + message.cloudDlpDataProfile = $root.google.cloud.securitycenter.v1.CloudDlpDataProfile.fromObject(object.cloudDlpDataProfile); + } if (object.kernelRootkit != null) { if (typeof object.kernelRootkit !== "object") throw TypeError(".google.cloud.securitycenter.v1.Finding.kernelRootkit: object expected"); @@ -8644,6 +9184,8 @@ object.moduleName = ""; object.kubernetes = null; object.database = null; + object.cloudDlpInspection = null; + object.cloudDlpDataProfile = null; object.kernelRootkit = null; } if (message.name != null && message.hasOwnProperty("name")) @@ -8744,6 +9286,10 @@ for (var j = 0; j < message.files.length; ++j) object.files[j] = $root.google.cloud.securitycenter.v1.File.toObject(message.files[j], options); } + if (message.cloudDlpInspection != null && message.hasOwnProperty("cloudDlpInspection")) + object.cloudDlpInspection = $root.google.cloud.securitycenter.v1.CloudDlpInspection.toObject(message.cloudDlpInspection, options); + if (message.cloudDlpDataProfile != null && message.hasOwnProperty("cloudDlpDataProfile")) + object.cloudDlpDataProfile = $root.google.cloud.securitycenter.v1.CloudDlpDataProfile.toObject(message.cloudDlpDataProfile, options); if (message.kernelRootkit != null && message.hasOwnProperty("kernelRootkit")) object.kernelRootkit = $root.google.cloud.securitycenter.v1.KernelRootkit.toObject(message.kernelRootkit, options); return object; diff --git a/packages/google-cloud-securitycenter/protos/protos.json b/packages/google-cloud-securitycenter/protos/protos.json index cde52a46560..c60db2ca4ed 100644 --- a/packages/google-cloud-securitycenter/protos/protos.json +++ b/packages/google-cloud-securitycenter/protos/protos.json @@ -262,6 +262,40 @@ } } }, + "CloudDlpDataProfile": { + "fields": { + "dataProfile": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "dlp.googleapis.com/TableDataProfile" + } + } + } + }, + "CloudDlpInspection": { + "fields": { + "inspectJob": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "dlp.googleapis.com/DlpJob" + } + }, + "infoType": { + "type": "string", + "id": 2 + }, + "infoTypeCount": { + "type": "int64", + "id": 3 + }, + "fullScan": { + "type": "bool", + "id": 4 + } + } + }, "Compliance": { "fields": { "standard": { @@ -760,6 +794,14 @@ "type": "File", "id": 46 }, + "cloudDlpInspection": { + "type": "CloudDlpInspection", + "id": 48 + }, + "cloudDlpDataProfile": { + "type": "CloudDlpDataProfile", + "id": 49 + }, "kernelRootkit": { "type": "KernelRootkit", "id": 50 diff --git a/packages/google-cloud-securitycenter/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json b/packages/google-cloud-securitycenter/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json index be3fc9a3e1c..1e2db7a9f25 100644 --- a/packages/google-cloud-securitycenter/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json +++ b/packages/google-cloud-securitycenter/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-securitycenter", - "version": "7.2.1", + "version": "7.3.0", "language": "TYPESCRIPT", "apis": [ { @@ -1735,7 +1735,7 @@ "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateSecurityHealthAnalyticsCustomModule_async", "title": "SecurityCenter updateSecurityHealthAnalyticsCustomModule Sample", "origin": "API_DEFINITION", - "description": " Updates the SecurityHealthAnalyticsCustomModule under the given name based on the given update mask. Updating the enablement state is supported on both resident and inherited modules (though resident modules cannot have an enablement state of \u201cinherited\u201d). Updating the display name and custom config of a module is supported on resident modules only.", + "description": " Updates the SecurityHealthAnalyticsCustomModule under the given name based on the given update mask. Updating the enablement state is supported on both resident and inherited modules (though resident modules cannot have an enablement state of \"inherited\"). Updating the display name and custom config of a module is supported on resident modules only.", "canonical": true, "file": "security_center.update_security_health_analytics_custom_module.js", "language": "JAVASCRIPT", diff --git a/packages/google-cloud-securitycenter/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json b/packages/google-cloud-securitycenter/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json index 72b89e8887d..54bc96c4a2a 100644 --- a/packages/google-cloud-securitycenter/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json +++ b/packages/google-cloud-securitycenter/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-securitycenter", - "version": "7.2.1", + "version": "7.3.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-securitycenter/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json b/packages/google-cloud-securitycenter/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json index e86dad841f0..cffec471ea1 100644 --- a/packages/google-cloud-securitycenter/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json +++ b/packages/google-cloud-securitycenter/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-securitycenter", - "version": "7.2.1", + "version": "7.3.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-securitycenter/src/v1/security_center_client.ts b/packages/google-cloud-securitycenter/src/v1/security_center_client.ts index 1f7a46bb19b..398b70badfb 100644 --- a/packages/google-cloud-securitycenter/src/v1/security_center_client.ts +++ b/packages/google-cloud-securitycenter/src/v1/security_center_client.ts @@ -3126,7 +3126,7 @@ export class SecurityCenterClient { * Updates the SecurityHealthAnalyticsCustomModule under the given name based * on the given update mask. Updating the enablement state is supported on * both resident and inherited modules (though resident modules cannot have an - * enablement state of “inherited”). Updating the display name and custom + * enablement state of "inherited"). Updating the display name and custom * config of a module is supported on resident modules only. * * @param {Object} request diff --git a/packages/google-cloud-securitycenter/src/v1/security_center_proto_list.json b/packages/google-cloud-securitycenter/src/v1/security_center_proto_list.json index 7210315576c..445bd4476f4 100644 --- a/packages/google-cloud-securitycenter/src/v1/security_center_proto_list.json +++ b/packages/google-cloud-securitycenter/src/v1/security_center_proto_list.json @@ -2,6 +2,8 @@ "../../protos/google/cloud/securitycenter/v1/access.proto", "../../protos/google/cloud/securitycenter/v1/asset.proto", "../../protos/google/cloud/securitycenter/v1/bigquery_export.proto", + "../../protos/google/cloud/securitycenter/v1/cloud_dlp_data_profile.proto", + "../../protos/google/cloud/securitycenter/v1/cloud_dlp_inspection.proto", "../../protos/google/cloud/securitycenter/v1/compliance.proto", "../../protos/google/cloud/securitycenter/v1/connection.proto", "../../protos/google/cloud/securitycenter/v1/contact_details.proto",