From 8b6ebb070fea21f9fa246b4998f436c6162fad34 Mon Sep 17 00:00:00 2001 From: David Supplee Date: Mon, 10 Feb 2020 14:35:00 -0800 Subject: [PATCH 1/2] feat: introduce security center v1p1beta1 --- SecurityCenter/metadata/V1P1Beta1/Asset.php | 77 + SecurityCenter/metadata/V1P1Beta1/Finding.php | 71 + .../metadata/V1P1Beta1/NotificationConfig.php | 62 + .../V1P1Beta1/NotificationMessage.php | 47 + .../V1P1Beta1/OrganizationSettings.php | 57 + .../V1P1Beta1/RunAssetDiscoveryResponse.php | 47 + .../metadata/V1P1Beta1/SecurityMarks.php | 50 + .../V1P1Beta1/SecuritycenterService.php | 454 +++ SecurityCenter/metadata/V1P1Beta1/Source.php | 44 + SecurityCenter/src/V1p1beta1/Asset.php | 311 +++ .../src/V1p1beta1/Asset/IamPolicy.php | 80 + .../Asset/SecurityCenterProperties.php | 337 +++ .../src/V1p1beta1/Asset_IamPolicy.php | 16 + .../Asset_SecurityCenterProperties.php | 16 + .../src/V1p1beta1/CreateFindingRequest.php | 151 + .../CreateNotificationConfigRequest.php | 159 ++ .../src/V1p1beta1/CreateSourceRequest.php | 109 + .../DeleteNotificationConfigRequest.php | 71 + SecurityCenter/src/V1p1beta1/Finding.php | 469 ++++ .../src/V1p1beta1/Finding/State.php | 65 + .../src/V1p1beta1/Finding_State.php | 16 + .../Gapic/SecurityCenterGapicClient.php | 2471 +++++++++++++++++ .../GetNotificationConfigRequest.php | 71 + .../GetOrganizationSettingsRequest.php | 71 + .../src/V1p1beta1/GetSourceRequest.php | 71 + .../src/V1p1beta1/GroupAssetsRequest.php | 645 +++++ .../src/V1p1beta1/GroupAssetsResponse.php | 181 ++ .../src/V1p1beta1/GroupFindingsRequest.php | 589 ++++ .../src/V1p1beta1/GroupFindingsResponse.php | 181 ++ SecurityCenter/src/V1p1beta1/GroupResult.php | 101 + .../src/V1p1beta1/ListAssetsRequest.php | 707 +++++ .../src/V1p1beta1/ListAssetsResponse.php | 173 ++ .../ListAssetsResponse/ListAssetsResult.php | 104 + .../ListAssetsResult/StateChange.php | 75 + .../ListAssetsResponse_ListAssetsResult.php | 16 + ...sResponse_ListAssetsResult_StateChange.php | 16 + .../src/V1p1beta1/ListFindingsRequest.php | 655 +++++ .../src/V1p1beta1/ListFindingsResponse.php | 173 ++ .../ListFindingsResult.php | 138 + .../ListFindingsResult/Resource.php | 211 ++ .../ListFindingsResult/StateChange.php | 87 + ...istFindingsResponse_ListFindingsResult.php | 16 + ...gsResponse_ListFindingsResult_Resource.php | 16 + ...esponse_ListFindingsResult_StateChange.php | 16 + .../ListNotificationConfigsRequest.php | 151 + .../ListNotificationConfigsResponse.php | 105 + .../src/V1p1beta1/ListSourcesRequest.php | 151 + .../src/V1p1beta1/ListSourcesResponse.php | 105 + .../src/V1p1beta1/NotificationConfig.php | 262 ++ .../NotificationConfig/EventType.php | 57 + .../NotificationConfig/StreamingConfig.php | 131 + .../NotificationConfig_EventType.php | 16 + .../NotificationConfig_StreamingConfig.php | 16 + .../src/V1p1beta1/NotificationMessage.php | 107 + .../src/V1p1beta1/OrganizationSettings.php | 160 ++ .../AssetDiscoveryConfig.php | 104 + .../AssetDiscoveryConfig/InclusionMode.php | 74 + ...anizationSettings_AssetDiscoveryConfig.php | 16 + ...ngs_AssetDiscoveryConfig_InclusionMode.php | 16 + SecurityCenter/src/V1p1beta1/README.md | 17 + .../V1p1beta1/RunAssetDiscoveryRequest.php | 71 + .../V1p1beta1/RunAssetDiscoveryResponse.php | 101 + .../RunAssetDiscoveryResponse/State.php | 72 + .../RunAssetDiscoveryResponse_State.php | 16 + .../src/V1p1beta1/SecurityCenterClient.php | 38 + .../V1p1beta1/SecurityCenterGrpcClient.php | 376 +++ .../src/V1p1beta1/SecurityMarks.php | 144 + .../src/V1p1beta1/SetFindingStateRequest.php | 147 + SecurityCenter/src/V1p1beta1/Source.php | 189 ++ .../src/V1p1beta1/UpdateFindingRequest.php | 137 + .../UpdateNotificationConfigRequest.php | 105 + .../UpdateOrganizationSettingsRequest.php | 105 + .../V1p1beta1/UpdateSecurityMarksRequest.php | 155 ++ .../src/V1p1beta1/UpdateSourceRequest.php | 105 + .../security_center_client_config.json | 141 + .../security_center_descriptor_config.php | 78 + .../security_center_rest_client_config.php | 335 +++ SecurityCenter/synth.metadata | 20 +- SecurityCenter/synth.py | 37 +- .../V1P1Beta1/SecurityCenterClientTest.php | 1994 +++++++++++++ docs/contents/cloud-security-center.json | 13 + 81 files changed, 15341 insertions(+), 19 deletions(-) create mode 100644 SecurityCenter/metadata/V1P1Beta1/Asset.php create mode 100644 SecurityCenter/metadata/V1P1Beta1/Finding.php create mode 100644 SecurityCenter/metadata/V1P1Beta1/NotificationConfig.php create mode 100644 SecurityCenter/metadata/V1P1Beta1/NotificationMessage.php create mode 100644 SecurityCenter/metadata/V1P1Beta1/OrganizationSettings.php create mode 100644 SecurityCenter/metadata/V1P1Beta1/RunAssetDiscoveryResponse.php create mode 100644 SecurityCenter/metadata/V1P1Beta1/SecurityMarks.php create mode 100644 SecurityCenter/metadata/V1P1Beta1/SecuritycenterService.php create mode 100644 SecurityCenter/metadata/V1P1Beta1/Source.php create mode 100644 SecurityCenter/src/V1p1beta1/Asset.php create mode 100644 SecurityCenter/src/V1p1beta1/Asset/IamPolicy.php create mode 100644 SecurityCenter/src/V1p1beta1/Asset/SecurityCenterProperties.php create mode 100644 SecurityCenter/src/V1p1beta1/Asset_IamPolicy.php create mode 100644 SecurityCenter/src/V1p1beta1/Asset_SecurityCenterProperties.php create mode 100644 SecurityCenter/src/V1p1beta1/CreateFindingRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/CreateNotificationConfigRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/CreateSourceRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/DeleteNotificationConfigRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/Finding.php create mode 100644 SecurityCenter/src/V1p1beta1/Finding/State.php create mode 100644 SecurityCenter/src/V1p1beta1/Finding_State.php create mode 100644 SecurityCenter/src/V1p1beta1/Gapic/SecurityCenterGapicClient.php create mode 100644 SecurityCenter/src/V1p1beta1/GetNotificationConfigRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/GetOrganizationSettingsRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/GetSourceRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/GroupAssetsRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/GroupAssetsResponse.php create mode 100644 SecurityCenter/src/V1p1beta1/GroupFindingsRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/GroupFindingsResponse.php create mode 100644 SecurityCenter/src/V1p1beta1/GroupResult.php create mode 100644 SecurityCenter/src/V1p1beta1/ListAssetsRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/ListAssetsResponse.php create mode 100644 SecurityCenter/src/V1p1beta1/ListAssetsResponse/ListAssetsResult.php create mode 100644 SecurityCenter/src/V1p1beta1/ListAssetsResponse/ListAssetsResult/StateChange.php create mode 100644 SecurityCenter/src/V1p1beta1/ListAssetsResponse_ListAssetsResult.php create mode 100644 SecurityCenter/src/V1p1beta1/ListAssetsResponse_ListAssetsResult_StateChange.php create mode 100644 SecurityCenter/src/V1p1beta1/ListFindingsRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/ListFindingsResponse.php create mode 100644 SecurityCenter/src/V1p1beta1/ListFindingsResponse/ListFindingsResult.php create mode 100644 SecurityCenter/src/V1p1beta1/ListFindingsResponse/ListFindingsResult/Resource.php create mode 100644 SecurityCenter/src/V1p1beta1/ListFindingsResponse/ListFindingsResult/StateChange.php create mode 100644 SecurityCenter/src/V1p1beta1/ListFindingsResponse_ListFindingsResult.php create mode 100644 SecurityCenter/src/V1p1beta1/ListFindingsResponse_ListFindingsResult_Resource.php create mode 100644 SecurityCenter/src/V1p1beta1/ListFindingsResponse_ListFindingsResult_StateChange.php create mode 100644 SecurityCenter/src/V1p1beta1/ListNotificationConfigsRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/ListNotificationConfigsResponse.php create mode 100644 SecurityCenter/src/V1p1beta1/ListSourcesRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/ListSourcesResponse.php create mode 100644 SecurityCenter/src/V1p1beta1/NotificationConfig.php create mode 100644 SecurityCenter/src/V1p1beta1/NotificationConfig/EventType.php create mode 100644 SecurityCenter/src/V1p1beta1/NotificationConfig/StreamingConfig.php create mode 100644 SecurityCenter/src/V1p1beta1/NotificationConfig_EventType.php create mode 100644 SecurityCenter/src/V1p1beta1/NotificationConfig_StreamingConfig.php create mode 100644 SecurityCenter/src/V1p1beta1/NotificationMessage.php create mode 100644 SecurityCenter/src/V1p1beta1/OrganizationSettings.php create mode 100644 SecurityCenter/src/V1p1beta1/OrganizationSettings/AssetDiscoveryConfig.php create mode 100644 SecurityCenter/src/V1p1beta1/OrganizationSettings/AssetDiscoveryConfig/InclusionMode.php create mode 100644 SecurityCenter/src/V1p1beta1/OrganizationSettings_AssetDiscoveryConfig.php create mode 100644 SecurityCenter/src/V1p1beta1/OrganizationSettings_AssetDiscoveryConfig_InclusionMode.php create mode 100644 SecurityCenter/src/V1p1beta1/README.md create mode 100644 SecurityCenter/src/V1p1beta1/RunAssetDiscoveryRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/RunAssetDiscoveryResponse.php create mode 100644 SecurityCenter/src/V1p1beta1/RunAssetDiscoveryResponse/State.php create mode 100644 SecurityCenter/src/V1p1beta1/RunAssetDiscoveryResponse_State.php create mode 100644 SecurityCenter/src/V1p1beta1/SecurityCenterClient.php create mode 100644 SecurityCenter/src/V1p1beta1/SecurityCenterGrpcClient.php create mode 100644 SecurityCenter/src/V1p1beta1/SecurityMarks.php create mode 100644 SecurityCenter/src/V1p1beta1/SetFindingStateRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/Source.php create mode 100644 SecurityCenter/src/V1p1beta1/UpdateFindingRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/UpdateNotificationConfigRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/UpdateOrganizationSettingsRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/UpdateSecurityMarksRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/UpdateSourceRequest.php create mode 100644 SecurityCenter/src/V1p1beta1/resources/security_center_client_config.json create mode 100644 SecurityCenter/src/V1p1beta1/resources/security_center_descriptor_config.php create mode 100644 SecurityCenter/src/V1p1beta1/resources/security_center_rest_client_config.php create mode 100644 SecurityCenter/tests/Unit/V1P1Beta1/SecurityCenterClientTest.php diff --git a/SecurityCenter/metadata/V1P1Beta1/Asset.php b/SecurityCenter/metadata/V1P1Beta1/Asset.php new file mode 100644 index 000000000000..8798f9fce1de --- /dev/null +++ b/SecurityCenter/metadata/V1P1Beta1/Asset.php @@ -0,0 +1,77 @@ +internalAddGeneratedFile(hex2bin( + "0aa90b0a31676f6f676c652f636c6f75642f736563757269747963656e74" . + "65722f7631703162657461312f61737365742e70726f746f1225676f6f67" . + "6c652e636c6f75642e736563757269747963656e7465722e763170316265" . + "7461311a19676f6f676c652f6170692f7265736f757263652e70726f746f" . + "1a3a676f6f676c652f636c6f75642f736563757269747963656e7465722f" . + "7631703162657461312f73656375726974795f6d61726b732e70726f746f" . + "1a1c676f6f676c652f70726f746f6275662f7374727563742e70726f746f" . + "1a1f676f6f676c652f70726f746f6275662f74696d657374616d702e7072" . + "6f746f22ae070a054173736574120c0a046e616d6518012001280912690a" . + "1a73656375726974795f63656e7465725f70726f70657274696573180220" . + "01280b32452e676f6f676c652e636c6f75642e736563757269747963656e" . + "7465722e7631703162657461312e41737365742e53656375726974794365" . + "6e74657250726f7065727469657312610a137265736f757263655f70726f" . + "7065727469657318072003280b32442e676f6f676c652e636c6f75642e73" . + "6563757269747963656e7465722e7631703162657461312e41737365742e" . + "5265736f7572636550726f70657274696573456e747279124c0a0e736563" . + "75726974795f6d61726b7318082001280b32342e676f6f676c652e636c6f" . + "75642e736563757269747963656e7465722e7631703162657461312e5365" . + "6375726974794d61726b73122f0a0b6372656174655f74696d6518092001" . + "280b321a2e676f6f676c652e70726f746f6275662e54696d657374616d70" . + "122f0a0b7570646174655f74696d65180a2001280b321a2e676f6f676c65" . + "2e70726f746f6275662e54696d657374616d70124a0a0a69616d5f706f6c" . + "696379180b2001280b32362e676f6f676c652e636c6f75642e7365637572" . + "69747963656e7465722e7631703162657461312e41737365742e49616d50" . + "6f6c6963791a80020a18536563757269747943656e74657250726f706572" . + "7469657312150a0d7265736f757263655f6e616d6518012001280912150a" . + "0d7265736f757263655f7479706518022001280912170a0f7265736f7572" . + "63655f706172656e7418032001280912180a107265736f757263655f7072" . + "6f6a65637418042001280912170a0f7265736f757263655f6f776e657273" . + "180520032809121d0a157265736f757263655f646973706c61795f6e616d" . + "6518062001280912240a1c7265736f757263655f706172656e745f646973" . + "706c61795f6e616d6518072001280912250a1d7265736f757263655f7072" . + "6f6a6563745f646973706c61795f6e616d651808200128091a200a094961" . + "6d506f6c69637912130a0b706f6c6963795f626c6f621801200128091a51" . + "0a175265736f7572636550726f70657274696573456e747279120b0a036b" . + "657918012001280912250a0576616c756518022001280b32162e676f6f67" . + "6c652e70726f746f6275662e56616c75653a0238013a55ea41520a237365" . + "63757269747963656e7465722e676f6f676c65617069732e636f6d2f4173" . + "736574122b6f7267616e697a6174696f6e732f7b6f7267616e697a617469" . + "6f6e7d2f6173736574732f7b61737365747d42fd010a29636f6d2e676f6f" . + "676c652e636c6f75642e736563757269747963656e7465722e7631703162" . + "6574613150015a53676f6f676c652e676f6c616e672e6f72672f67656e70" . + "726f746f2f676f6f676c65617069732f636c6f75642f7365637572697479" . + "63656e7465722f7631703162657461313b736563757269747963656e7465" . + "72aa0225476f6f676c652e436c6f75642e536563757269747943656e7465" . + "722e563150314265746131ca0225476f6f676c655c436c6f75645c536563" . + "757269747943656e7465725c563170316265746131ea0228476f6f676c65" . + "3a3a436c6f75643a3a536563757269747943656e7465723a3a5631703162" . + "65746131620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/SecurityCenter/metadata/V1P1Beta1/Finding.php b/SecurityCenter/metadata/V1P1Beta1/Finding.php new file mode 100644 index 000000000000..c460ae91e8ac --- /dev/null +++ b/SecurityCenter/metadata/V1P1Beta1/Finding.php @@ -0,0 +1,71 @@ +internalAddGeneratedFile(hex2bin( + "0ad7090a33676f6f676c652f636c6f75642f736563757269747963656e74" . + "65722f7631703162657461312f66696e64696e672e70726f746f1225676f" . + "6f676c652e636c6f75642e736563757269747963656e7465722e76317031" . + "62657461311a1f676f6f676c652f6170692f6669656c645f626568617669" . + "6f722e70726f746f1a19676f6f676c652f6170692f7265736f757263652e" . + "70726f746f1a3a676f6f676c652f636c6f75642f73656375726974796365" . + "6e7465722f7631703162657461312f73656375726974795f6d61726b732e" . + "70726f746f1a1c676f6f676c652f70726f746f6275662f7374727563742e" . + "70726f746f1a1f676f6f676c652f70726f746f6275662f74696d65737461" . + "6d702e70726f746f22b9050a0746696e64696e67120c0a046e616d651801" . + "20012809120e0a06706172656e7418022001280912150a0d7265736f7572" . + "63655f6e616d6518032001280912430a05737461746518042001280e3234" . + "2e676f6f676c652e636c6f75642e736563757269747963656e7465722e76" . + "31703162657461312e46696e64696e672e537461746512100a0863617465" . + "676f727918052001280912140a0c65787465726e616c5f75726918062001" . + "2809125f0a11736f757263655f70726f7065727469657318072003280b32" . + "442e676f6f676c652e636c6f75642e736563757269747963656e7465722e" . + "7631703162657461312e46696e64696e672e536f7572636550726f706572" . + "74696573456e74727912510a0e73656375726974795f6d61726b73180820" . + "01280b32342e676f6f676c652e636c6f75642e736563757269747963656e" . + "7465722e7631703162657461312e53656375726974794d61726b734203e0" . + "4103122e0a0a6576656e745f74696d6518092001280b321a2e676f6f676c" . + "652e70726f746f6275662e54696d657374616d70122f0a0b637265617465" . + "5f74696d65180a2001280b321a2e676f6f676c652e70726f746f6275662e" . + "54696d657374616d701a4f0a15536f7572636550726f7065727469657345" . + "6e747279120b0a036b657918012001280912250a0576616c756518022001" . + "280b32162e676f6f676c652e70726f746f6275662e56616c75653a023801" . + "22380a05537461746512150a1153544154455f554e535045434946494544" . + "1000120a0a064143544956451001120c0a08494e41435449564510023a6c" . + "ea41690a25736563757269747963656e7465722e676f6f676c6561706973" . + "2e636f6d2f46696e64696e6712406f7267616e697a6174696f6e732f7b6f" . + "7267616e697a6174696f6e7d2f736f75726365732f7b736f757263657d2f" . + "66696e64696e67732f7b66696e64696e677d42fd010a29636f6d2e676f6f" . + "676c652e636c6f75642e736563757269747963656e7465722e7631703162" . + "6574613150015a53676f6f676c652e676f6c616e672e6f72672f67656e70" . + "726f746f2f676f6f676c65617069732f636c6f75642f7365637572697479" . + "63656e7465722f7631703162657461313b736563757269747963656e7465" . + "72aa0225476f6f676c652e436c6f75642e536563757269747943656e7465" . + "722e563150314265746131ca0225476f6f676c655c436c6f75645c536563" . + "757269747943656e7465725c563170316265746131ea0228476f6f676c65" . + "3a3a436c6f75643a3a536563757269747943656e7465723a3a5631703162" . + "65746131620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/SecurityCenter/metadata/V1P1Beta1/NotificationConfig.php b/SecurityCenter/metadata/V1P1Beta1/NotificationConfig.php new file mode 100644 index 000000000000..c9a86b8c46d8 --- /dev/null +++ b/SecurityCenter/metadata/V1P1Beta1/NotificationConfig.php @@ -0,0 +1,62 @@ +internalAddGeneratedFile(hex2bin( + "0aa8080a3f676f6f676c652f636c6f75642f736563757269747963656e74" . + "65722f7631703162657461312f6e6f74696669636174696f6e5f636f6e66" . + "69672e70726f746f1225676f6f676c652e636c6f75642e73656375726974" . + "7963656e7465722e7631703162657461311a1f676f6f676c652f6170692f" . + "6669656c645f6265686176696f722e70726f746f1a19676f6f676c652f61" . + "70692f7265736f757263652e70726f746f22b6040a124e6f746966696361" . + "74696f6e436f6e666967120c0a046e616d6518012001280912130a0b6465" . + "736372697074696f6e18022001280912570a0a6576656e745f7479706518" . + "032001280e32432e676f6f676c652e636c6f75642e736563757269747963" . + "656e7465722e7631703162657461312e4e6f74696669636174696f6e436f" . + "6e6669672e4576656e745479706512360a0c7075627375625f746f706963" . + "1804200128094220fa411d0a1b7075627375622e676f6f676c6561706973" . + "2e636f6d2f546f706963121c0a0f736572766963655f6163636f756e7418" . + "05200128094203e0410312650a1073747265616d696e675f636f6e666967" . + "18062001280b32492e676f6f676c652e636c6f75642e7365637572697479" . + "63656e7465722e7631703162657461312e4e6f74696669636174696f6e43" . + "6f6e6669672e53747265616d696e67436f6e66696748001a210a0f537472" . + "65616d696e67436f6e666967120e0a0666696c7465721801200128092234" . + "0a094576656e7454797065121a0a164556454e545f545950455f554e5350" . + "454349464945441000120b0a0746494e44494e4710013a7dea417a0a3073" . + "6563757269747963656e7465722e676f6f676c65617069732e636f6d2f4e" . + "6f74696669636174696f6e436f6e66696712466f7267616e697a6174696f" . + "6e732f7b6f7267616e697a6174696f6e7d2f6e6f74696669636174696f6e" . + "436f6e666967732f7b6e6f74696669636174696f6e5f636f6e6669677d42" . + "0f0a0d6e6f746966795f636f6e66696742c0020a29636f6d2e676f6f676c" . + "652e636c6f75642e736563757269747963656e7465722e76317031626574" . + "613150015a53676f6f676c652e676f6c616e672e6f72672f67656e70726f" . + "746f2f676f6f676c65617069732f636c6f75642f73656375726974796365" . + "6e7465722f7631703162657461313b736563757269747963656e746572aa" . + "0225476f6f676c652e436c6f75642e536563757269747943656e7465722e" . + "563150314265746131ca0225476f6f676c655c436c6f75645c5365637572" . + "69747943656e7465725c563170316265746131ea0228476f6f676c653a3a" . + "436c6f75643a3a536563757269747943656e7465723a3a56317031626574" . + "6131ea41400a1b7075627375622e676f6f676c65617069732e636f6d2f54" . + "6f706963122170726f6a656374732f7b70726f6a6563747d2f746f706963" . + "732f7b746f7069637d620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/SecurityCenter/metadata/V1P1Beta1/NotificationMessage.php b/SecurityCenter/metadata/V1P1Beta1/NotificationMessage.php new file mode 100644 index 000000000000..71c10e40704d --- /dev/null +++ b/SecurityCenter/metadata/V1P1Beta1/NotificationMessage.php @@ -0,0 +1,47 @@ +internalAddGeneratedFile(hex2bin( + "0adf040a40676f6f676c652f636c6f75642f736563757269747963656e74" . + "65722f7631703162657461312f6e6f74696669636174696f6e5f6d657373" . + "6167652e70726f746f1225676f6f676c652e636c6f75642e736563757269" . + "747963656e7465722e7631703162657461311a31676f6f676c652f636c6f" . + "75642f736563757269747963656e7465722f7631703162657461312f6173" . + "7365742e70726f746f1a33676f6f676c652f636c6f75642f736563757269" . + "747963656e7465722f7631703162657461312f66696e64696e672e70726f" . + "746f2283010a134e6f74696669636174696f6e4d65737361676512200a18" . + "6e6f74696669636174696f6e5f636f6e6669675f6e616d65180120012809" . + "12410a0766696e64696e6718022001280b322e2e676f6f676c652e636c6f" . + "75642e736563757269747963656e7465722e7631703162657461312e4669" . + "6e64696e67480042070a056576656e7442fd010a29636f6d2e676f6f676c" . + "652e636c6f75642e736563757269747963656e7465722e76317031626574" . + "613150015a53676f6f676c652e676f6c616e672e6f72672f67656e70726f" . + "746f2f676f6f676c65617069732f636c6f75642f73656375726974796365" . + "6e7465722f7631703162657461313b736563757269747963656e746572aa" . + "0225476f6f676c652e436c6f75642e536563757269747943656e7465722e" . + "563150314265746131ca0225476f6f676c655c436c6f75645c5365637572" . + "69747943656e7465725c563170316265746131ea0228476f6f676c653a3a" . + "436c6f75643a3a536563757269747943656e7465723a3a56317031626574" . + "6131620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/SecurityCenter/metadata/V1P1Beta1/OrganizationSettings.php b/SecurityCenter/metadata/V1P1Beta1/OrganizationSettings.php new file mode 100644 index 000000000000..d154ac12d2e4 --- /dev/null +++ b/SecurityCenter/metadata/V1P1Beta1/OrganizationSettings.php @@ -0,0 +1,57 @@ +internalAddGeneratedFile(hex2bin( + "0aa8070a41676f6f676c652f636c6f75642f736563757269747963656e74" . + "65722f7631703162657461312f6f7267616e697a6174696f6e5f73657474" . + "696e67732e70726f746f1225676f6f676c652e636c6f75642e7365637572" . + "69747963656e7465722e7631703162657461311a19676f6f676c652f6170" . + "692f7265736f757263652e70726f746f2298040a144f7267616e697a6174" . + "696f6e53657474696e6773120c0a046e616d65180120012809121e0a1665" . + "6e61626c655f61737365745f646973636f7665727918022001280812700a" . + "1661737365745f646973636f766572795f636f6e66696718032001280b32" . + "502e676f6f676c652e636c6f75642e736563757269747963656e7465722e" . + "7631703162657461312e4f7267616e697a6174696f6e53657474696e6773" . + "2e4173736574446973636f76657279436f6e6669671af3010a1441737365" . + "74446973636f76657279436f6e66696712130a0b70726f6a6563745f6964" . + "7318012003280912760a0e696e636c7573696f6e5f6d6f64651802200128" . + "0e325e2e676f6f676c652e636c6f75642e736563757269747963656e7465" . + "722e7631703162657461312e4f7267616e697a6174696f6e53657474696e" . + "67732e4173736574446973636f76657279436f6e6669672e496e636c7573" . + "696f6e4d6f6465224e0a0d496e636c7573696f6e4d6f6465121e0a1a494e" . + "434c5553494f4e5f4d4f44455f554e535045434946494544100012100a0c" . + "494e434c5544455f4f4e4c591001120b0a074558434c55444510023a6aea" . + "41670a32736563757269747963656e7465722e676f6f676c65617069732e" . + "636f6d2f4f7267616e697a6174696f6e53657474696e677312316f726761" . + "6e697a6174696f6e732f7b6f7267616e697a6174696f6e7d2f6f7267616e" . + "697a6174696f6e53657474696e677342fd010a29636f6d2e676f6f676c65" . + "2e636c6f75642e736563757269747963656e7465722e7631703162657461" . + "3150015a53676f6f676c652e676f6c616e672e6f72672f67656e70726f74" . + "6f2f676f6f676c65617069732f636c6f75642f736563757269747963656e" . + "7465722f7631703162657461313b736563757269747963656e746572aa02" . + "25476f6f676c652e436c6f75642e536563757269747943656e7465722e56" . + "3150314265746131ca0225476f6f676c655c436c6f75645c536563757269" . + "747943656e7465725c563170316265746131ea0228476f6f676c653a3a43" . + "6c6f75643a3a536563757269747943656e7465723a3a5631703162657461" . + "31620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/SecurityCenter/metadata/V1P1Beta1/RunAssetDiscoveryResponse.php b/SecurityCenter/metadata/V1P1Beta1/RunAssetDiscoveryResponse.php new file mode 100644 index 000000000000..5b1b99f1953f --- /dev/null +++ b/SecurityCenter/metadata/V1P1Beta1/RunAssetDiscoveryResponse.php @@ -0,0 +1,47 @@ +internalAddGeneratedFile(hex2bin( + "0a8a050a48676f6f676c652f636c6f75642f736563757269747963656e74" . + "65722f7631703162657461312f72756e5f61737365745f646973636f7665" . + "72795f726573706f6e73652e70726f746f1225676f6f676c652e636c6f75" . + "642e736563757269747963656e7465722e7631703162657461311a1e676f" . + "6f676c652f70726f746f6275662f6475726174696f6e2e70726f746f22ee" . + "010a1952756e4173736574446973636f76657279526573706f6e73651255" . + "0a05737461746518012001280e32462e676f6f676c652e636c6f75642e73" . + "6563757269747963656e7465722e7631703162657461312e52756e417373" . + "6574446973636f76657279526573706f6e73652e5374617465122b0a0864" . + "75726174696f6e18022001280b32192e676f6f676c652e70726f746f6275" . + "662e4475726174696f6e224d0a05537461746512150a1153544154455f55" . + "4e5350454349464945441000120d0a09434f4d504c455445441001120e0a" . + "0a535550455253454445441002120e0a0a5445524d494e41544544100342" . + "fd010a29636f6d2e676f6f676c652e636c6f75642e736563757269747963" . + "656e7465722e76317031626574613150015a53676f6f676c652e676f6c61" . + "6e672e6f72672f67656e70726f746f2f676f6f676c65617069732f636c6f" . + "75642f736563757269747963656e7465722f7631703162657461313b7365" . + "63757269747963656e746572aa0225476f6f676c652e436c6f75642e5365" . + "63757269747943656e7465722e563150314265746131ca0225476f6f676c" . + "655c436c6f75645c536563757269747943656e7465725c56317031626574" . + "6131ea0228476f6f676c653a3a436c6f75643a3a53656375726974794365" . + "6e7465723a3a563170316265746131620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/SecurityCenter/metadata/V1P1Beta1/SecurityMarks.php b/SecurityCenter/metadata/V1P1Beta1/SecurityMarks.php new file mode 100644 index 000000000000..98f8bb9161e7 --- /dev/null +++ b/SecurityCenter/metadata/V1P1Beta1/SecurityMarks.php @@ -0,0 +1,50 @@ +internalAddGeneratedFile(hex2bin( + "0ae3050a3a676f6f676c652f636c6f75642f736563757269747963656e74" . + "65722f7631703162657461312f73656375726974795f6d61726b732e7072" . + "6f746f1225676f6f676c652e636c6f75642e736563757269747963656e74" . + "65722e7631703162657461311a19676f6f676c652f6170692f7265736f75" . + "7263652e70726f746f22da020a0d53656375726974794d61726b73120c0a" . + "046e616d65180120012809124e0a056d61726b7318022003280b323f2e67" . + "6f6f676c652e636c6f75642e736563757269747963656e7465722e763170" . + "3162657461312e53656375726974794d61726b732e4d61726b73456e7472" . + "791a2c0a0a4d61726b73456e747279120b0a036b6579180120012809120d" . + "0a0576616c75651802200128093a0238013abc01ea41b8010a2b73656375" . + "7269747963656e7465722e676f6f676c65617069732e636f6d2f53656375" . + "726974794d61726b7312396f7267616e697a6174696f6e732f7b6f726761" . + "6e697a6174696f6e7d2f6173736574732f7b61737365747d2f7365637572" . + "6974794d61726b73124e6f7267616e697a6174696f6e732f7b6f7267616e" . + "697a6174696f6e7d2f736f75726365732f7b736f757263657d2f66696e64" . + "696e67732f7b66696e64696e677d2f73656375726974794d61726b7342fd" . + "010a29636f6d2e676f6f676c652e636c6f75642e73656375726974796365" . + "6e7465722e76317031626574613150015a53676f6f676c652e676f6c616e" . + "672e6f72672f67656e70726f746f2f676f6f676c65617069732f636c6f75" . + "642f736563757269747963656e7465722f7631703162657461313b736563" . + "757269747963656e746572aa0225476f6f676c652e436c6f75642e536563" . + "757269747943656e7465722e563150314265746131ca0225476f6f676c65" . + "5c436c6f75645c536563757269747943656e7465725c5631703162657461" . + "31ea0228476f6f676c653a3a436c6f75643a3a536563757269747943656e" . + "7465723a3a563170316265746131620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/SecurityCenter/metadata/V1P1Beta1/SecuritycenterService.php b/SecurityCenter/metadata/V1P1Beta1/SecuritycenterService.php new file mode 100644 index 000000000000..919c4c8c4e22 --- /dev/null +++ b/SecurityCenter/metadata/V1P1Beta1/SecuritycenterService.php @@ -0,0 +1,454 @@ +internalAddGeneratedFile(hex2bin( + "0ab4600a42676f6f676c652f636c6f75642f736563757269747963656e74" . + "65722f7631703162657461312f736563757269747963656e7465725f7365" . + "72766963652e70726f746f1225676f6f676c652e636c6f75642e73656375" . + "7269747963656e7465722e7631703162657461311a1c676f6f676c652f61" . + "70692f616e6e6f746174696f6e732e70726f746f1a17676f6f676c652f61" . + "70692f636c69656e742e70726f746f1a1f676f6f676c652f6170692f6669" . + "656c645f6265686176696f722e70726f746f1a19676f6f676c652f617069" . + "2f7265736f757263652e70726f746f1a31676f6f676c652f636c6f75642f" . + "736563757269747963656e7465722f7631703162657461312f6173736574" . + "2e70726f746f1a33676f6f676c652f636c6f75642f736563757269747963" . + "656e7465722f7631703162657461312f66696e64696e672e70726f746f1a" . + "3f676f6f676c652f636c6f75642f736563757269747963656e7465722f76" . + "31703162657461312f6e6f74696669636174696f6e5f636f6e6669672e70" . + "726f746f1a41676f6f676c652f636c6f75642f736563757269747963656e" . + "7465722f7631703162657461312f6f7267616e697a6174696f6e5f736574" . + "74696e67732e70726f746f1a3a676f6f676c652f636c6f75642f73656375" . + "7269747963656e7465722f7631703162657461312f73656375726974795f" . + "6d61726b732e70726f746f1a32676f6f676c652f636c6f75642f73656375" . + "7269747963656e7465722f7631703162657461312f736f757263652e7072" . + "6f746f1a1e676f6f676c652f69616d2f76312f69616d5f706f6c6963792e" . + "70726f746f1a1a676f6f676c652f69616d2f76312f706f6c6963792e7072" . + "6f746f1a23676f6f676c652f6c6f6e6772756e6e696e672f6f7065726174" . + "696f6e732e70726f746f1a1e676f6f676c652f70726f746f6275662f6475" . + "726174696f6e2e70726f746f1a1b676f6f676c652f70726f746f6275662f" . + "656d7074792e70726f746f1a20676f6f676c652f70726f746f6275662f66" . + "69656c645f6d61736b2e70726f746f1a1c676f6f676c652f70726f746f62" . + "75662f7374727563742e70726f746f1a1f676f6f676c652f70726f746f62" . + "75662f74696d657374616d702e70726f746f22b3010a1443726561746546" . + "696e64696e6752657175657374123c0a06706172656e7418012001280942" . + "2ce04102fa41260a24736563757269747963656e7465722e676f6f676c65" . + "617069732e636f6d2f536f7572636512170a0a66696e64696e675f696418" . + "02200128094203e0410212440a0766696e64696e6718032001280b322e2e" . + "676f6f676c652e636c6f75642e736563757269747963656e7465722e7631" . + "703162657461312e46696e64696e674203e0410222e0010a1f4372656174" . + "654e6f74696669636174696f6e436f6e6669675265717565737412480a06" . + "706172656e741801200128094238e04102fa41320a30636c6f7564726573" . + "6f757263656d616e616765722e676f6f676c65617069732e636f6d2f4f72" . + "67616e697a6174696f6e12160a09636f6e6669675f696418022001280942" . + "03e04102125b0a136e6f74696669636174696f6e5f636f6e666967180320" . + "01280b32392e676f6f676c652e636c6f75642e736563757269747963656e" . + "7465722e7631703162657461312e4e6f74696669636174696f6e436f6e66" . + "69674203e0410222a3010a13437265617465536f75726365526571756573" . + "7412480a06706172656e741801200128094238e04102fa41320a30636c6f" . + "75647265736f757263656d616e616765722e676f6f676c65617069732e63" . + "6f6d2f4f7267616e697a6174696f6e12420a06736f757263651802200128" . + "0b322d2e676f6f676c652e636c6f75642e736563757269747963656e7465" . + "722e7631703162657461312e536f757263654203e0410222690a1f44656c" . + "6574654e6f74696669636174696f6e436f6e666967526571756573741246" . + "0a046e616d651801200128094238e04102fa41320a307365637572697479" . + "63656e7465722e676f6f676c65617069732e636f6d2f4e6f746966696361" . + "74696f6e436f6e66696722660a1c4765744e6f74696669636174696f6e43" . + "6f6e6669675265717565737412460a046e616d651801200128094238e041" . + "02fa41320a30736563757269747963656e7465722e676f6f676c65617069" . + "732e636f6d2f4e6f74696669636174696f6e436f6e666967226a0a1e4765" . + "744f7267616e697a6174696f6e53657474696e6773526571756573741248" . + "0a046e616d65180120012809423ae04102fa41340a327365637572697479" . + "63656e7465722e676f6f676c65617069732e636f6d2f4f7267616e697a61" . + "74696f6e53657474696e6773224e0a10476574536f757263655265717565" . + "7374123a0a046e616d65180120012809422ce04102fa41260a2473656375" . + "7269747963656e7465722e676f6f676c65617069732e636f6d2f536f7572" . + "636522a0020a1247726f75704173736574735265717565737412480a0670" . + "6172656e741801200128094238e04102fa41320a30636c6f75647265736f" . + "757263656d616e616765722e676f6f676c65617069732e636f6d2f4f7267" . + "616e697a6174696f6e120e0a0666696c74657218022001280912150a0867" . + "726f75705f62791803200128094203e0410212330a10636f6d706172655f" . + "6475726174696f6e18042001280b32192e676f6f676c652e70726f746f62" . + "75662e4475726174696f6e122d0a09726561645f74696d6518052001280b" . + "321a2e676f6f676c652e70726f746f6275662e54696d657374616d70120e" . + "0a06686176696e6718062001280912120a0a706167655f746f6b656e1807" . + "2001280912110a09706167655f73697a6518082001280522bf010a134772" . + "6f7570417373657473526573706f6e7365124c0a1067726f75705f62795f" . + "726573756c747318012003280b32322e676f6f676c652e636c6f75642e73" . + "6563757269747963656e7465722e7631703162657461312e47726f757052" . + "6573756c74122d0a09726561645f74696d6518022001280b321a2e676f6f" . + "676c652e70726f746f6275662e54696d657374616d7012170a0f6e657874" . + "5f706167655f746f6b656e18032001280912120a0a746f74616c5f73697a" . + "651804200128052296020a1447726f757046696e64696e67735265717565" . + "7374123c0a06706172656e74180120012809422ce04102fa41260a247365" . + "63757269747963656e7465722e676f6f676c65617069732e636f6d2f536f" . + "75726365120e0a0666696c74657218022001280912150a0867726f75705f" . + "62791803200128094203e04102122d0a09726561645f74696d6518042001" . + "280b321a2e676f6f676c652e70726f746f6275662e54696d657374616d70" . + "12330a10636f6d706172655f6475726174696f6e18052001280b32192e67" . + "6f6f676c652e70726f746f6275662e4475726174696f6e120e0a06686176" . + "696e6718062001280912120a0a706167655f746f6b656e18072001280912" . + "110a09706167655f73697a6518082001280522c1010a1547726f75704669" . + "6e64696e6773526573706f6e7365124c0a1067726f75705f62795f726573" . + "756c747318012003280b32322e676f6f676c652e636c6f75642e73656375" . + "7269747963656e7465722e7631703162657461312e47726f757052657375" . + "6c74122d0a09726561645f74696d6518022001280b321a2e676f6f676c65" . + "2e70726f746f6275662e54696d657374616d7012170a0f6e6578745f7061" . + "67655f746f6b656e18032001280912120a0a746f74616c5f73697a651804" . + "2001280522bf010a0b47726f7570526573756c7412560a0a70726f706572" . + "7469657318012003280b32422e676f6f676c652e636c6f75642e73656375" . + "7269747963656e7465722e7631703162657461312e47726f757052657375" . + "6c742e50726f70657274696573456e747279120d0a05636f756e74180220" . + "0128031a490a0f50726f70657274696573456e747279120b0a036b657918" . + "012001280912250a0576616c756518022001280b32162e676f6f676c652e" . + "70726f746f6275662e56616c75653a0238012291010a1e4c6973744e6f74" . + "696669636174696f6e436f6e666967735265717565737412480a06706172" . + "656e741801200128094238e04102fa41320a30636c6f75647265736f7572" . + "63656d616e616765722e676f6f676c65617069732e636f6d2f4f7267616e" . + "697a6174696f6e12120a0a706167655f746f6b656e18022001280912110a" . + "09706167655f73697a651803200128052293010a1f4c6973744e6f746966" . + "69636174696f6e436f6e66696773526573706f6e736512570a146e6f7469" . + "6669636174696f6e5f636f6e6669677318012003280b32392e676f6f676c" . + "652e636c6f75642e736563757269747963656e7465722e76317031626574" . + "61312e4e6f74696669636174696f6e436f6e66696712170a0f6e6578745f" . + "706167655f746f6b656e1802200128092285010a124c697374536f757263" . + "65735265717565737412480a06706172656e741801200128094238e04102" . + "fa41320a30636c6f75647265736f757263656d616e616765722e676f6f67" . + "6c65617069732e636f6d2f4f7267616e697a6174696f6e12120a0a706167" . + "655f746f6b656e18022001280912110a09706167655f73697a6518072001" . + "2805226e0a134c697374536f7572636573526573706f6e7365123e0a0773" . + "6f757263657318012003280b322d2e676f6f676c652e636c6f75642e7365" . + "63757269747963656e7465722e7631703162657461312e536f7572636512" . + "170a0f6e6578745f706167655f746f6b656e18022001280922cf020a114c" . + "6973744173736574735265717565737412480a06706172656e7418012001" . + "28094238e04102fa41320a30636c6f75647265736f757263656d616e6167" . + "65722e676f6f676c65617069732e636f6d2f4f7267616e697a6174696f6e" . + "120e0a0666696c74657218022001280912100a086f726465725f62791803" . + "20012809122d0a09726561645f74696d6518042001280b321a2e676f6f67" . + "6c652e70726f746f6275662e54696d657374616d7012330a10636f6d7061" . + "72655f6475726174696f6e18052001280b32192e676f6f676c652e70726f" . + "746f6275662e4475726174696f6e120e0a06686176696e67180620012809" . + "12330a0a6669656c645f6d61736b18072001280b321a2e676f6f676c652e" . + "70726f746f6275662e4669656c644d61736b4203e0410112120a0a706167" . + "655f746f6b656e18082001280912110a09706167655f73697a6518092001" . + "280522d8030a124c697374417373657473526573706f6e736512670a136c" . + "6973745f6173736574735f726573756c747318012003280b324a2e676f6f" . + "676c652e636c6f75642e736563757269747963656e7465722e7631703162" . + "657461312e4c697374417373657473526573706f6e73652e4c6973744173" . + "73657473526573756c74122d0a09726561645f74696d6518022001280b32" . + "1a2e676f6f676c652e70726f746f6275662e54696d657374616d7012170a" . + "0f6e6578745f706167655f746f6b656e18032001280912120a0a746f7461" . + "6c5f73697a651804200128051afc010a104c697374417373657473526573" . + "756c74123b0a05617373657418012001280b322c2e676f6f676c652e636c" . + "6f75642e736563757269747963656e7465722e7631703162657461312e41" . + "73736574126c0a0c73746174655f6368616e676518022001280e32562e67" . + "6f6f676c652e636c6f75642e736563757269747963656e7465722e763170" . + "3162657461312e4c697374417373657473526573706f6e73652e4c697374" . + "417373657473526573756c742e53746174654368616e6765223d0a0b5374" . + "6174654368616e6765120a0a06554e55534544100012090a054144444544" . + "1001120b0a0752454d4f5645441002120a0a06414354495645100322c502" . + "0a134c69737446696e64696e677352657175657374123c0a06706172656e" . + "74180120012809422ce04102fa41260a24736563757269747963656e7465" . + "722e676f6f676c65617069732e636f6d2f536f75726365120e0a0666696c" . + "74657218022001280912100a086f726465725f6279180320012809122d0a" . + "09726561645f74696d6518042001280b321a2e676f6f676c652e70726f74" . + "6f6275662e54696d657374616d7012330a10636f6d706172655f64757261" . + "74696f6e18052001280b32192e676f6f676c652e70726f746f6275662e44" . + "75726174696f6e120e0a06686176696e6718062001280912330a0a666965" . + "6c645f6d61736b18072001280b321a2e676f6f676c652e70726f746f6275" . + "662e4669656c644d61736b4203e0410112120a0a706167655f746f6b656e" . + "18082001280912110a09706167655f73697a6518092001280522e5050a14" . + "4c69737446696e64696e6773526573706f6e7365126d0a156c6973745f66" . + "696e64696e67735f726573756c747318012003280b324e2e676f6f676c65" . + "2e636c6f75642e736563757269747963656e7465722e7631703162657461" . + "312e4c69737446696e64696e6773526573706f6e73652e4c69737446696e" . + "64696e6773526573756c74122d0a09726561645f74696d6518022001280b" . + "321a2e676f6f676c652e70726f746f6275662e54696d657374616d701217" . + "0a0f6e6578745f706167655f746f6b656e18032001280912120a0a746f74" . + "616c5f73697a651804200128051a81040a124c69737446696e64696e6773" . + "526573756c74123f0a0766696e64696e6718012001280b322e2e676f6f67" . + "6c652e636c6f75642e736563757269747963656e7465722e763170316265" . + "7461312e46696e64696e6712700a0c73746174655f6368616e6765180220" . + "01280e325a2e676f6f676c652e636c6f75642e736563757269747963656e" . + "7465722e7631703162657461312e4c69737446696e64696e677352657370" . + "6f6e73652e4c69737446696e64696e6773526573756c742e537461746543" . + "68616e676512690a087265736f7572636518032001280b32572e676f6f67" . + "6c652e636c6f75642e736563757269747963656e7465722e763170316265" . + "7461312e4c69737446696e64696e6773526573706f6e73652e4c69737446" . + "696e64696e6773526573756c742e5265736f757263651a7e0a085265736f" . + "75726365120c0a046e616d6518012001280912140a0c70726f6a6563745f" . + "6e616d65180220012809121c0a1470726f6a6563745f646973706c61795f" . + "6e616d6518032001280912130a0b706172656e745f6e616d651804200128" . + "09121b0a13706172656e745f646973706c61795f6e616d65180520012809" . + "224d0a0b53746174654368616e6765120a0a06554e555345441000120b0a" . + "074348414e4745441001120d0a09554e4348414e474544100212090a0541" . + "444445441003120b0a0752454d4f564544100422d4010a1653657446696e" . + "64696e67537461746552657175657374123b0a046e616d65180120012809" . + "422de04102fa41270a25736563757269747963656e7465722e676f6f676c" . + "65617069732e636f6d2f46696e64696e6712480a05737461746518022001" . + "280e32342e676f6f676c652e636c6f75642e736563757269747963656e74" . + "65722e7631703162657461312e46696e64696e672e53746174654203e041" . + "0212330a0a73746172745f74696d6518032001280b321a2e676f6f676c65" . + "2e70726f746f6275662e54696d657374616d704203e0410222640a185275" . + "6e4173736574446973636f766572795265717565737412480a0670617265" . + "6e741801200128094238e04102fa41320a30636c6f75647265736f757263" . + "656d616e616765722e676f6f676c65617069732e636f6d2f4f7267616e69" . + "7a6174696f6e228d010a1455706461746546696e64696e67526571756573" . + "7412440a0766696e64696e6718012001280b322e2e676f6f676c652e636c" . + "6f75642e736563757269747963656e7465722e7631703162657461312e46" . + "696e64696e674203e04102122f0a0b7570646174655f6d61736b18022001" . + "280b321a2e676f6f676c652e70726f746f6275662e4669656c644d61736b" . + "22af010a1f5570646174654e6f74696669636174696f6e436f6e66696752" . + "657175657374125b0a136e6f74696669636174696f6e5f636f6e66696718" . + "012001280b32392e676f6f676c652e636c6f75642e736563757269747963" . + "656e7465722e7631703162657461312e4e6f74696669636174696f6e436f" . + "6e6669674203e04102122f0a0b7570646174655f6d61736b18022001280b" . + "321a2e676f6f676c652e70726f746f6275662e4669656c644d61736b22b5" . + "010a215570646174654f7267616e697a6174696f6e53657474696e677352" . + "657175657374125f0a156f7267616e697a6174696f6e5f73657474696e67" . + "7318012001280b323b2e676f6f676c652e636c6f75642e73656375726974" . + "7963656e7465722e7631703162657461312e4f7267616e697a6174696f6e" . + "53657474696e67734203e04102122f0a0b7570646174655f6d61736b1802" . + "2001280b321a2e676f6f676c652e70726f746f6275662e4669656c644d61" . + "736b228a010a13557064617465536f757263655265717565737412420a06" . + "736f7572636518012001280b322d2e676f6f676c652e636c6f75642e7365" . + "63757269747963656e7465722e7631703162657461312e536f7572636542" . + "03e04102122f0a0b7570646174655f6d61736b18022001280b321a2e676f" . + "6f676c652e70726f746f6275662e4669656c644d61736b22d0010a1a5570" . + "6461746553656375726974794d61726b735265717565737412510a0e7365" . + "6375726974795f6d61726b7318012001280b32342e676f6f676c652e636c" . + "6f75642e736563757269747963656e7465722e7631703162657461312e53" . + "656375726974794d61726b734203e04102122f0a0b7570646174655f6d61" . + "736b18022001280b321a2e676f6f676c652e70726f746f6275662e466965" . + "6c644d61736b122e0a0a73746172745f74696d6518032001280b321a2e67" . + "6f6f676c652e70726f746f6275662e54696d657374616d7032862b0a0e53" . + "6563757269747943656e74657212c6010a0c437265617465536f75726365" . + "123a2e676f6f676c652e636c6f75642e736563757269747963656e746572" . + "2e7631703162657461312e437265617465536f7572636552657175657374" . + "1a2d2e676f6f676c652e636c6f75642e736563757269747963656e746572" . + "2e7631703162657461312e536f75726365224b82d3e4930235222b2f7631" . + "703162657461312f7b706172656e743d6f7267616e697a6174696f6e732f" . + "2a7d2f736f75726365733a06736f75726365da410d706172656e742c736f" . + "7572636512fd010a0d43726561746546696e64696e67123b2e676f6f676c" . + "652e636c6f75642e736563757269747963656e7465722e76317031626574" . + "61312e43726561746546696e64696e67526571756573741a2e2e676f6f67" . + "6c652e636c6f75642e736563757269747963656e7465722e763170316265" . + "7461312e46696e64696e67227f82d3e493024122362f7631703162657461" . + "312f7b706172656e743d6f7267616e697a6174696f6e732f2a2f736f7572" . + "6365732f2a7d2f66696e64696e67733a0766696e64696e67da4119706172" . + "656e742c66696e64696e675f69642c66696e64696e67da4119706172656e" . + "742c66696e64696e672c66696e64696e675f696412b8020a184372656174" . + "654e6f74696669636174696f6e436f6e66696712462e676f6f676c652e63" . + "6c6f75642e736563757269747963656e7465722e7631703162657461312e" . + "4372656174654e6f74696669636174696f6e436f6e666967526571756573" . + "741a392e676f6f676c652e636c6f75642e736563757269747963656e7465" . + "722e7631703162657461312e4e6f74696669636174696f6e436f6e666967" . + "22980182d3e493024e22372f7631703162657461312f7b706172656e743d" . + "6f7267616e697a6174696f6e732f2a7d2f6e6f74696669636174696f6e43" . + "6f6e666967733a136e6f74696669636174696f6e5f636f6e666967da4124" . + "706172656e742c636f6e6669675f69642c6e6f74696669636174696f6e5f" . + "636f6e666967da411a706172656e742c6e6f74696669636174696f6e5f63" . + "6f6e66696712c2010a1844656c6574654e6f74696669636174696f6e436f" . + "6e66696712462e676f6f676c652e636c6f75642e73656375726974796365" . + "6e7465722e7631703162657461312e44656c6574654e6f74696669636174" . + "696f6e436f6e666967526571756573741a162e676f6f676c652e70726f74" . + "6f6275662e456d707479224682d3e49302392a372f763170316265746131" . + "2f7b6e616d653d6f7267616e697a6174696f6e732f2a2f6e6f7469666963" . + "6174696f6e436f6e666967732f2a7dda41046e616d65129d010a0c476574" . + "49616d506f6c69637912222e676f6f676c652e69616d2e76312e47657449" . + "616d506f6c696379526571756573741a152e676f6f676c652e69616d2e76" . + "312e506f6c696379225282d3e4930241223c2f7631703162657461312f7b" . + "7265736f757263653d6f7267616e697a6174696f6e732f2a2f736f757263" . + "65732f2a7d3a67657449616d506f6c6963793a012ada41087265736f7572" . + "636512df010a154765744e6f74696669636174696f6e436f6e6669671243" . + "2e676f6f676c652e636c6f75642e736563757269747963656e7465722e76" . + "31703162657461312e4765744e6f74696669636174696f6e436f6e666967" . + "526571756573741a392e676f6f676c652e636c6f75642e73656375726974" . + "7963656e7465722e7631703162657461312e4e6f74696669636174696f6e" . + "436f6e666967224682d3e493023912372f7631703162657461312f7b6e61" . + "6d653d6f7267616e697a6174696f6e732f2a2f6e6f74696669636174696f" . + "6e436f6e666967732f2a7dda41046e616d6512e4010a174765744f726761" . + "6e697a6174696f6e53657474696e677312452e676f6f676c652e636c6f75" . + "642e736563757269747963656e7465722e7631703162657461312e476574" . + "4f7267616e697a6174696f6e53657474696e6773526571756573741a3b2e" . + "676f6f676c652e636c6f75642e736563757269747963656e7465722e7631" . + "703162657461312e4f7267616e697a6174696f6e53657474696e67732245" . + "82d3e493023812362f7631703162657461312f7b6e616d653d6f7267616e" . + "697a6174696f6e732f2a2f6f7267616e697a6174696f6e53657474696e67" . + "737dda41046e616d6512af010a09476574536f7572636512372e676f6f67" . + "6c652e636c6f75642e736563757269747963656e7465722e763170316265" . + "7461312e476574536f75726365526571756573741a2d2e676f6f676c652e" . + "636c6f75642e736563757269747963656e7465722e763170316265746131" . + "2e536f75726365223a82d3e493022d122b2f7631703162657461312f7b6e" . + "616d653d6f7267616e697a6174696f6e732f2a2f736f75726365732f2a7d" . + "da41046e616d6512c1010a0b47726f757041737365747312392e676f6f67" . + "6c652e636c6f75642e736563757269747963656e7465722e763170316265" . + "7461312e47726f7570417373657473526571756573741a3a2e676f6f676c" . + "652e636c6f75642e736563757269747963656e7465722e76317031626574" . + "61312e47726f7570417373657473526573706f6e7365223b82d3e4930235" . + "22302f7631703162657461312f7b706172656e743d6f7267616e697a6174" . + "696f6e732f2a7d2f6173736574733a67726f75703a012a12e5010a0d4772" . + "6f757046696e64696e6773123b2e676f6f676c652e636c6f75642e736563" . + "757269747963656e7465722e7631703162657461312e47726f757046696e" . + "64696e6773526571756573741a3c2e676f6f676c652e636c6f75642e7365" . + "63757269747963656e7465722e7631703162657461312e47726f75704669" . + "6e64696e6773526573706f6e7365225982d3e4930241223c2f7631703162" . + "657461312f7b706172656e743d6f7267616e697a6174696f6e732f2a2f73" . + "6f75726365732f2a7d2f66696e64696e67733a67726f75703a012ada410f" . + "706172656e742c67726f75705f627912be010a0a4c697374417373657473" . + "12382e676f6f676c652e636c6f75642e736563757269747963656e746572" . + "2e7631703162657461312e4c697374417373657473526571756573741a39" . + "2e676f6f676c652e636c6f75642e736563757269747963656e7465722e76" . + "31703162657461312e4c697374417373657473526573706f6e7365223b82" . + "d3e493022c122a2f7631703162657461312f7b706172656e743d6f726761" . + "6e697a6174696f6e732f2a7d2f617373657473da4106706172656e7412d0" . + "010a0c4c69737446696e64696e6773123a2e676f6f676c652e636c6f7564" . + "2e736563757269747963656e7465722e7631703162657461312e4c697374" . + "46696e64696e6773526571756573741a3b2e676f6f676c652e636c6f7564" . + "2e736563757269747963656e7465722e7631703162657461312e4c697374" . + "46696e64696e6773526573706f6e7365224782d3e493023812362f763170" . + "3162657461312f7b706172656e743d6f7267616e697a6174696f6e732f2a" . + "2f736f75726365732f2a7d2f66696e64696e6773da4106706172656e7412" . + "f2010a174c6973744e6f74696669636174696f6e436f6e6669677312452e" . + "676f6f676c652e636c6f75642e736563757269747963656e7465722e7631" . + "703162657461312e4c6973744e6f74696669636174696f6e436f6e666967" . + "73526571756573741a462e676f6f676c652e636c6f75642e736563757269" . + "747963656e7465722e7631703162657461312e4c6973744e6f7469666963" . + "6174696f6e436f6e66696773526573706f6e7365224882d3e49302391237" . + "2f7631703162657461312f7b706172656e743d6f7267616e697a6174696f" . + "6e732f2a7d2f6e6f74696669636174696f6e436f6e66696773da41067061" . + "72656e7412c2010a0b4c697374536f757263657312392e676f6f676c652e" . + "636c6f75642e736563757269747963656e7465722e763170316265746131" . + "2e4c697374536f7572636573526571756573741a3a2e676f6f676c652e63" . + "6c6f75642e736563757269747963656e7465722e7631703162657461312e" . + "4c697374536f7572636573526573706f6e7365223c82d3e493022d122b2f" . + "7631703162657461312f7b706172656e743d6f7267616e697a6174696f6e" . + "732f2a7d2f736f7572636573da4106706172656e74129c020a1152756e41" . + "73736574446973636f76657279123f2e676f6f676c652e636c6f75642e73" . + "6563757269747963656e7465722e7631703162657461312e52756e417373" . + "6574446973636f76657279526571756573741a1d2e676f6f676c652e6c6f" . + "6e6772756e6e696e672e4f7065726174696f6e22a60182d3e493023c2237" . + "2f7631703162657461312f7b706172656e743d6f7267616e697a6174696f" . + "6e732f2a7d2f6173736574733a72756e446973636f766572793a012ada41" . + "06706172656e74ca41580a3f676f6f676c652e636c6f75642e7365637572" . + "69747963656e7465722e7631703162657461312e52756e41737365744469" . + "73636f76657279526573706f6e73651215676f6f676c652e70726f746f62" . + "75662e456d70747912e4010a0f53657446696e64696e675374617465123d" . + "2e676f6f676c652e636c6f75642e736563757269747963656e7465722e76" . + "31703162657461312e53657446696e64696e675374617465526571756573" . + "741a2e2e676f6f676c652e636c6f75642e736563757269747963656e7465" . + "722e7631703162657461312e46696e64696e67226282d3e4930244223f2f" . + "7631703162657461312f7b6e616d653d6f7267616e697a6174696f6e732f" . + "2a2f736f75726365732f2a2f66696e64696e67732f2a7d3a736574537461" . + "74653a012ada41156e616d652c73746174652c73746172745f74696d6512" . + "a4010a0c53657449616d506f6c69637912222e676f6f676c652e69616d2e" . + "76312e53657449616d506f6c696379526571756573741a152e676f6f676c" . + "652e69616d2e76312e506f6c696379225982d3e4930241223c2f76317031" . + "62657461312f7b7265736f757263653d6f7267616e697a6174696f6e732f" . + "2a2f736f75726365732f2a7d3a73657449616d506f6c6963793a012ada41" . + "0f7265736f757263652c706f6c69637912cf010a125465737449616d5065" . + "726d697373696f6e7312282e676f6f676c652e69616d2e76312e54657374" . + "49616d5065726d697373696f6e73526571756573741a292e676f6f676c65" . + "2e69616d2e76312e5465737449616d5065726d697373696f6e7352657370" . + "6f6e7365226482d3e493024722422f7631703162657461312f7b7265736f" . + "757263653d6f7267616e697a6174696f6e732f2a2f736f75726365732f2a" . + "7d3a7465737449616d5065726d697373696f6e733a012ada41147265736f" . + "757263652c7065726d697373696f6e7312ed010a0d55706461746546696e" . + "64696e67123b2e676f6f676c652e636c6f75642e73656375726974796365" . + "6e7465722e7631703162657461312e55706461746546696e64696e675265" . + "71756573741a2e2e676f6f676c652e636c6f75642e736563757269747963" . + "656e7465722e7631703162657461312e46696e64696e67226f82d3e49302" . + "49323e2f7631703162657461312f7b66696e64696e672e6e616d653d6f72" . + "67616e697a6174696f6e732f2a2f736f75726365732f2a2f66696e64696e" . + "67732f2a7d3a0766696e64696e67da410766696e64696e67da411366696e" . + "64696e672c7570646174655f6d61736b12c0020a185570646174654e6f74" . + "696669636174696f6e436f6e66696712462e676f6f676c652e636c6f7564" . + "2e736563757269747963656e7465722e7631703162657461312e55706461" . + "74654e6f74696669636174696f6e436f6e666967526571756573741a392e" . + "676f6f676c652e636c6f75642e736563757269747963656e7465722e7631" . + "703162657461312e4e6f74696669636174696f6e436f6e66696722a00182" . + "d3e4930262324b2f7631703162657461312f7b6e6f74696669636174696f" . + "6e5f636f6e6669672e6e616d653d6f7267616e697a6174696f6e732f2a2f" . + "6e6f74696669636174696f6e436f6e666967732f2a7d3a136e6f74696669" . + "636174696f6e5f636f6e666967da41136e6f74696669636174696f6e5f63" . + "6f6e666967da411f6e6f74696669636174696f6e5f636f6e6669672c7570" . + "646174655f6d61736b12a9020a1a5570646174654f7267616e697a617469" . + "6f6e53657474696e677312482e676f6f676c652e636c6f75642e73656375" . + "7269747963656e7465722e7631703162657461312e5570646174654f7267" . + "616e697a6174696f6e53657474696e6773526571756573741a3b2e676f6f" . + "676c652e636c6f75642e736563757269747963656e7465722e7631703162" . + "657461312e4f7267616e697a6174696f6e53657474696e677322830182d3" . + "e4930265324c2f7631703162657461312f7b6f7267616e697a6174696f6e" . + "5f73657474696e67732e6e616d653d6f7267616e697a6174696f6e732f2a" . + "2f6f7267616e697a6174696f6e53657474696e67737d3a156f7267616e69" . + "7a6174696f6e5f73657474696e6773da41156f7267616e697a6174696f6e" . + "5f73657474696e677312db010a0c557064617465536f75726365123a2e67" . + "6f6f676c652e636c6f75642e736563757269747963656e7465722e763170" . + "3162657461312e557064617465536f75726365526571756573741a2d2e67" . + "6f6f676c652e636c6f75642e736563757269747963656e7465722e763170" . + "3162657461312e536f75726365226082d3e493023c32322f763170316265" . + "7461312f7b736f757263652e6e616d653d6f7267616e697a6174696f6e73" . + "2f2a2f736f75726365732f2a7d3a06736f75726365da4106736f75726365" . + "da4112736f757263652c7570646174655f6d61736b1286030a1355706461" . + "746553656375726974794d61726b7312412e676f6f676c652e636c6f7564" . + "2e736563757269747963656e7465722e7631703162657461312e55706461" . + "746553656375726974794d61726b73526571756573741a342e676f6f676c" . + "652e636c6f75642e736563757269747963656e7465722e76317031626574" . + "61312e53656375726974794d61726b7322f50182d3e49302c00132472f76" . + "31703162657461312f7b73656375726974795f6d61726b732e6e616d653d" . + "6f7267616e697a6174696f6e732f2a2f6173736574732f2a2f7365637572" . + "6974794d61726b737d3a0e73656375726974795f6d61726b735a6532532f" . + "7631703162657461312f7b73656375726974795f6d61726b732e6e616d65" . + "3d6f7267616e697a6174696f6e732f2a2f736f75726365732f2a2f66696e" . + "64696e67732f2a2f73656375726974794d61726b737d3a0e736563757269" . + "74795f6d61726b73da410e73656375726974795f6d61726b73da411a7365" . + "6375726974795f6d61726b732c7570646174655f6d61736b1a51ca411d73" . + "6563757269747963656e7465722e676f6f676c65617069732e636f6dd241" . + "2e68747470733a2f2f7777772e676f6f676c65617069732e636f6d2f6175" . + "74682f636c6f75642d706c6174666f726d42fd010a29636f6d2e676f6f67" . + "6c652e636c6f75642e736563757269747963656e7465722e763170316265" . + "74613150015a53676f6f676c652e676f6c616e672e6f72672f67656e7072" . + "6f746f2f676f6f676c65617069732f636c6f75642f736563757269747963" . + "656e7465722f7631703162657461313b736563757269747963656e746572" . + "aa0225476f6f676c652e436c6f75642e536563757269747943656e746572" . + "2e563150314265746131ca0225476f6f676c655c436c6f75645c53656375" . + "7269747943656e7465725c563170316265746131ea0228476f6f676c653a" . + "3a436c6f75643a3a536563757269747943656e7465723a3a563170316265" . + "7461315000620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/SecurityCenter/metadata/V1P1Beta1/Source.php b/SecurityCenter/metadata/V1P1Beta1/Source.php new file mode 100644 index 000000000000..0f8f942917d3 --- /dev/null +++ b/SecurityCenter/metadata/V1P1Beta1/Source.php @@ -0,0 +1,44 @@ +internalAddGeneratedFile(hex2bin( + "0a9c040a32676f6f676c652f636c6f75642f736563757269747963656e74" . + "65722f7631703162657461312f736f757263652e70726f746f1225676f6f" . + "676c652e636c6f75642e736563757269747963656e7465722e7631703162" . + "657461311a19676f6f676c652f6170692f7265736f757263652e70726f74" . + "6f229b010a06536f75726365120c0a046e616d6518012001280912140a0c" . + "646973706c61795f6e616d6518022001280912130a0b6465736372697074" . + "696f6e1803200128093a58ea41550a24736563757269747963656e746572" . + "2e676f6f676c65617069732e636f6d2f536f75726365122d6f7267616e69" . + "7a6174696f6e732f7b6f7267616e697a6174696f6e7d2f736f7572636573" . + "2f7b736f757263657d42fd010a29636f6d2e676f6f676c652e636c6f7564" . + "2e736563757269747963656e7465722e76317031626574613150015a5367" . + "6f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f67" . + "6c65617069732f636c6f75642f736563757269747963656e7465722f7631" . + "703162657461313b736563757269747963656e746572aa0225476f6f676c" . + "652e436c6f75642e536563757269747943656e7465722e56315031426574" . + "6131ca0225476f6f676c655c436c6f75645c536563757269747943656e74" . + "65725c563170316265746131ea0228476f6f676c653a3a436c6f75643a3a" . + "536563757269747943656e7465723a3a563170316265746131620670726f" . + "746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/SecurityCenter/src/V1p1beta1/Asset.php b/SecurityCenter/src/V1p1beta1/Asset.php new file mode 100644 index 000000000000..b536a31e6629 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/Asset.php @@ -0,0 +1,311 @@ +google.cloud.securitycenter.v1p1beta1.Asset + */ +class Asset extends \Google\Protobuf\Internal\Message +{ + /** + * 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}". + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * Cloud SCC managed properties. These properties are managed by + * Cloud SCC and cannot be modified by the user. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Asset.SecurityCenterProperties security_center_properties = 2; + */ + private $security_center_properties = null; + /** + * Resource managed properties. These properties are managed and defined by + * the GCP resource and cannot be modified by the user. + * + * Generated from protobuf field map resource_properties = 7; + */ + private $resource_properties; + /** + * User specified security marks. These marks are entirely managed by the user + * and come from the SecurityMarks resource that belongs to the asset. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.SecurityMarks security_marks = 8; + */ + private $security_marks = null; + /** + * The time at which the asset was created in Cloud SCC. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 9; + */ + private $create_time = null; + /** + * The time at which the asset was last updated, added, or deleted in Cloud + * SCC. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 10; + */ + private $update_time = null; + /** + * IAM Policy information associated with the GCP resource described by the + * Cloud SCC asset. This information is managed and defined by the GCP + * resource and cannot be modified by the user. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Asset.IamPolicy iam_policy = 11; + */ + private $iam_policy = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * 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}". + * @type \Google\Cloud\SecurityCenter\V1p1beta1\Asset\SecurityCenterProperties $security_center_properties + * Cloud SCC managed properties. These properties are managed by + * Cloud SCC and cannot be modified by the user. + * @type array|\Google\Protobuf\Internal\MapField $resource_properties + * Resource managed properties. These properties are managed and defined by + * the GCP resource and cannot be modified by the user. + * @type \Google\Cloud\SecurityCenter\V1p1beta1\SecurityMarks $security_marks + * User specified security marks. These marks are entirely managed by the user + * and come from the SecurityMarks resource that belongs to the asset. + * @type \Google\Protobuf\Timestamp $create_time + * The time at which the asset was created in Cloud SCC. + * @type \Google\Protobuf\Timestamp $update_time + * The time at which the asset was last updated, added, or deleted in Cloud + * SCC. + * @type \Google\Cloud\SecurityCenter\V1p1beta1\Asset\IamPolicy $iam_policy + * IAM Policy information associated with the GCP resource described by the + * Cloud SCC asset. This information is managed and defined by the GCP + * resource and cannot be modified by the user. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\Asset::initOnce(); + parent::__construct($data); + } + + /** + * 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}". + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * 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}". + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Cloud SCC managed properties. These properties are managed by + * Cloud SCC and cannot be modified by the user. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Asset.SecurityCenterProperties security_center_properties = 2; + * @return \Google\Cloud\SecurityCenter\V1p1beta1\Asset\SecurityCenterProperties + */ + public function getSecurityCenterProperties() + { + return $this->security_center_properties; + } + + /** + * Cloud SCC managed properties. These properties are managed by + * Cloud SCC and cannot be modified by the user. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Asset.SecurityCenterProperties security_center_properties = 2; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\Asset\SecurityCenterProperties $var + * @return $this + */ + public function setSecurityCenterProperties($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\Asset_SecurityCenterProperties::class); + $this->security_center_properties = $var; + + return $this; + } + + /** + * Resource managed properties. These properties are managed and defined by + * the GCP resource and cannot be modified by the user. + * + * Generated from protobuf field map resource_properties = 7; + * @return \Google\Protobuf\Internal\MapField + */ + public function getResourceProperties() + { + return $this->resource_properties; + } + + /** + * Resource managed properties. These properties are managed and defined by + * the GCP resource and cannot be modified by the user. + * + * Generated from protobuf field map resource_properties = 7; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setResourceProperties($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Value::class); + $this->resource_properties = $arr; + + return $this; + } + + /** + * User specified security marks. These marks are entirely managed by the user + * and come from the SecurityMarks resource that belongs to the asset. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.SecurityMarks security_marks = 8; + * @return \Google\Cloud\SecurityCenter\V1p1beta1\SecurityMarks + */ + public function getSecurityMarks() + { + return $this->security_marks; + } + + /** + * User specified security marks. These marks are entirely managed by the user + * and come from the SecurityMarks resource that belongs to the asset. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.SecurityMarks security_marks = 8; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\SecurityMarks $var + * @return $this + */ + public function setSecurityMarks($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\SecurityMarks::class); + $this->security_marks = $var; + + return $this; + } + + /** + * The time at which the asset was created in Cloud SCC. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 9; + * @return \Google\Protobuf\Timestamp + */ + public function getCreateTime() + { + return $this->create_time; + } + + /** + * The time at which the asset was created in Cloud SCC. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 9; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The time at which the asset was last updated, added, or deleted in Cloud + * SCC. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 10; + * @return \Google\Protobuf\Timestamp + */ + public function getUpdateTime() + { + return $this->update_time; + } + + /** + * The time at which the asset was last updated, added, or deleted in Cloud + * SCC. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 10; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * IAM Policy information associated with the GCP resource described by the + * Cloud SCC asset. This information is managed and defined by the GCP + * resource and cannot be modified by the user. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Asset.IamPolicy iam_policy = 11; + * @return \Google\Cloud\SecurityCenter\V1p1beta1\Asset\IamPolicy + */ + public function getIamPolicy() + { + return $this->iam_policy; + } + + /** + * IAM Policy information associated with the GCP resource described by the + * Cloud SCC asset. This information is managed and defined by the GCP + * resource and cannot be modified by the user. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Asset.IamPolicy iam_policy = 11; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\Asset\IamPolicy $var + * @return $this + */ + public function setIamPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\Asset_IamPolicy::class); + $this->iam_policy = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/Asset/IamPolicy.php b/SecurityCenter/src/V1p1beta1/Asset/IamPolicy.php new file mode 100644 index 000000000000..d6d4859f0745 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/Asset/IamPolicy.php @@ -0,0 +1,80 @@ +google.cloud.securitycenter.v1p1beta1.Asset.IamPolicy + */ +class IamPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * The JSON representation of the Policy associated with the asset. + * See https://cloud.google.com/iam/reference/rest/v1p1beta1/Policy for + * format details. + * + * Generated from protobuf field string policy_blob = 1; + */ + private $policy_blob = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $policy_blob + * The JSON representation of the Policy associated with the asset. + * See https://cloud.google.com/iam/reference/rest/v1p1beta1/Policy for + * format details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\Asset::initOnce(); + parent::__construct($data); + } + + /** + * The JSON representation of the Policy associated with the asset. + * See https://cloud.google.com/iam/reference/rest/v1p1beta1/Policy for + * format details. + * + * Generated from protobuf field string policy_blob = 1; + * @return string + */ + public function getPolicyBlob() + { + return $this->policy_blob; + } + + /** + * The JSON representation of the Policy associated with the asset. + * See https://cloud.google.com/iam/reference/rest/v1p1beta1/Policy for + * format details. + * + * Generated from protobuf field string policy_blob = 1; + * @param string $var + * @return $this + */ + public function setPolicyBlob($var) + { + GPBUtil::checkString($var, True); + $this->policy_blob = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(IamPolicy::class, \Google\Cloud\SecurityCenter\V1p1beta1\Asset_IamPolicy::class); + diff --git a/SecurityCenter/src/V1p1beta1/Asset/SecurityCenterProperties.php b/SecurityCenter/src/V1p1beta1/Asset/SecurityCenterProperties.php new file mode 100644 index 000000000000..6f80d54b9422 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/Asset/SecurityCenterProperties.php @@ -0,0 +1,337 @@ +google.cloud.securitycenter.v1p1beta1.Asset.SecurityCenterProperties + */ +class SecurityCenterProperties extends \Google\Protobuf\Internal\Message +{ + /** + * The full resource name of the GCP resource this asset + * represents. This field is immutable after create time. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * + * Generated from protobuf field string resource_name = 1; + */ + private $resource_name = ''; + /** + * The type of the GCP resource. Examples include: APPLICATION, + * PROJECT, and ORGANIZATION. This is a case insensitive field defined by + * Cloud SCC and/or the producer of the resource and is immutable + * after create time. + * + * Generated from protobuf field string resource_type = 2; + */ + private $resource_type = ''; + /** + * The full resource name of the immediate parent of the resource. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * + * Generated from protobuf field string resource_parent = 3; + */ + private $resource_parent = ''; + /** + * The full resource name of the project the resource belongs to. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * + * Generated from protobuf field string resource_project = 4; + */ + private $resource_project = ''; + /** + * Owners of the Google Cloud resource. + * + * Generated from protobuf field repeated string resource_owners = 5; + */ + private $resource_owners; + /** + * The user defined display name for this resource. + * + * Generated from protobuf field string resource_display_name = 6; + */ + private $resource_display_name = ''; + /** + * The user defined display name for the parent of this resource. + * + * Generated from protobuf field string resource_parent_display_name = 7; + */ + private $resource_parent_display_name = ''; + /** + * The user defined display name for the project of this resource. + * + * Generated from protobuf field string resource_project_display_name = 8; + */ + private $resource_project_display_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $resource_name + * The full resource name of the GCP resource this asset + * represents. This field is immutable after create time. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * @type string $resource_type + * The type of the GCP resource. Examples include: APPLICATION, + * PROJECT, and ORGANIZATION. This is a case insensitive field defined by + * Cloud SCC and/or the producer of the resource and is immutable + * after create time. + * @type string $resource_parent + * The full resource name of the immediate parent of the resource. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * @type string $resource_project + * The full resource name of the project the resource belongs to. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * @type string[]|\Google\Protobuf\Internal\RepeatedField $resource_owners + * Owners of the Google Cloud resource. + * @type string $resource_display_name + * The user defined display name for this resource. + * @type string $resource_parent_display_name + * The user defined display name for the parent of this resource. + * @type string $resource_project_display_name + * The user defined display name for the project of this resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\Asset::initOnce(); + parent::__construct($data); + } + + /** + * The full resource name of the GCP resource this asset + * represents. This field is immutable after create time. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * + * Generated from protobuf field string resource_name = 1; + * @return string + */ + public function getResourceName() + { + return $this->resource_name; + } + + /** + * The full resource name of the GCP resource this asset + * represents. This field is immutable after create time. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * + * Generated from protobuf field string resource_name = 1; + * @param string $var + * @return $this + */ + public function setResourceName($var) + { + GPBUtil::checkString($var, True); + $this->resource_name = $var; + + return $this; + } + + /** + * The type of the GCP resource. Examples include: APPLICATION, + * PROJECT, and ORGANIZATION. This is a case insensitive field defined by + * Cloud SCC and/or the producer of the resource and is immutable + * after create time. + * + * Generated from protobuf field string resource_type = 2; + * @return string + */ + public function getResourceType() + { + return $this->resource_type; + } + + /** + * The type of the GCP resource. Examples include: APPLICATION, + * PROJECT, and ORGANIZATION. This is a case insensitive field defined by + * Cloud SCC and/or the producer of the resource and is immutable + * after create time. + * + * Generated from protobuf field string resource_type = 2; + * @param string $var + * @return $this + */ + public function setResourceType($var) + { + GPBUtil::checkString($var, True); + $this->resource_type = $var; + + return $this; + } + + /** + * The full resource name of the immediate parent of the resource. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * + * Generated from protobuf field string resource_parent = 3; + * @return string + */ + public function getResourceParent() + { + return $this->resource_parent; + } + + /** + * The full resource name of the immediate parent of the resource. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * + * Generated from protobuf field string resource_parent = 3; + * @param string $var + * @return $this + */ + public function setResourceParent($var) + { + GPBUtil::checkString($var, True); + $this->resource_parent = $var; + + return $this; + } + + /** + * The full resource name of the project the resource belongs to. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * + * Generated from protobuf field string resource_project = 4; + * @return string + */ + public function getResourceProject() + { + return $this->resource_project; + } + + /** + * The full resource name of the project the resource belongs to. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * + * Generated from protobuf field string resource_project = 4; + * @param string $var + * @return $this + */ + public function setResourceProject($var) + { + GPBUtil::checkString($var, True); + $this->resource_project = $var; + + return $this; + } + + /** + * Owners of the Google Cloud resource. + * + * Generated from protobuf field repeated string resource_owners = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResourceOwners() + { + return $this->resource_owners; + } + + /** + * Owners of the Google Cloud resource. + * + * Generated from protobuf field repeated string resource_owners = 5; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResourceOwners($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->resource_owners = $arr; + + return $this; + } + + /** + * The user defined display name for this resource. + * + * Generated from protobuf field string resource_display_name = 6; + * @return string + */ + public function getResourceDisplayName() + { + return $this->resource_display_name; + } + + /** + * The user defined display name for this resource. + * + * Generated from protobuf field string resource_display_name = 6; + * @param string $var + * @return $this + */ + public function setResourceDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->resource_display_name = $var; + + return $this; + } + + /** + * The user defined display name for the parent of this resource. + * + * Generated from protobuf field string resource_parent_display_name = 7; + * @return string + */ + public function getResourceParentDisplayName() + { + return $this->resource_parent_display_name; + } + + /** + * The user defined display name for the parent of this resource. + * + * Generated from protobuf field string resource_parent_display_name = 7; + * @param string $var + * @return $this + */ + public function setResourceParentDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->resource_parent_display_name = $var; + + return $this; + } + + /** + * The user defined display name for the project of this resource. + * + * Generated from protobuf field string resource_project_display_name = 8; + * @return string + */ + public function getResourceProjectDisplayName() + { + return $this->resource_project_display_name; + } + + /** + * The user defined display name for the project of this resource. + * + * Generated from protobuf field string resource_project_display_name = 8; + * @param string $var + * @return $this + */ + public function setResourceProjectDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->resource_project_display_name = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SecurityCenterProperties::class, \Google\Cloud\SecurityCenter\V1p1beta1\Asset_SecurityCenterProperties::class); + diff --git a/SecurityCenter/src/V1p1beta1/Asset_IamPolicy.php b/SecurityCenter/src/V1p1beta1/Asset_IamPolicy.php new file mode 100644 index 000000000000..a12aa9e564a9 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/Asset_IamPolicy.php @@ -0,0 +1,16 @@ +google.cloud.securitycenter.v1p1beta1.CreateFindingRequest + */ +class CreateFindingRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the new finding's parent. Its format should be + * "organizations/[organization_id]/sources/[source_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * 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. + * + * Generated from protobuf field string finding_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $finding_id = ''; + /** + * Required. The Finding being created. The name and security_marks will be + * ignored as they are both output only fields on this resource. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Finding finding = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $finding = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Resource name of the new finding's parent. Its format should be + * "organizations/[organization_id]/sources/[source_id]". + * @type string $finding_id + * 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. + * @type \Google\Cloud\SecurityCenter\V1p1beta1\Finding $finding + * Required. The Finding being created. The name and security_marks will be + * ignored as they are both output only fields on this resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the new finding's parent. Its format should be + * "organizations/[organization_id]/sources/[source_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Resource name of the new finding's parent. Its format should be + * "organizations/[organization_id]/sources/[source_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field string finding_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFindingId() + { + return $this->finding_id; + } + + /** + * 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. + * + * Generated from protobuf field string finding_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFindingId($var) + { + GPBUtil::checkString($var, True); + $this->finding_id = $var; + + return $this; + } + + /** + * Required. The Finding being created. The name and security_marks will be + * ignored as they are both output only fields on this resource. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Finding finding = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\SecurityCenter\V1p1beta1\Finding + */ + public function getFinding() + { + return $this->finding; + } + + /** + * Required. The Finding being created. The name and security_marks will be + * ignored as they are both output only fields on this resource. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Finding finding = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\Finding $var + * @return $this + */ + public function setFinding($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\Finding::class); + $this->finding = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/CreateNotificationConfigRequest.php b/SecurityCenter/src/V1p1beta1/CreateNotificationConfigRequest.php new file mode 100644 index 000000000000..8059535fe20e --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/CreateNotificationConfigRequest.php @@ -0,0 +1,159 @@ +google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest + */ +class CreateNotificationConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the new notification config's parent. Its format + * is "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * 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. + * + * Generated from protobuf field string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $config_id = ''; + /** + * 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. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.NotificationConfig notification_config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $notification_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Resource name of the new notification config's parent. Its format + * is "organizations/[organization_id]". + * @type string $config_id + * 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. + * @type \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig $notification_config + * 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. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the new notification config's parent. Its format + * is "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Resource name of the new notification config's parent. Its format + * is "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getConfigId() + { + return $this->config_id; + } + + /** + * 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. + * + * Generated from protobuf field string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setConfigId($var) + { + GPBUtil::checkString($var, True); + $this->config_id = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.NotificationConfig notification_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig + */ + public function getNotificationConfig() + { + return $this->notification_config; + } + + /** + * 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. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.NotificationConfig notification_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig $var + * @return $this + */ + public function setNotificationConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig::class); + $this->notification_config = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/CreateSourceRequest.php b/SecurityCenter/src/V1p1beta1/CreateSourceRequest.php new file mode 100644 index 000000000000..b1b4d2f1973b --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/CreateSourceRequest.php @@ -0,0 +1,109 @@ +google.cloud.securitycenter.v1p1beta1.CreateSourceRequest + */ +class CreateSourceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the new source's parent. Its format should be + * "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * Required. The Source being created, only the display_name and description + * will be used. All other fields will be ignored. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Source source = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $source = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Resource name of the new source's parent. Its format should be + * "organizations/[organization_id]". + * @type \Google\Cloud\SecurityCenter\V1p1beta1\Source $source + * Required. The Source being created, only the display_name and description + * will be used. All other fields will be ignored. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the new source's parent. Its format should be + * "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Resource name of the new source's parent. Its format should be + * "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The Source being created, only the display_name and description + * will be used. All other fields will be ignored. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Source source = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\SecurityCenter\V1p1beta1\Source + */ + public function getSource() + { + return $this->source; + } + + /** + * Required. The Source being created, only the display_name and description + * will be used. All other fields will be ignored. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Source source = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\Source $var + * @return $this + */ + public function setSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\Source::class); + $this->source = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/DeleteNotificationConfigRequest.php b/SecurityCenter/src/V1p1beta1/DeleteNotificationConfigRequest.php new file mode 100644 index 000000000000..427d427988c3 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/DeleteNotificationConfigRequest.php @@ -0,0 +1,71 @@ +google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest + */ +class DeleteNotificationConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the notification config to delete. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the notification config to delete. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the notification config to delete. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the notification config to delete. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/Finding.php b/SecurityCenter/src/V1p1beta1/Finding.php new file mode 100644 index 000000000000..ef1a9635435d --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/Finding.php @@ -0,0 +1,469 @@ +google.cloud.securitycenter.v1p1beta1.Finding + */ +class Finding extends \Google\Protobuf\Internal\Message +{ + /** + * 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}" + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * 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}" + * + * Generated from protobuf field string parent = 2; + */ + private $parent = ''; + /** + * For findings on Google Cloud Platform (GCP) resources, the full resource + * name of the GCP resource this finding is for. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * When the finding is for a non-GCP resource, the resourceName can be a + * customer or partner defined string. + * This field is immutable after creation time. + * + * Generated from protobuf field string resource_name = 3; + */ + private $resource_name = ''; + /** + * The state of the finding. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Finding.State state = 4; + */ + private $state = 0; + /** + * The additional taxonomy group within findings from a given source. + * This field is immutable after creation time. + * Example: "XSS_FLASH_INJECTION" + * + * Generated from protobuf field string category = 5; + */ + private $category = ''; + /** + * The URI that, if available, points to a web page outside of Cloud SCC + * where additional information about the finding can be found. This field is + * guaranteed to be either empty or a well formed URL. + * + * Generated from protobuf field string external_uri = 6; + */ + private $external_uri = ''; + /** + * 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. + * + * Generated from protobuf field map source_properties = 7; + */ + private $source_properties; + /** + * 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. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.SecurityMarks security_marks = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $security_marks = null; + /** + * The time at which the event took place. 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. + * + * Generated from protobuf field .google.protobuf.Timestamp event_time = 9; + */ + private $event_time = null; + /** + * The time at which the finding was created in Cloud SCC. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 10; + */ + private $create_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * 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}" + * @type string $parent + * 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}" + * @type string $resource_name + * For findings on Google Cloud Platform (GCP) resources, the full resource + * name of the GCP resource this finding is for. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * When the finding is for a non-GCP resource, the resourceName can be a + * customer or partner defined string. + * This field is immutable after creation time. + * @type int $state + * The state of the finding. + * @type string $category + * The additional taxonomy group within findings from a given source. + * This field is immutable after creation time. + * Example: "XSS_FLASH_INJECTION" + * @type string $external_uri + * The URI that, if available, points to a web page outside of Cloud SCC + * where additional information about the finding can be found. This field is + * guaranteed to be either empty or a well formed URL. + * @type array|\Google\Protobuf\Internal\MapField $source_properties + * 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. + * @type \Google\Cloud\SecurityCenter\V1p1beta1\SecurityMarks $security_marks + * 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. + * @type \Google\Protobuf\Timestamp $event_time + * The time at which the event took place. 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. + * @type \Google\Protobuf\Timestamp $create_time + * The time at which the finding was created in Cloud SCC. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\Finding::initOnce(); + parent::__construct($data); + } + + /** + * 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}" + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * 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}" + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * 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}" + * + * Generated from protobuf field string parent = 2; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * 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}" + * + * Generated from protobuf field string parent = 2; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * For findings on Google Cloud Platform (GCP) resources, the full resource + * name of the GCP resource this finding is for. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * When the finding is for a non-GCP resource, the resourceName can be a + * customer or partner defined string. + * This field is immutable after creation time. + * + * Generated from protobuf field string resource_name = 3; + * @return string + */ + public function getResourceName() + { + return $this->resource_name; + } + + /** + * For findings on Google Cloud Platform (GCP) resources, the full resource + * name of the GCP resource this finding is for. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * When the finding is for a non-GCP resource, the resourceName can be a + * customer or partner defined string. + * This field is immutable after creation time. + * + * Generated from protobuf field string resource_name = 3; + * @param string $var + * @return $this + */ + public function setResourceName($var) + { + GPBUtil::checkString($var, True); + $this->resource_name = $var; + + return $this; + } + + /** + * The state of the finding. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Finding.State state = 4; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of the finding. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Finding.State state = 4; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\SecurityCenter\V1p1beta1\Finding_State::class); + $this->state = $var; + + return $this; + } + + /** + * The additional taxonomy group within findings from a given source. + * This field is immutable after creation time. + * Example: "XSS_FLASH_INJECTION" + * + * Generated from protobuf field string category = 5; + * @return string + */ + public function getCategory() + { + return $this->category; + } + + /** + * The additional taxonomy group within findings from a given source. + * This field is immutable after creation time. + * Example: "XSS_FLASH_INJECTION" + * + * Generated from protobuf field string category = 5; + * @param string $var + * @return $this + */ + public function setCategory($var) + { + GPBUtil::checkString($var, True); + $this->category = $var; + + return $this; + } + + /** + * The URI that, if available, points to a web page outside of Cloud SCC + * where additional information about the finding can be found. This field is + * guaranteed to be either empty or a well formed URL. + * + * Generated from protobuf field string external_uri = 6; + * @return string + */ + public function getExternalUri() + { + return $this->external_uri; + } + + /** + * The URI that, if available, points to a web page outside of Cloud SCC + * where additional information about the finding can be found. This field is + * guaranteed to be either empty or a well formed URL. + * + * Generated from protobuf field string external_uri = 6; + * @param string $var + * @return $this + */ + public function setExternalUri($var) + { + GPBUtil::checkString($var, True); + $this->external_uri = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field map source_properties = 7; + * @return \Google\Protobuf\Internal\MapField + */ + public function getSourceProperties() + { + return $this->source_properties; + } + + /** + * 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. + * + * Generated from protobuf field map source_properties = 7; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setSourceProperties($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Value::class); + $this->source_properties = $arr; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.SecurityMarks security_marks = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\SecurityCenter\V1p1beta1\SecurityMarks + */ + public function getSecurityMarks() + { + return $this->security_marks; + } + + /** + * 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. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.SecurityMarks security_marks = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\SecurityMarks $var + * @return $this + */ + public function setSecurityMarks($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\SecurityMarks::class); + $this->security_marks = $var; + + return $this; + } + + /** + * The time at which the event took place. 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. + * + * Generated from protobuf field .google.protobuf.Timestamp event_time = 9; + * @return \Google\Protobuf\Timestamp + */ + public function getEventTime() + { + return $this->event_time; + } + + /** + * The time at which the event took place. 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. + * + * Generated from protobuf field .google.protobuf.Timestamp event_time = 9; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEventTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->event_time = $var; + + return $this; + } + + /** + * The time at which the finding was created in Cloud SCC. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 10; + * @return \Google\Protobuf\Timestamp + */ + public function getCreateTime() + { + return $this->create_time; + } + + /** + * The time at which the finding was created in Cloud SCC. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 10; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/Finding/State.php b/SecurityCenter/src/V1p1beta1/Finding/State.php new file mode 100644 index 000000000000..188e804f89de --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/Finding/State.php @@ -0,0 +1,65 @@ +google.cloud.securitycenter.v1p1beta1.Finding.State + */ +class State +{ + /** + * Unspecified state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The finding requires attention and has not been addressed yet. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * The finding has been fixed, triaged as a non-issue or otherwise addressed + * and is no longer active. + * + * Generated from protobuf enum INACTIVE = 2; + */ + const INACTIVE = 2; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::INACTIVE => 'INACTIVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\SecurityCenter\V1p1beta1\Finding_State::class); + diff --git a/SecurityCenter/src/V1p1beta1/Finding_State.php b/SecurityCenter/src/V1p1beta1/Finding_State.php new file mode 100644 index 000000000000..4d5147861fbd --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/Finding_State.php @@ -0,0 +1,16 @@ +organizationName('[ORGANIZATION]'); + * $source = new Source(); + * $response = $securityCenterClient->createSource($formattedParent, $source); + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To assist + * with these names, this class includes a format method for each type of name, and additionally + * a parseName method to extract the individual identifiers contained within formatted names + * that are returned by the API. + * + * @experimental + */ +class SecurityCenterGapicClient +{ + use GapicClientTrait; + + /** + * The name of the service. + */ + const SERVICE_NAME = 'google.cloud.securitycenter.v1p1beta1.SecurityCenter'; + + /** + * The default address of the service. + */ + const SERVICE_ADDRESS = 'securitycenter.googleapis.com'; + + /** + * The default port of the service. + */ + const DEFAULT_SERVICE_PORT = 443; + + /** + * The name of the code generator, to be included in the agent header. + */ + const CODEGEN_NAME = 'gapic'; + + /** + * The default scopes required by the service. + */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + private static $findingNameTemplate; + private static $notificationConfigNameTemplate; + private static $organizationNameTemplate; + private static $organizationSettingsNameTemplate; + private static $sourceNameTemplate; + private static $topicNameTemplate; + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS.':'.self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__.'/../resources/security_center_client_config.json', + 'descriptorsConfigPath' => __DIR__.'/../resources/security_center_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__.'/../resources/security_center_grpc_config.json', + 'credentialsConfig' => [ + 'scopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__.'/../resources/security_center_rest_client_config.php', + ], + ], + ]; + } + + private static function getFindingNameTemplate() + { + if (null == self::$findingNameTemplate) { + self::$findingNameTemplate = new PathTemplate('organizations/{organization}/sources/{source}/findings/{finding}'); + } + + return self::$findingNameTemplate; + } + + private static function getNotificationConfigNameTemplate() + { + if (null == self::$notificationConfigNameTemplate) { + self::$notificationConfigNameTemplate = new PathTemplate('organizations/{organization}/notificationConfigs/{notification_config}'); + } + + return self::$notificationConfigNameTemplate; + } + + private static function getOrganizationNameTemplate() + { + if (null == self::$organizationNameTemplate) { + self::$organizationNameTemplate = new PathTemplate('organizations/{organization}'); + } + + return self::$organizationNameTemplate; + } + + private static function getOrganizationSettingsNameTemplate() + { + if (null == self::$organizationSettingsNameTemplate) { + self::$organizationSettingsNameTemplate = new PathTemplate('organizations/{organization}/organizationSettings'); + } + + return self::$organizationSettingsNameTemplate; + } + + private static function getSourceNameTemplate() + { + if (null == self::$sourceNameTemplate) { + self::$sourceNameTemplate = new PathTemplate('organizations/{organization}/sources/{source}'); + } + + return self::$sourceNameTemplate; + } + + private static function getTopicNameTemplate() + { + if (null == self::$topicNameTemplate) { + self::$topicNameTemplate = new PathTemplate('projects/{project}/topics/{topic}'); + } + + return self::$topicNameTemplate; + } + + private static function getPathTemplateMap() + { + if (null == self::$pathTemplateMap) { + self::$pathTemplateMap = [ + 'finding' => self::getFindingNameTemplate(), + 'notificationConfig' => self::getNotificationConfigNameTemplate(), + 'organization' => self::getOrganizationNameTemplate(), + 'organizationSettings' => self::getOrganizationSettingsNameTemplate(), + 'source' => self::getSourceNameTemplate(), + 'topic' => self::getTopicNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent + * a finding resource. + * + * @param string $organization + * @param string $source + * @param string $finding + * + * @return string The formatted finding resource. + * @experimental + */ + public static function findingName($organization, $source, $finding) + { + return self::getFindingNameTemplate()->render([ + 'organization' => $organization, + 'source' => $source, + 'finding' => $finding, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a notification_config resource. + * + * @param string $organization + * @param string $notificationConfig + * + * @return string The formatted notification_config resource. + * @experimental + */ + public static function notificationConfigName($organization, $notificationConfig) + { + return self::getNotificationConfigNameTemplate()->render([ + 'organization' => $organization, + 'notification_config' => $notificationConfig, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a organization resource. + * + * @param string $organization + * + * @return string The formatted organization resource. + * @experimental + */ + public static function organizationName($organization) + { + return self::getOrganizationNameTemplate()->render([ + 'organization' => $organization, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a organization_settings resource. + * + * @param string $organization + * + * @return string The formatted organization_settings resource. + * @experimental + */ + public static function organizationSettingsName($organization) + { + return self::getOrganizationSettingsNameTemplate()->render([ + 'organization' => $organization, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a source resource. + * + * @param string $organization + * @param string $source + * + * @return string The formatted source resource. + * @experimental + */ + public static function sourceName($organization, $source) + { + return self::getSourceNameTemplate()->render([ + 'organization' => $organization, + 'source' => $source, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a topic resource. + * + * @param string $project + * @param string $topic + * + * @return string The formatted topic resource. + * @experimental + */ + public static function topicName($project, $topic) + { + return self::getTopicNameTemplate()->render([ + 'project' => $project, + 'topic' => $topic, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - finding: organizations/{organization}/sources/{source}/findings/{finding} + * - notificationConfig: organizations/{organization}/notificationConfigs/{notification_config} + * - organization: organizations/{organization} + * - organizationSettings: organizations/{organization}/organizationSettings + * - source: organizations/{organization}/sources/{source} + * - topic: projects/{project}/topics/{topic}. + * + * The optional $template argument can be supplied to specify a particular pattern, and must + * match one of the templates listed above. If no $template argument is provided, or if the + * $template argument does not match one of the templates listed, then parseName will check + * each of the supported templates, and return the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + * @experimental + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + * @experimental + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started + * by a long running API method. If $methodName is not provided, or does + * not match a long running API method, then the operation can still be + * resumed, but the OperationResponse object will not deserialize the + * final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + * @experimental + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $serviceAddress + * **Deprecated**. This option will be removed in a future major release. Please + * utilize the `$apiEndpoint` option instead. + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'securitycenter.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the client. + * For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()}. + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either a + * path to a JSON file, or a PHP array containing the decoded JSON data. + * By default this settings points to the default client config file, which is provided + * in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string `rest` + * or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already instantiated + * {@see \Google\ApiCore\Transport\TransportInterface} object. Note that when this + * object is provided, any settings in $transportConfig, and any `$apiEndpoint` + * setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...] + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * } + * + * @throws ValidationException + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Creates a source. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $formattedParent = $securityCenterClient->organizationName('[ORGANIZATION]'); + * $source = new Source(); + * $response = $securityCenterClient->createSource($formattedParent, $source); + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param string $parent Required. Resource name of the new source's parent. Its format should be + * "organizations/[organization_id]". + * @param Source $source Required. The Source being created, only the display_name and description + * will be used. All other fields will be ignored. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\SecurityCenter\V1p1beta1\Source + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function createSource($parent, $source, array $optionalArgs = []) + { + $request = new CreateSourceRequest(); + $request->setParent($parent); + $request->setSource($source); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'CreateSource', + Source::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Creates a finding. The corresponding source must exist for finding + * creation to succeed. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $formattedParent = $securityCenterClient->sourceName('[ORGANIZATION]', '[SOURCE]'); + * $findingId = ''; + * $finding = new Finding(); + * $response = $securityCenterClient->createFinding($formattedParent, $findingId, $finding); + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param string $parent Required. Resource name of the new finding's parent. Its format should be + * "organizations/[organization_id]/sources/[source_id]". + * @param string $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 Finding $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 array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\SecurityCenter\V1p1beta1\Finding + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function createFinding($parent, $findingId, $finding, array $optionalArgs = []) + { + $request = new CreateFindingRequest(); + $request->setParent($parent); + $request->setFindingId($findingId); + $request->setFinding($finding); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'CreateFinding', + Finding::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Creates a notification config. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $formattedParent = $securityCenterClient->organizationName('[ORGANIZATION]'); + * $configId = ''; + * $notificationConfig = new NotificationConfig(); + * $response = $securityCenterClient->createNotificationConfig($formattedParent, $configId, $notificationConfig); + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param string $parent Required. Resource name of the new notification config's parent. Its format + * is "organizations/[organization_id]". + * @param string $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 NotificationConfig $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 array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function createNotificationConfig($parent, $configId, $notificationConfig, array $optionalArgs = []) + { + $request = new CreateNotificationConfigRequest(); + $request->setParent($parent); + $request->setConfigId($configId); + $request->setNotificationConfig($notificationConfig); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'CreateNotificationConfig', + NotificationConfig::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Deletes a notification config. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $formattedName = $securityCenterClient->notificationConfigName('[ORGANIZATION]', '[NOTIFICATION_CONFIG]'); + * $securityCenterClient->deleteNotificationConfig($formattedName); + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the notification config to delete. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function deleteNotificationConfig($name, array $optionalArgs = []) + { + $request = new DeleteNotificationConfigRequest(); + $request->setName($name); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'DeleteNotificationConfig', + GPBEmpty::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Gets the access control policy on the specified Source. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $resource = ''; + * $response = $securityCenterClient->getIamPolicy($resource); + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $request->setResource($resource); + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'resource' => $request->getResource(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'GetIamPolicy', + Policy::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Gets a notification config. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $formattedName = $securityCenterClient->notificationConfigName('[ORGANIZATION]', '[NOTIFICATION_CONFIG]'); + * $response = $securityCenterClient->getNotificationConfig($formattedName); + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the notification config to get. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function getNotificationConfig($name, array $optionalArgs = []) + { + $request = new GetNotificationConfigRequest(); + $request->setName($name); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'GetNotificationConfig', + NotificationConfig::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Gets the settings for an organization. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $formattedName = $securityCenterClient->organizationSettingsName('[ORGANIZATION]'); + * $response = $securityCenterClient->getOrganizationSettings($formattedName); + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the organization to get organization settings for. Its + * format is "organizations/[organization_id]/organizationSettings". + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\SecurityCenter\V1p1beta1\OrganizationSettings + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function getOrganizationSettings($name, array $optionalArgs = []) + { + $request = new GetOrganizationSettingsRequest(); + $request->setName($name); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'GetOrganizationSettings', + OrganizationSettings::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Gets a source. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $formattedName = $securityCenterClient->sourceName('[ORGANIZATION]', '[SOURCE]'); + * $response = $securityCenterClient->getSource($formattedName); + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param string $name Required. Relative resource name of the source. Its format is + * "organizations/[organization_id]/source/[source_id]". + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\SecurityCenter\V1p1beta1\Source + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function getSource($name, array $optionalArgs = []) + { + $request = new GetSourceRequest(); + $request->setName($name); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'GetSource', + Source::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Filters an organization's assets and groups them by their specified + * properties. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $formattedParent = $securityCenterClient->organizationName('[ORGANIZATION]'); + * $groupBy = ''; + * // Iterate over pages of elements + * $pagedResponse = $securityCenterClient->groupAssets($formattedParent, $groupBy); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * + * + * // Alternatively: + * + * // Iterate through all elements + * $pagedResponse = $securityCenterClient->groupAssets($formattedParent, $groupBy); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param string $parent Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id]". + * @param string $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 array $optionalArgs { + * Optional. + * + * @type string $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. + * @type Duration $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`. + * @type Timestamp $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. + * @type string $having + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `state_change` is supported and + * requires compare_duration to be specified. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function groupAssets($parent, $groupBy, array $optionalArgs = []) + { + $request = new GroupAssetsRequest(); + $request->setParent($parent); + $request->setGroupBy($groupBy); + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + if (isset($optionalArgs['compareDuration'])) { + $request->setCompareDuration($optionalArgs['compareDuration']); + } + if (isset($optionalArgs['readTime'])) { + $request->setReadTime($optionalArgs['readTime']); + } + if (isset($optionalArgs['having'])) { + $request->setHaving($optionalArgs['having']); + } + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->getPagedListResponse( + 'GroupAssets', + $optionalArgs, + GroupAssetsResponse::class, + $request + ); + } + + /** + * 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: /v1p1beta1/organizations/{organization_id}/sources/-/findings + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $formattedParent = $securityCenterClient->sourceName('[ORGANIZATION]', '[SOURCE]'); + * $groupBy = ''; + * // Iterate over pages of elements + * $pagedResponse = $securityCenterClient->groupFindings($formattedParent, $groupBy); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * + * + * // Alternatively: + * + * // Iterate through all elements + * $pagedResponse = $securityCenterClient->groupFindings($formattedParent, $groupBy); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param string $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 $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 + * + * The following fields are supported when compare_duration is set: + * + * * state_change + * @param array $optionalArgs { + * Optional. + * + * @type string $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" + * + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * @type Timestamp $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. + * @type Duration $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 at the start of + * compare_duration, but changed its state at read_time. + * * "UNCHANGED": indicates that the finding was present at the start of + * compare_duration and did not change state at read_time. + * * "ADDED": indicates that the finding was not present at the start + * of compare_duration, but was present 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`. + * @type string $having + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `finding.state` and `state_change` + * are supported and requires compare_duration to be specified. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function groupFindings($parent, $groupBy, array $optionalArgs = []) + { + $request = new GroupFindingsRequest(); + $request->setParent($parent); + $request->setGroupBy($groupBy); + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + if (isset($optionalArgs['readTime'])) { + $request->setReadTime($optionalArgs['readTime']); + } + if (isset($optionalArgs['compareDuration'])) { + $request->setCompareDuration($optionalArgs['compareDuration']); + } + if (isset($optionalArgs['having'])) { + $request->setHaving($optionalArgs['having']); + } + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->getPagedListResponse( + 'GroupFindings', + $optionalArgs, + GroupFindingsResponse::class, + $request + ); + } + + /** + * Lists an organization's assets. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $formattedParent = $securityCenterClient->organizationName('[ORGANIZATION]'); + * // Iterate over pages of elements + * $pagedResponse = $securityCenterClient->listAssets($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * + * + * // Alternatively: + * + * // Iterate through all elements + * $pagedResponse = $securityCenterClient->listAssets($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param string $parent Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id]". + * @param array $optionalArgs { + * Optional. + * + * @type string $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. + * @type string $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 + * @type Timestamp $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. + * @type Duration $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. + * @type string $having + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `state_change` is supported and + * requires compare_duration to be specified. + * @type FieldMask $fieldMask + * Optional. + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function listAssets($parent, array $optionalArgs = []) + { + $request = new ListAssetsRequest(); + $request->setParent($parent); + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + if (isset($optionalArgs['readTime'])) { + $request->setReadTime($optionalArgs['readTime']); + } + if (isset($optionalArgs['compareDuration'])) { + $request->setCompareDuration($optionalArgs['compareDuration']); + } + if (isset($optionalArgs['having'])) { + $request->setHaving($optionalArgs['having']); + } + if (isset($optionalArgs['fieldMask'])) { + $request->setFieldMask($optionalArgs['fieldMask']); + } + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->getPagedListResponse( + 'ListAssets', + $optionalArgs, + ListAssetsResponse::class, + $request + ); + } + + /** + * 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 + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $formattedParent = $securityCenterClient->sourceName('[ORGANIZATION]', '[SOURCE]'); + * // Iterate over pages of elements + * $pagedResponse = $securityCenterClient->listFindings($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * + * + * // Alternatively: + * + * // Iterate through all elements + * $pagedResponse = $securityCenterClient->listFindings($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param string $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 array $optionalArgs { + * Optional. + * + * @type string $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" + * + * security_marks.marks: `=`, `:` + * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * @type string $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 + * @type Timestamp $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. + * @type Duration $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 at the start of + * compare_duration, but changed its state at read_time. + * * "UNCHANGED": indicates that the finding was present at the start of + * compare_duration and did not change state at read_time. + * * "ADDED": indicates that the finding was not present at the start + * of compare_duration, but was present 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. + * @type string $having + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `finding.state` and `state_change` + * are supported and requires compare_duration to be specified. + * @type FieldMask $fieldMask + * Optional. + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function listFindings($parent, array $optionalArgs = []) + { + $request = new ListFindingsRequest(); + $request->setParent($parent); + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + if (isset($optionalArgs['readTime'])) { + $request->setReadTime($optionalArgs['readTime']); + } + if (isset($optionalArgs['compareDuration'])) { + $request->setCompareDuration($optionalArgs['compareDuration']); + } + if (isset($optionalArgs['having'])) { + $request->setHaving($optionalArgs['having']); + } + if (isset($optionalArgs['fieldMask'])) { + $request->setFieldMask($optionalArgs['fieldMask']); + } + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->getPagedListResponse( + 'ListFindings', + $optionalArgs, + ListFindingsResponse::class, + $request + ); + } + + /** + * Lists notification configs. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $formattedParent = $securityCenterClient->organizationName('[ORGANIZATION]'); + * // Iterate over pages of elements + * $pagedResponse = $securityCenterClient->listNotificationConfigs($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * + * + * // Alternatively: + * + * // Iterate through all elements + * $pagedResponse = $securityCenterClient->listNotificationConfigs($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param string $parent Required. Name of the organization to list notification configs. + * Its format is "organizations/[organization_id]". + * @param array $optionalArgs { + * Optional. + * + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function listNotificationConfigs($parent, array $optionalArgs = []) + { + $request = new ListNotificationConfigsRequest(); + $request->setParent($parent); + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->getPagedListResponse( + 'ListNotificationConfigs', + $optionalArgs, + ListNotificationConfigsResponse::class, + $request + ); + } + + /** + * Lists all sources belonging to an organization. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $formattedParent = $securityCenterClient->organizationName('[ORGANIZATION]'); + * // Iterate over pages of elements + * $pagedResponse = $securityCenterClient->listSources($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * + * + * // Alternatively: + * + * // Iterate through all elements + * $pagedResponse = $securityCenterClient->listSources($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param string $parent Required. Resource name of the parent of sources to list. Its format should + * be "organizations/[organization_id]". + * @param array $optionalArgs { + * Optional. + * + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function listSources($parent, array $optionalArgs = []) + { + $request = new ListSourcesRequest(); + $request->setParent($parent); + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->getPagedListResponse( + 'ListSources', + $optionalArgs, + ListSourcesResponse::class, + $request + ); + } + + /** + * 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. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $formattedParent = $securityCenterClient->organizationName('[ORGANIZATION]'); + * $operationResponse = $securityCenterClient->runAssetDiscovery($formattedParent); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * + * + * // Alternatively: + * + * // start the operation, keep the operation name, and resume later + * $operationResponse = $securityCenterClient->runAssetDiscovery($formattedParent); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $securityCenterClient->resumeOperation($operationName, 'runAssetDiscovery'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param string $parent Required. Name of the organization to run asset discovery for. Its format + * is "organizations/[organization_id]". + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function runAssetDiscovery($parent, array $optionalArgs = []) + { + $request = new RunAssetDiscoveryRequest(); + $request->setParent($parent); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startOperationsCall( + 'RunAssetDiscovery', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Updates the state of a finding. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $formattedName = $securityCenterClient->findingName('[ORGANIZATION]', '[SOURCE]', '[FINDING]'); + * $state = State::STATE_UNSPECIFIED; + * $startTime = new Timestamp(); + * $response = $securityCenterClient->setFindingState($formattedName, $state, $startTime); + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param string $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 int $state Required. The desired State of the finding. + * For allowed values, use constants defined on {@see \Google\Cloud\SecurityCenter\V1p1beta1\Finding\State} + * @param Timestamp $startTime Required. The time at which the updated state takes effect. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\SecurityCenter\V1p1beta1\Finding + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function setFindingState($name, $state, $startTime, array $optionalArgs = []) + { + $request = new SetFindingStateRequest(); + $request->setName($name); + $request->setState($state); + $request->setStartTime($startTime); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'SetFindingState', + Finding::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Sets the access control policy on the specified Source. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $resource = ''; + * $policy = new Policy(); + * $response = $securityCenterClient->setIamPolicy($resource, $policy); + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $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 array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $request->setResource($resource); + $request->setPolicy($policy); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'resource' => $request->getResource(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'SetIamPolicy', + Policy::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Returns the permissions that a caller has on the specified source. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $resource = ''; + * $permissions = []; + * $response = $securityCenterClient->testIamPermissions($resource, $permissions); + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param string $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[] $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 array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $request->setResource($resource); + $request->setPermissions($permissions); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'resource' => $request->getResource(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'TestIamPermissions', + TestIamPermissionsResponse::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Creates or updates a finding. The corresponding source must exist for a + * finding creation to succeed. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $finding = new Finding(); + * $response = $securityCenterClient->updateFinding($finding); + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param Finding $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 array $optionalArgs { + * Optional. + * + * @type FieldMask $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. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\SecurityCenter\V1p1beta1\Finding + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function updateFinding($finding, array $optionalArgs = []) + { + $request = new UpdateFindingRequest(); + $request->setFinding($finding); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'finding.name' => $request->getFinding()->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'UpdateFinding', + Finding::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Updates a notification config. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $notificationConfig = new NotificationConfig(); + * $response = $securityCenterClient->updateNotificationConfig($notificationConfig); + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param NotificationConfig $notificationConfig Required. The notification config to update. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The FieldMask to use when updating the notification config. + * + * If empty all mutable fields will be updated. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function updateNotificationConfig($notificationConfig, array $optionalArgs = []) + { + $request = new UpdateNotificationConfigRequest(); + $request->setNotificationConfig($notificationConfig); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'notification_config.name' => $request->getNotificationConfig()->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'UpdateNotificationConfig', + NotificationConfig::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Updates an organization's settings. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $organizationSettings = new OrganizationSettings(); + * $response = $securityCenterClient->updateOrganizationSettings($organizationSettings); + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param OrganizationSettings $organizationSettings Required. The organization settings resource to update. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The FieldMask to use when updating the settings resource. + * + * If empty all mutable fields will be updated. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\SecurityCenter\V1p1beta1\OrganizationSettings + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function updateOrganizationSettings($organizationSettings, array $optionalArgs = []) + { + $request = new UpdateOrganizationSettingsRequest(); + $request->setOrganizationSettings($organizationSettings); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'organization_settings.name' => $request->getOrganizationSettings()->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'UpdateOrganizationSettings', + OrganizationSettings::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Updates a source. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $source = new Source(); + * $response = $securityCenterClient->updateSource($source); + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param Source $source Required. The source resource to update. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The FieldMask to use when updating the source resource. + * + * If empty all mutable fields will be updated. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\SecurityCenter\V1p1beta1\Source + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function updateSource($source, array $optionalArgs = []) + { + $request = new UpdateSourceRequest(); + $request->setSource($source); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'source.name' => $request->getSource()->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'UpdateSource', + Source::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Updates security marks. + * + * Sample code: + * ``` + * $securityCenterClient = new SecurityCenterClient(); + * try { + * $securityMarks = new SecurityMarks(); + * $response = $securityCenterClient->updateSecurityMarks($securityMarks); + * } finally { + * $securityCenterClient->close(); + * } + * ``` + * + * @param SecurityMarks $securityMarks Required. The security marks resource to update. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $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.". + * @type Timestamp $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. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\SecurityCenter\V1p1beta1\SecurityMarks + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function updateSecurityMarks($securityMarks, array $optionalArgs = []) + { + $request = new UpdateSecurityMarksRequest(); + $request->setSecurityMarks($securityMarks); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + if (isset($optionalArgs['startTime'])) { + $request->setStartTime($optionalArgs['startTime']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'security_marks.name' => $request->getSecurityMarks()->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'UpdateSecurityMarks', + SecurityMarks::class, + $optionalArgs, + $request + )->wait(); + } +} diff --git a/SecurityCenter/src/V1p1beta1/GetNotificationConfigRequest.php b/SecurityCenter/src/V1p1beta1/GetNotificationConfigRequest.php new file mode 100644 index 000000000000..1018831ca1b2 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/GetNotificationConfigRequest.php @@ -0,0 +1,71 @@ +google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest + */ +class GetNotificationConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the notification config to get. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the notification config to get. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the notification config to get. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the notification config to get. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/GetOrganizationSettingsRequest.php b/SecurityCenter/src/V1p1beta1/GetOrganizationSettingsRequest.php new file mode 100644 index 000000000000..229975486b65 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/GetOrganizationSettingsRequest.php @@ -0,0 +1,71 @@ +google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest + */ +class GetOrganizationSettingsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the organization to get organization settings for. Its + * format is "organizations/[organization_id]/organizationSettings". + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the organization to get organization settings for. Its + * format is "organizations/[organization_id]/organizationSettings". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the organization to get organization settings for. Its + * format is "organizations/[organization_id]/organizationSettings". + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the organization to get organization settings for. Its + * format is "organizations/[organization_id]/organizationSettings". + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/GetSourceRequest.php b/SecurityCenter/src/V1p1beta1/GetSourceRequest.php new file mode 100644 index 000000000000..01b791e56f82 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/GetSourceRequest.php @@ -0,0 +1,71 @@ +google.cloud.securitycenter.v1p1beta1.GetSourceRequest + */ +class GetSourceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Relative resource name of the source. Its format is + * "organizations/[organization_id]/source/[source_id]". + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Relative resource name of the source. Its format is + * "organizations/[organization_id]/source/[source_id]". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Relative resource name of the source. Its format is + * "organizations/[organization_id]/source/[source_id]". + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Relative resource name of the source. Its format is + * "organizations/[organization_id]/source/[source_id]". + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/GroupAssetsRequest.php b/SecurityCenter/src/V1p1beta1/GroupAssetsRequest.php new file mode 100644 index 000000000000..6c0252e4ac55 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/GroupAssetsRequest.php @@ -0,0 +1,645 @@ +google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest + */ +class GroupAssetsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * 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. + * + * Generated from protobuf field string filter = 2; + */ + private $filter = ''; + /** + * 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 + * + * Generated from protobuf field string group_by = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $group_by = ''; + /** + * 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`. + * + * Generated from protobuf field .google.protobuf.Duration compare_duration = 4; + */ + private $compare_duration = null; + /** + * 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. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 5; + */ + private $read_time = null; + /** + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `state_change` is supported and + * requires compare_duration to be specified. + * + * Generated from protobuf field string having = 6; + */ + private $having = ''; + /** + * 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. + * + * Generated from protobuf field string page_token = 7; + */ + private $page_token = ''; + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * + * Generated from protobuf field int32 page_size = 8; + */ + private $page_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id]". + * @type string $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. + * @type string $group_by + * 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 + * @type \Google\Protobuf\Duration $compare_duration + * 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`. + * @type \Google\Protobuf\Timestamp $read_time + * 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. + * @type string $having + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `state_change` is supported and + * requires compare_duration to be specified. + * @type string $page_token + * 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. + * @type int $page_size + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->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. + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * 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 + * + * Generated from protobuf field string group_by = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getGroupBy() + { + return $this->group_by; + } + + /** + * 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 + * + * Generated from protobuf field string group_by = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setGroupBy($var) + { + GPBUtil::checkString($var, True); + $this->group_by = $var; + + return $this; + } + + /** + * 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`. + * + * Generated from protobuf field .google.protobuf.Duration compare_duration = 4; + * @return \Google\Protobuf\Duration + */ + public function getCompareDuration() + { + return $this->compare_duration; + } + + /** + * 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`. + * + * Generated from protobuf field .google.protobuf.Duration compare_duration = 4; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setCompareDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->compare_duration = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 5; + * @return \Google\Protobuf\Timestamp + */ + public function getReadTime() + { + return $this->read_time; + } + + /** + * 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. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setReadTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->read_time = $var; + + return $this; + } + + /** + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `state_change` is supported and + * requires compare_duration to be specified. + * + * Generated from protobuf field string having = 6; + * @return string + */ + public function getHaving() + { + return $this->having; + } + + /** + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `state_change` is supported and + * requires compare_duration to be specified. + * + * Generated from protobuf field string having = 6; + * @param string $var + * @return $this + */ + public function setHaving($var) + { + GPBUtil::checkString($var, True); + $this->having = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field string page_token = 7; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * 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. + * + * Generated from protobuf field string page_token = 7; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * + * Generated from protobuf field int32 page_size = 8; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * + * Generated from protobuf field int32 page_size = 8; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/GroupAssetsResponse.php b/SecurityCenter/src/V1p1beta1/GroupAssetsResponse.php new file mode 100644 index 000000000000..4219dd8153b9 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/GroupAssetsResponse.php @@ -0,0 +1,181 @@ +google.cloud.securitycenter.v1p1beta1.GroupAssetsResponse + */ +class GroupAssetsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * 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. + * + * Generated from protobuf field repeated .google.cloud.securitycenter.v1p1beta1.GroupResult group_by_results = 1; + */ + private $group_by_results; + /** + * Time used for executing the groupBy request. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 2; + */ + private $read_time = null; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results. + * + * Generated from protobuf field string next_page_token = 3; + */ + private $next_page_token = ''; + /** + * The total number of results matching the query. + * + * Generated from protobuf field int32 total_size = 4; + */ + private $total_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\SecurityCenter\V1p1beta1\GroupResult[]|\Google\Protobuf\Internal\RepeatedField $group_by_results + * 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. + * @type \Google\Protobuf\Timestamp $read_time + * Time used for executing the groupBy request. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results. + * @type int $total_size + * The total number of results matching the query. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * 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. + * + * Generated from protobuf field repeated .google.cloud.securitycenter.v1p1beta1.GroupResult group_by_results = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGroupByResults() + { + return $this->group_by_results; + } + + /** + * 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. + * + * Generated from protobuf field repeated .google.cloud.securitycenter.v1p1beta1.GroupResult group_by_results = 1; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\GroupResult[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGroupByResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\SecurityCenter\V1p1beta1\GroupResult::class); + $this->group_by_results = $arr; + + return $this; + } + + /** + * Time used for executing the groupBy request. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 2; + * @return \Google\Protobuf\Timestamp + */ + public function getReadTime() + { + return $this->read_time; + } + + /** + * Time used for executing the groupBy request. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setReadTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->read_time = $var; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results. + * + * Generated from protobuf field string next_page_token = 3; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results. + * + * Generated from protobuf field string next_page_token = 3; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * The total number of results matching the query. + * + * Generated from protobuf field int32 total_size = 4; + * @return int + */ + public function getTotalSize() + { + return $this->total_size; + } + + /** + * The total number of results matching the query. + * + * Generated from protobuf field int32 total_size = 4; + * @param int $var + * @return $this + */ + public function setTotalSize($var) + { + GPBUtil::checkInt32($var); + $this->total_size = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/GroupFindingsRequest.php b/SecurityCenter/src/V1p1beta1/GroupFindingsRequest.php new file mode 100644 index 000000000000..43f0d2420359 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/GroupFindingsRequest.php @@ -0,0 +1,589 @@ +google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest + */ +class GroupFindingsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * 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/- + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * 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" + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * For example, `source_properties.size = 100` is a valid filter string. + * + * Generated from protobuf field string filter = 2; + */ + private $filter = ''; + /** + * 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 + * The following fields are supported when compare_duration is set: + * * state_change + * + * Generated from protobuf field string group_by = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $group_by = ''; + /** + * 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. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 4; + */ + private $read_time = null; + /** + * 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 at the start of + * compare_duration, but changed its state at read_time. + * * "UNCHANGED": indicates that the finding was present at the start of + * compare_duration and did not change state at read_time. + * * "ADDED": indicates that the finding was not present at the start + * of compare_duration, but was present 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`. + * + * Generated from protobuf field .google.protobuf.Duration compare_duration = 5; + */ + private $compare_duration = null; + /** + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `finding.state` and `state_change` + * are supported and requires compare_duration to be specified. + * + * Generated from protobuf field string having = 6; + */ + private $having = ''; + /** + * 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. + * + * Generated from protobuf field string page_token = 7; + */ + private $page_token = ''; + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * + * Generated from protobuf field int32 page_size = 8; + */ + private $page_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $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/- + * @type string $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" + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * For example, `source_properties.size = 100` is a valid filter string. + * @type string $group_by + * 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 + * The following fields are supported when compare_duration is set: + * * state_change + * @type \Google\Protobuf\Timestamp $read_time + * 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. + * @type \Google\Protobuf\Duration $compare_duration + * 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 at the start of + * compare_duration, but changed its state at read_time. + * * "UNCHANGED": indicates that the finding was present at the start of + * compare_duration and did not change state at read_time. + * * "ADDED": indicates that the finding was not present at the start + * of compare_duration, but was present 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`. + * @type string $having + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `finding.state` and `state_change` + * are supported and requires compare_duration to be specified. + * @type string $page_token + * 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. + * @type int $page_size + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * 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/- + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->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/- + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * 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" + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * For example, `source_properties.size = 100` is a valid filter string. + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->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" + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * For example, `source_properties.size = 100` is a valid filter string. + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * 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 + * The following fields are supported when compare_duration is set: + * * state_change + * + * Generated from protobuf field string group_by = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getGroupBy() + { + return $this->group_by; + } + + /** + * 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 + * The following fields are supported when compare_duration is set: + * * state_change + * + * Generated from protobuf field string group_by = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setGroupBy($var) + { + GPBUtil::checkString($var, True); + $this->group_by = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 4; + * @return \Google\Protobuf\Timestamp + */ + public function getReadTime() + { + return $this->read_time; + } + + /** + * 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. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setReadTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->read_time = $var; + + return $this; + } + + /** + * 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 at the start of + * compare_duration, but changed its state at read_time. + * * "UNCHANGED": indicates that the finding was present at the start of + * compare_duration and did not change state at read_time. + * * "ADDED": indicates that the finding was not present at the start + * of compare_duration, but was present 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`. + * + * Generated from protobuf field .google.protobuf.Duration compare_duration = 5; + * @return \Google\Protobuf\Duration + */ + public function getCompareDuration() + { + return $this->compare_duration; + } + + /** + * 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 at the start of + * compare_duration, but changed its state at read_time. + * * "UNCHANGED": indicates that the finding was present at the start of + * compare_duration and did not change state at read_time. + * * "ADDED": indicates that the finding was not present at the start + * of compare_duration, but was present 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`. + * + * Generated from protobuf field .google.protobuf.Duration compare_duration = 5; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setCompareDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->compare_duration = $var; + + return $this; + } + + /** + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `finding.state` and `state_change` + * are supported and requires compare_duration to be specified. + * + * Generated from protobuf field string having = 6; + * @return string + */ + public function getHaving() + { + return $this->having; + } + + /** + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `finding.state` and `state_change` + * are supported and requires compare_duration to be specified. + * + * Generated from protobuf field string having = 6; + * @param string $var + * @return $this + */ + public function setHaving($var) + { + GPBUtil::checkString($var, True); + $this->having = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field string page_token = 7; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * 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. + * + * Generated from protobuf field string page_token = 7; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * + * Generated from protobuf field int32 page_size = 8; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * + * Generated from protobuf field int32 page_size = 8; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/GroupFindingsResponse.php b/SecurityCenter/src/V1p1beta1/GroupFindingsResponse.php new file mode 100644 index 000000000000..825ed2ae216c --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/GroupFindingsResponse.php @@ -0,0 +1,181 @@ +google.cloud.securitycenter.v1p1beta1.GroupFindingsResponse + */ +class GroupFindingsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * 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. + * + * Generated from protobuf field repeated .google.cloud.securitycenter.v1p1beta1.GroupResult group_by_results = 1; + */ + private $group_by_results; + /** + * Time used for executing the groupBy request. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 2; + */ + private $read_time = null; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results. + * + * Generated from protobuf field string next_page_token = 3; + */ + private $next_page_token = ''; + /** + * The total number of results matching the query. + * + * Generated from protobuf field int32 total_size = 4; + */ + private $total_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\SecurityCenter\V1p1beta1\GroupResult[]|\Google\Protobuf\Internal\RepeatedField $group_by_results + * 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. + * @type \Google\Protobuf\Timestamp $read_time + * Time used for executing the groupBy request. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results. + * @type int $total_size + * The total number of results matching the query. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * 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. + * + * Generated from protobuf field repeated .google.cloud.securitycenter.v1p1beta1.GroupResult group_by_results = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGroupByResults() + { + return $this->group_by_results; + } + + /** + * 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. + * + * Generated from protobuf field repeated .google.cloud.securitycenter.v1p1beta1.GroupResult group_by_results = 1; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\GroupResult[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGroupByResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\SecurityCenter\V1p1beta1\GroupResult::class); + $this->group_by_results = $arr; + + return $this; + } + + /** + * Time used for executing the groupBy request. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 2; + * @return \Google\Protobuf\Timestamp + */ + public function getReadTime() + { + return $this->read_time; + } + + /** + * Time used for executing the groupBy request. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setReadTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->read_time = $var; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results. + * + * Generated from protobuf field string next_page_token = 3; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results. + * + * Generated from protobuf field string next_page_token = 3; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * The total number of results matching the query. + * + * Generated from protobuf field int32 total_size = 4; + * @return int + */ + public function getTotalSize() + { + return $this->total_size; + } + + /** + * The total number of results matching the query. + * + * Generated from protobuf field int32 total_size = 4; + * @param int $var + * @return $this + */ + public function setTotalSize($var) + { + GPBUtil::checkInt32($var); + $this->total_size = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/GroupResult.php b/SecurityCenter/src/V1p1beta1/GroupResult.php new file mode 100644 index 000000000000..bff81be09b92 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/GroupResult.php @@ -0,0 +1,101 @@ +google.cloud.securitycenter.v1p1beta1.GroupResult + */ +class GroupResult extends \Google\Protobuf\Internal\Message +{ + /** + * Properties matching the groupBy fields in the request. + * + * Generated from protobuf field map properties = 1; + */ + private $properties; + /** + * Total count of resources for the given properties. + * + * Generated from protobuf field int64 count = 2; + */ + private $count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\MapField $properties + * Properties matching the groupBy fields in the request. + * @type int|string $count + * Total count of resources for the given properties. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Properties matching the groupBy fields in the request. + * + * Generated from protobuf field map properties = 1; + * @return \Google\Protobuf\Internal\MapField + */ + public function getProperties() + { + return $this->properties; + } + + /** + * Properties matching the groupBy fields in the request. + * + * Generated from protobuf field map properties = 1; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setProperties($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Value::class); + $this->properties = $arr; + + return $this; + } + + /** + * Total count of resources for the given properties. + * + * Generated from protobuf field int64 count = 2; + * @return int|string + */ + public function getCount() + { + return $this->count; + } + + /** + * Total count of resources for the given properties. + * + * Generated from protobuf field int64 count = 2; + * @param int|string $var + * @return $this + */ + public function setCount($var) + { + GPBUtil::checkInt64($var); + $this->count = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/ListAssetsRequest.php b/SecurityCenter/src/V1p1beta1/ListAssetsRequest.php new file mode 100644 index 000000000000..17cc44619976 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/ListAssetsRequest.php @@ -0,0 +1,707 @@ +google.cloud.securitycenter.v1p1beta1.ListAssetsRequest + */ +class ListAssetsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * 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. + * + * Generated from protobuf field string filter = 2; + */ + private $filter = ''; + /** + * 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 + * + * Generated from protobuf field string order_by = 3; + */ + private $order_by = ''; + /** + * 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. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 4; + */ + private $read_time = null; + /** + * 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. + * + * Generated from protobuf field .google.protobuf.Duration compare_duration = 5; + */ + private $compare_duration = null; + /** + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `state_change` is supported and + * requires compare_duration to be specified. + * + * Generated from protobuf field string having = 6; + */ + private $having = ''; + /** + * Optional. + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $field_mask = null; + /** + * 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. + * + * Generated from protobuf field string page_token = 8; + */ + private $page_token = ''; + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * + * Generated from protobuf field int32 page_size = 9; + */ + private $page_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id]". + * @type string $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. + * @type string $order_by + * 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 + * @type \Google\Protobuf\Timestamp $read_time + * 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. + * @type \Google\Protobuf\Duration $compare_duration + * 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. + * @type string $having + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `state_change` is supported and + * requires compare_duration to be specified. + * @type \Google\Protobuf\FieldMask $field_mask + * Optional. + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @type string $page_token + * 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. + * @type int $page_size + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->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. + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * 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 + * + * Generated from protobuf field string order_by = 3; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * 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 + * + * Generated from protobuf field string order_by = 3; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 4; + * @return \Google\Protobuf\Timestamp + */ + public function getReadTime() + { + return $this->read_time; + } + + /** + * 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. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setReadTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->read_time = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field .google.protobuf.Duration compare_duration = 5; + * @return \Google\Protobuf\Duration + */ + public function getCompareDuration() + { + return $this->compare_duration; + } + + /** + * 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. + * + * Generated from protobuf field .google.protobuf.Duration compare_duration = 5; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setCompareDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->compare_duration = $var; + + return $this; + } + + /** + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `state_change` is supported and + * requires compare_duration to be specified. + * + * Generated from protobuf field string having = 6; + * @return string + */ + public function getHaving() + { + return $this->having; + } + + /** + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `state_change` is supported and + * requires compare_duration to be specified. + * + * Generated from protobuf field string having = 6; + * @param string $var + * @return $this + */ + public function setHaving($var) + { + GPBUtil::checkString($var, True); + $this->having = $var; + + return $this; + } + + /** + * Optional. + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask + */ + public function getFieldMask() + { + return $this->field_mask; + } + + /** + * Optional. + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setFieldMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->field_mask = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field string page_token = 8; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * 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. + * + * Generated from protobuf field string page_token = 8; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * + * Generated from protobuf field int32 page_size = 9; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * + * Generated from protobuf field int32 page_size = 9; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/ListAssetsResponse.php b/SecurityCenter/src/V1p1beta1/ListAssetsResponse.php new file mode 100644 index 000000000000..eb1f775771cb --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/ListAssetsResponse.php @@ -0,0 +1,173 @@ +google.cloud.securitycenter.v1p1beta1.ListAssetsResponse + */ +class ListAssetsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Assets matching the list request. + * + * Generated from protobuf field repeated .google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult list_assets_results = 1; + */ + private $list_assets_results; + /** + * Time used for executing the list request. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 2; + */ + private $read_time = null; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results. + * + * Generated from protobuf field string next_page_token = 3; + */ + private $next_page_token = ''; + /** + * The total number of assets matching the query. + * + * Generated from protobuf field int32 total_size = 4; + */ + private $total_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\SecurityCenter\V1p1beta1\ListAssetsResponse\ListAssetsResult[]|\Google\Protobuf\Internal\RepeatedField $list_assets_results + * Assets matching the list request. + * @type \Google\Protobuf\Timestamp $read_time + * Time used for executing the list request. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results. + * @type int $total_size + * The total number of assets matching the query. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Assets matching the list request. + * + * Generated from protobuf field repeated .google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult list_assets_results = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getListAssetsResults() + { + return $this->list_assets_results; + } + + /** + * Assets matching the list request. + * + * Generated from protobuf field repeated .google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult list_assets_results = 1; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\ListAssetsResponse\ListAssetsResult[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setListAssetsResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\SecurityCenter\V1p1beta1\ListAssetsResponse\ListAssetsResult::class); + $this->list_assets_results = $arr; + + return $this; + } + + /** + * Time used for executing the list request. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 2; + * @return \Google\Protobuf\Timestamp + */ + public function getReadTime() + { + return $this->read_time; + } + + /** + * Time used for executing the list request. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setReadTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->read_time = $var; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results. + * + * Generated from protobuf field string next_page_token = 3; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results. + * + * Generated from protobuf field string next_page_token = 3; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * The total number of assets matching the query. + * + * Generated from protobuf field int32 total_size = 4; + * @return int + */ + public function getTotalSize() + { + return $this->total_size; + } + + /** + * The total number of assets matching the query. + * + * Generated from protobuf field int32 total_size = 4; + * @param int $var + * @return $this + */ + public function setTotalSize($var) + { + GPBUtil::checkInt32($var); + $this->total_size = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/ListAssetsResponse/ListAssetsResult.php b/SecurityCenter/src/V1p1beta1/ListAssetsResponse/ListAssetsResult.php new file mode 100644 index 000000000000..238016396b00 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/ListAssetsResponse/ListAssetsResult.php @@ -0,0 +1,104 @@ +google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult + */ +class ListAssetsResult extends \Google\Protobuf\Internal\Message +{ + /** + * Asset matching the search request. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Asset asset = 1; + */ + private $asset = null; + /** + * State change of the asset between the points in time. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult.StateChange state_change = 2; + */ + private $state_change = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\SecurityCenter\V1p1beta1\Asset $asset + * Asset matching the search request. + * @type int $state_change + * State change of the asset between the points in time. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Asset matching the search request. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Asset asset = 1; + * @return \Google\Cloud\SecurityCenter\V1p1beta1\Asset + */ + public function getAsset() + { + return $this->asset; + } + + /** + * Asset matching the search request. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Asset asset = 1; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\Asset $var + * @return $this + */ + public function setAsset($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\Asset::class); + $this->asset = $var; + + return $this; + } + + /** + * State change of the asset between the points in time. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult.StateChange state_change = 2; + * @return int + */ + public function getStateChange() + { + return $this->state_change; + } + + /** + * State change of the asset between the points in time. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult.StateChange state_change = 2; + * @param int $var + * @return $this + */ + public function setStateChange($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\SecurityCenter\V1p1beta1\ListAssetsResponse_ListAssetsResult_StateChange::class); + $this->state_change = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ListAssetsResult::class, \Google\Cloud\SecurityCenter\V1p1beta1\ListAssetsResponse_ListAssetsResult::class); + diff --git a/SecurityCenter/src/V1p1beta1/ListAssetsResponse/ListAssetsResult/StateChange.php b/SecurityCenter/src/V1p1beta1/ListAssetsResponse/ListAssetsResult/StateChange.php new file mode 100644 index 000000000000..2ef0a7011948 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/ListAssetsResponse/ListAssetsResult/StateChange.php @@ -0,0 +1,75 @@ +google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult.StateChange + */ +class StateChange +{ + /** + * State change is unused, this is the canonical default for this enum. + * + * Generated from protobuf enum UNUSED = 0; + */ + const UNUSED = 0; + /** + * Asset was added between the points in time. + * + * Generated from protobuf enum ADDED = 1; + */ + const ADDED = 1; + /** + * Asset was removed between the points in time. + * + * Generated from protobuf enum REMOVED = 2; + */ + const REMOVED = 2; + /** + * Asset was present at both point(s) in time. + * + * Generated from protobuf enum ACTIVE = 3; + */ + const ACTIVE = 3; + + private static $valueToName = [ + self::UNUSED => 'UNUSED', + self::ADDED => 'ADDED', + self::REMOVED => 'REMOVED', + self::ACTIVE => 'ACTIVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StateChange::class, \Google\Cloud\SecurityCenter\V1p1beta1\ListAssetsResponse_ListAssetsResult_StateChange::class); + diff --git a/SecurityCenter/src/V1p1beta1/ListAssetsResponse_ListAssetsResult.php b/SecurityCenter/src/V1p1beta1/ListAssetsResponse_ListAssetsResult.php new file mode 100644 index 000000000000..e73230560f7d --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/ListAssetsResponse_ListAssetsResult.php @@ -0,0 +1,16 @@ +google.cloud.securitycenter.v1p1beta1.ListFindingsRequest + */ +class ListFindingsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * 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/- + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * 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" + * security_marks.marks: `=`, `:` + * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * For example, `source_properties.size = 100` is a valid filter string. + * + * Generated from protobuf field string filter = 2; + */ + private $filter = ''; + /** + * 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 + * + * Generated from protobuf field string order_by = 3; + */ + private $order_by = ''; + /** + * 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. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 4; + */ + private $read_time = null; + /** + * 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 at the start of + * compare_duration, but changed its state at read_time. + * * "UNCHANGED": indicates that the finding was present at the start of + * compare_duration and did not change state at read_time. + * * "ADDED": indicates that the finding was not present at the start + * of compare_duration, but was present 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. + * + * Generated from protobuf field .google.protobuf.Duration compare_duration = 5; + */ + private $compare_duration = null; + /** + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `finding.state` and `state_change` + * are supported and requires compare_duration to be specified. + * + * Generated from protobuf field string having = 6; + */ + private $having = ''; + /** + * Optional. + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $field_mask = null; + /** + * 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. + * + * Generated from protobuf field string page_token = 8; + */ + private $page_token = ''; + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * + * Generated from protobuf field int32 page_size = 9; + */ + private $page_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $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/- + * @type string $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" + * security_marks.marks: `=`, `:` + * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * For example, `source_properties.size = 100` is a valid filter string. + * @type string $order_by + * 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 + * @type \Google\Protobuf\Timestamp $read_time + * 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. + * @type \Google\Protobuf\Duration $compare_duration + * 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 at the start of + * compare_duration, but changed its state at read_time. + * * "UNCHANGED": indicates that the finding was present at the start of + * compare_duration and did not change state at read_time. + * * "ADDED": indicates that the finding was not present at the start + * of compare_duration, but was present 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. + * @type string $having + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `finding.state` and `state_change` + * are supported and requires compare_duration to be specified. + * @type \Google\Protobuf\FieldMask $field_mask + * Optional. + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @type string $page_token + * 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. + * @type int $page_size + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * 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/- + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->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/- + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * 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" + * security_marks.marks: `=`, `:` + * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * For example, `source_properties.size = 100` is a valid filter string. + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->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" + * security_marks.marks: `=`, `:` + * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * For example, `source_properties.size = 100` is a valid filter string. + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * 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 + * + * Generated from protobuf field string order_by = 3; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * 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 + * + * Generated from protobuf field string order_by = 3; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 4; + * @return \Google\Protobuf\Timestamp + */ + public function getReadTime() + { + return $this->read_time; + } + + /** + * 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. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setReadTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->read_time = $var; + + return $this; + } + + /** + * 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 at the start of + * compare_duration, but changed its state at read_time. + * * "UNCHANGED": indicates that the finding was present at the start of + * compare_duration and did not change state at read_time. + * * "ADDED": indicates that the finding was not present at the start + * of compare_duration, but was present 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. + * + * Generated from protobuf field .google.protobuf.Duration compare_duration = 5; + * @return \Google\Protobuf\Duration + */ + public function getCompareDuration() + { + return $this->compare_duration; + } + + /** + * 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 at the start of + * compare_duration, but changed its state at read_time. + * * "UNCHANGED": indicates that the finding was present at the start of + * compare_duration and did not change state at read_time. + * * "ADDED": indicates that the finding was not present at the start + * of compare_duration, but was present 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. + * + * Generated from protobuf field .google.protobuf.Duration compare_duration = 5; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setCompareDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->compare_duration = $var; + + return $this; + } + + /** + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `finding.state` and `state_change` + * are supported and requires compare_duration to be specified. + * + * Generated from protobuf field string having = 6; + * @return string + */ + public function getHaving() + { + return $this->having; + } + + /** + * Filter that specifies what fields to further filter on *after* the query + * filter has been executed. Currently only `finding.state` and `state_change` + * are supported and requires compare_duration to be specified. + * + * Generated from protobuf field string having = 6; + * @param string $var + * @return $this + */ + public function setHaving($var) + { + GPBUtil::checkString($var, True); + $this->having = $var; + + return $this; + } + + /** + * Optional. + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask + */ + public function getFieldMask() + { + return $this->field_mask; + } + + /** + * Optional. + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setFieldMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->field_mask = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field string page_token = 8; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * 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. + * + * Generated from protobuf field string page_token = 8; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * + * Generated from protobuf field int32 page_size = 9; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * + * Generated from protobuf field int32 page_size = 9; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/ListFindingsResponse.php b/SecurityCenter/src/V1p1beta1/ListFindingsResponse.php new file mode 100644 index 000000000000..6aec03161885 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/ListFindingsResponse.php @@ -0,0 +1,173 @@ +google.cloud.securitycenter.v1p1beta1.ListFindingsResponse + */ +class ListFindingsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Findings matching the list request. + * + * Generated from protobuf field repeated .google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult list_findings_results = 1; + */ + private $list_findings_results; + /** + * Time used for executing the list request. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 2; + */ + private $read_time = null; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results. + * + * Generated from protobuf field string next_page_token = 3; + */ + private $next_page_token = ''; + /** + * The total number of findings matching the query. + * + * Generated from protobuf field int32 total_size = 4; + */ + private $total_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\SecurityCenter\V1p1beta1\ListFindingsResponse\ListFindingsResult[]|\Google\Protobuf\Internal\RepeatedField $list_findings_results + * Findings matching the list request. + * @type \Google\Protobuf\Timestamp $read_time + * Time used for executing the list request. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results. + * @type int $total_size + * The total number of findings matching the query. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Findings matching the list request. + * + * Generated from protobuf field repeated .google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult list_findings_results = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getListFindingsResults() + { + return $this->list_findings_results; + } + + /** + * Findings matching the list request. + * + * Generated from protobuf field repeated .google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult list_findings_results = 1; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\ListFindingsResponse\ListFindingsResult[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setListFindingsResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\SecurityCenter\V1p1beta1\ListFindingsResponse\ListFindingsResult::class); + $this->list_findings_results = $arr; + + return $this; + } + + /** + * Time used for executing the list request. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 2; + * @return \Google\Protobuf\Timestamp + */ + public function getReadTime() + { + return $this->read_time; + } + + /** + * Time used for executing the list request. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setReadTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->read_time = $var; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results. + * + * Generated from protobuf field string next_page_token = 3; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results. + * + * Generated from protobuf field string next_page_token = 3; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * The total number of findings matching the query. + * + * Generated from protobuf field int32 total_size = 4; + * @return int + */ + public function getTotalSize() + { + return $this->total_size; + } + + /** + * The total number of findings matching the query. + * + * Generated from protobuf field int32 total_size = 4; + * @param int $var + * @return $this + */ + public function setTotalSize($var) + { + GPBUtil::checkInt32($var); + $this->total_size = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/ListFindingsResponse/ListFindingsResult.php b/SecurityCenter/src/V1p1beta1/ListFindingsResponse/ListFindingsResult.php new file mode 100644 index 000000000000..21394f630b6c --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/ListFindingsResponse/ListFindingsResult.php @@ -0,0 +1,138 @@ +google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult + */ +class ListFindingsResult extends \Google\Protobuf\Internal\Message +{ + /** + * Finding matching the search request. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Finding finding = 1; + */ + private $finding = null; + /** + * State change of the finding between the points in time. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult.StateChange state_change = 2; + */ + private $state_change = 0; + /** + * Output only. Resource that is associated with this finding. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult.Resource resource = 3; + */ + private $resource = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\SecurityCenter\V1p1beta1\Finding $finding + * Finding matching the search request. + * @type int $state_change + * State change of the finding between the points in time. + * @type \Google\Cloud\SecurityCenter\V1p1beta1\ListFindingsResponse\ListFindingsResult\Resource $resource + * Output only. Resource that is associated with this finding. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Finding matching the search request. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Finding finding = 1; + * @return \Google\Cloud\SecurityCenter\V1p1beta1\Finding + */ + public function getFinding() + { + return $this->finding; + } + + /** + * Finding matching the search request. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Finding finding = 1; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\Finding $var + * @return $this + */ + public function setFinding($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\Finding::class); + $this->finding = $var; + + return $this; + } + + /** + * State change of the finding between the points in time. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult.StateChange state_change = 2; + * @return int + */ + public function getStateChange() + { + return $this->state_change; + } + + /** + * State change of the finding between the points in time. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult.StateChange state_change = 2; + * @param int $var + * @return $this + */ + public function setStateChange($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\SecurityCenter\V1p1beta1\ListFindingsResponse_ListFindingsResult_StateChange::class); + $this->state_change = $var; + + return $this; + } + + /** + * Output only. Resource that is associated with this finding. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult.Resource resource = 3; + * @return \Google\Cloud\SecurityCenter\V1p1beta1\ListFindingsResponse\ListFindingsResult\Resource + */ + public function getResource() + { + return $this->resource; + } + + /** + * Output only. Resource that is associated with this finding. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult.Resource resource = 3; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\ListFindingsResponse\ListFindingsResult\Resource $var + * @return $this + */ + public function setResource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\ListFindingsResponse_ListFindingsResult_Resource::class); + $this->resource = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ListFindingsResult::class, \Google\Cloud\SecurityCenter\V1p1beta1\ListFindingsResponse_ListFindingsResult::class); + diff --git a/SecurityCenter/src/V1p1beta1/ListFindingsResponse/ListFindingsResult/Resource.php b/SecurityCenter/src/V1p1beta1/ListFindingsResponse/ListFindingsResult/Resource.php new file mode 100644 index 000000000000..c8f500fea494 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/ListFindingsResponse/ListFindingsResult/Resource.php @@ -0,0 +1,211 @@ +google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult.Resource + */ +class Resource extends \Google\Protobuf\Internal\Message +{ + /** + * The full resource name of the resource. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * The full resource name of project that the resource belongs to. + * + * Generated from protobuf field string project_name = 2; + */ + private $project_name = ''; + /** + * The human readable name of project that the resource belongs to. + * + * Generated from protobuf field string project_display_name = 3; + */ + private $project_display_name = ''; + /** + * The full resource name of resource's parent. + * + * Generated from protobuf field string parent_name = 4; + */ + private $parent_name = ''; + /** + * The human readable name of resource's parent. + * + * Generated from protobuf field string parent_display_name = 5; + */ + private $parent_display_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The full resource name of the resource. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * @type string $project_name + * The full resource name of project that the resource belongs to. + * @type string $project_display_name + * The human readable name of project that the resource belongs to. + * @type string $parent_name + * The full resource name of resource's parent. + * @type string $parent_display_name + * The human readable name of resource's parent. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * The full resource name of the resource. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The full resource name of the resource. See: + * https://cloud.google.com/apis/design/resource_names#full_resource_name + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The full resource name of project that the resource belongs to. + * + * Generated from protobuf field string project_name = 2; + * @return string + */ + public function getProjectName() + { + return $this->project_name; + } + + /** + * The full resource name of project that the resource belongs to. + * + * Generated from protobuf field string project_name = 2; + * @param string $var + * @return $this + */ + public function setProjectName($var) + { + GPBUtil::checkString($var, True); + $this->project_name = $var; + + return $this; + } + + /** + * The human readable name of project that the resource belongs to. + * + * Generated from protobuf field string project_display_name = 3; + * @return string + */ + public function getProjectDisplayName() + { + return $this->project_display_name; + } + + /** + * The human readable name of project that the resource belongs to. + * + * Generated from protobuf field string project_display_name = 3; + * @param string $var + * @return $this + */ + public function setProjectDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->project_display_name = $var; + + return $this; + } + + /** + * The full resource name of resource's parent. + * + * Generated from protobuf field string parent_name = 4; + * @return string + */ + public function getParentName() + { + return $this->parent_name; + } + + /** + * The full resource name of resource's parent. + * + * Generated from protobuf field string parent_name = 4; + * @param string $var + * @return $this + */ + public function setParentName($var) + { + GPBUtil::checkString($var, True); + $this->parent_name = $var; + + return $this; + } + + /** + * The human readable name of resource's parent. + * + * Generated from protobuf field string parent_display_name = 5; + * @return string + */ + public function getParentDisplayName() + { + return $this->parent_display_name; + } + + /** + * The human readable name of resource's parent. + * + * Generated from protobuf field string parent_display_name = 5; + * @param string $var + * @return $this + */ + public function setParentDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->parent_display_name = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Resource::class, \Google\Cloud\SecurityCenter\V1p1beta1\ListFindingsResponse_ListFindingsResult_Resource::class); + diff --git a/SecurityCenter/src/V1p1beta1/ListFindingsResponse/ListFindingsResult/StateChange.php b/SecurityCenter/src/V1p1beta1/ListFindingsResponse/ListFindingsResult/StateChange.php new file mode 100644 index 000000000000..4f8ad2507ab2 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/ListFindingsResponse/ListFindingsResult/StateChange.php @@ -0,0 +1,87 @@ +google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult.StateChange + */ +class StateChange +{ + /** + * State change is unused, this is the canonical default for this enum. + * + * Generated from protobuf enum UNUSED = 0; + */ + const UNUSED = 0; + /** + * The finding has changed state in some way between the points in time + * and existed at both points. + * + * Generated from protobuf enum CHANGED = 1; + */ + const CHANGED = 1; + /** + * The finding has not changed state between the points in time and + * existed at both points. + * + * Generated from protobuf enum UNCHANGED = 2; + */ + const UNCHANGED = 2; + /** + * The finding was created between the points in time. + * + * Generated from protobuf enum ADDED = 3; + */ + const ADDED = 3; + /** + * The finding at timestamp does not match the filter specified, but it + * did at timestamp - compare_duration. + * + * Generated from protobuf enum REMOVED = 4; + */ + const REMOVED = 4; + + private static $valueToName = [ + self::UNUSED => 'UNUSED', + self::CHANGED => 'CHANGED', + self::UNCHANGED => 'UNCHANGED', + self::ADDED => 'ADDED', + self::REMOVED => 'REMOVED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StateChange::class, \Google\Cloud\SecurityCenter\V1p1beta1\ListFindingsResponse_ListFindingsResult_StateChange::class); + diff --git a/SecurityCenter/src/V1p1beta1/ListFindingsResponse_ListFindingsResult.php b/SecurityCenter/src/V1p1beta1/ListFindingsResponse_ListFindingsResult.php new file mode 100644 index 000000000000..06fa96b34a9a --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/ListFindingsResponse_ListFindingsResult.php @@ -0,0 +1,16 @@ +google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest + */ +class ListNotificationConfigsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the organization to list notification configs. + * Its format is "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * 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. + * + * Generated from protobuf field string page_token = 2; + */ + private $page_token = ''; + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * + * Generated from protobuf field int32 page_size = 3; + */ + private $page_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Name of the organization to list notification configs. + * Its format is "organizations/[organization_id]". + * @type string $page_token + * 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. + * @type int $page_size + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the organization to list notification configs. + * Its format is "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Name of the organization to list notification configs. + * Its format is "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field string page_token = 2; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * 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. + * + * Generated from protobuf field string page_token = 2; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/ListNotificationConfigsResponse.php b/SecurityCenter/src/V1p1beta1/ListNotificationConfigsResponse.php new file mode 100644 index 000000000000..20694a2a3d14 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/ListNotificationConfigsResponse.php @@ -0,0 +1,105 @@ +google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsResponse + */ +class ListNotificationConfigsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Notification configs belonging to the requested parent. + * + * Generated from protobuf field repeated .google.cloud.securitycenter.v1p1beta1.NotificationConfig notification_configs = 1; + */ + private $notification_configs; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results. + * + * Generated from protobuf field string next_page_token = 2; + */ + private $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig[]|\Google\Protobuf\Internal\RepeatedField $notification_configs + * Notification configs belonging to the requested parent. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Notification configs belonging to the requested parent. + * + * Generated from protobuf field repeated .google.cloud.securitycenter.v1p1beta1.NotificationConfig notification_configs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNotificationConfigs() + { + return $this->notification_configs; + } + + /** + * Notification configs belonging to the requested parent. + * + * Generated from protobuf field repeated .google.cloud.securitycenter.v1p1beta1.NotificationConfig notification_configs = 1; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNotificationConfigs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig::class); + $this->notification_configs = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/ListSourcesRequest.php b/SecurityCenter/src/V1p1beta1/ListSourcesRequest.php new file mode 100644 index 000000000000..181af3052368 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/ListSourcesRequest.php @@ -0,0 +1,151 @@ +google.cloud.securitycenter.v1p1beta1.ListSourcesRequest + */ +class ListSourcesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the parent of sources to list. Its format should + * be "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * 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. + * + * Generated from protobuf field string page_token = 2; + */ + private $page_token = ''; + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * + * Generated from protobuf field int32 page_size = 7; + */ + private $page_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Resource name of the parent of sources to list. Its format should + * be "organizations/[organization_id]". + * @type string $page_token + * 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. + * @type int $page_size + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the parent of sources to list. Its format should + * be "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Resource name of the parent of sources to list. Its format should + * be "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field string page_token = 2; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * 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. + * + * Generated from protobuf field string page_token = 2; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * + * Generated from protobuf field int32 page_size = 7; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * + * Generated from protobuf field int32 page_size = 7; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/ListSourcesResponse.php b/SecurityCenter/src/V1p1beta1/ListSourcesResponse.php new file mode 100644 index 000000000000..49bb7f9a42b4 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/ListSourcesResponse.php @@ -0,0 +1,105 @@ +google.cloud.securitycenter.v1p1beta1.ListSourcesResponse + */ +class ListSourcesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Sources belonging to the requested parent. + * + * Generated from protobuf field repeated .google.cloud.securitycenter.v1p1beta1.Source sources = 1; + */ + private $sources; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results. + * + * Generated from protobuf field string next_page_token = 2; + */ + private $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\SecurityCenter\V1p1beta1\Source[]|\Google\Protobuf\Internal\RepeatedField $sources + * Sources belonging to the requested parent. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Sources belonging to the requested parent. + * + * Generated from protobuf field repeated .google.cloud.securitycenter.v1p1beta1.Source sources = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSources() + { + return $this->sources; + } + + /** + * Sources belonging to the requested parent. + * + * Generated from protobuf field repeated .google.cloud.securitycenter.v1p1beta1.Source sources = 1; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\Source[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSources($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\SecurityCenter\V1p1beta1\Source::class); + $this->sources = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/NotificationConfig.php b/SecurityCenter/src/V1p1beta1/NotificationConfig.php new file mode 100644 index 000000000000..b72adb1150b6 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/NotificationConfig.php @@ -0,0 +1,262 @@ +google.cloud.securitycenter.v1p1beta1.NotificationConfig + */ +class NotificationConfig extends \Google\Protobuf\Internal\Message +{ + /** + * 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". + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * The description of the notification config (max of 1024 characters). + * + * Generated from protobuf field string description = 2; + */ + private $description = ''; + /** + * The type of events the config is for, e.g. FINDING. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.NotificationConfig.EventType event_type = 3; + */ + private $event_type = 0; + /** + * The PubSub topic to send notifications to. Its format is + * "projects/[project_id]/topics/[topic]". + * + * Generated from protobuf field string pubsub_topic = 4 [(.google.api.resource_reference) = { + */ + private $pubsub_topic = ''; + /** + * Output only. The service account that needs "pubsub.topics.publish" + * permission to publish to the PubSub topic. + * + * Generated from protobuf field string service_account = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $service_account = ''; + protected $notify_config; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * 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". + * @type string $description + * The description of the notification config (max of 1024 characters). + * @type int $event_type + * The type of events the config is for, e.g. FINDING. + * @type string $pubsub_topic + * The PubSub topic to send notifications to. Its format is + * "projects/[project_id]/topics/[topic]". + * @type string $service_account + * Output only. The service account that needs "pubsub.topics.publish" + * permission to publish to the PubSub topic. + * @type \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig\StreamingConfig $streaming_config + * The config for triggering streaming-based notifications. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\NotificationConfig::initOnce(); + parent::__construct($data); + } + + /** + * 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". + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * 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". + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The description of the notification config (max of 1024 characters). + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The description of the notification config (max of 1024 characters). + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * The type of events the config is for, e.g. FINDING. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.NotificationConfig.EventType event_type = 3; + * @return int + */ + public function getEventType() + { + return $this->event_type; + } + + /** + * The type of events the config is for, e.g. FINDING. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.NotificationConfig.EventType event_type = 3; + * @param int $var + * @return $this + */ + public function setEventType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig_EventType::class); + $this->event_type = $var; + + return $this; + } + + /** + * The PubSub topic to send notifications to. Its format is + * "projects/[project_id]/topics/[topic]". + * + * Generated from protobuf field string pubsub_topic = 4 [(.google.api.resource_reference) = { + * @return string + */ + public function getPubsubTopic() + { + return $this->pubsub_topic; + } + + /** + * The PubSub topic to send notifications to. Its format is + * "projects/[project_id]/topics/[topic]". + * + * Generated from protobuf field string pubsub_topic = 4 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setPubsubTopic($var) + { + GPBUtil::checkString($var, True); + $this->pubsub_topic = $var; + + return $this; + } + + /** + * Output only. The service account that needs "pubsub.topics.publish" + * permission to publish to the PubSub topic. + * + * Generated from protobuf field string service_account = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getServiceAccount() + { + return $this->service_account; + } + + /** + * Output only. The service account that needs "pubsub.topics.publish" + * permission to publish to the PubSub topic. + * + * Generated from protobuf field string service_account = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->service_account = $var; + + return $this; + } + + /** + * The config for triggering streaming-based notifications. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.NotificationConfig.StreamingConfig streaming_config = 6; + * @return \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig\StreamingConfig + */ + public function getStreamingConfig() + { + return $this->readOneof(6); + } + + /** + * The config for triggering streaming-based notifications. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.NotificationConfig.StreamingConfig streaming_config = 6; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig\StreamingConfig $var + * @return $this + */ + public function setStreamingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig_StreamingConfig::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * @return string + */ + public function getNotifyConfig() + { + return $this->whichOneof("notify_config"); + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/NotificationConfig/EventType.php b/SecurityCenter/src/V1p1beta1/NotificationConfig/EventType.php new file mode 100644 index 000000000000..0b27a01f5961 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/NotificationConfig/EventType.php @@ -0,0 +1,57 @@ +google.cloud.securitycenter.v1p1beta1.NotificationConfig.EventType + */ +class EventType +{ + /** + * Unspecified event type. + * + * Generated from protobuf enum EVENT_TYPE_UNSPECIFIED = 0; + */ + const EVENT_TYPE_UNSPECIFIED = 0; + /** + * Events for findings. + * + * Generated from protobuf enum FINDING = 1; + */ + const FINDING = 1; + + private static $valueToName = [ + self::EVENT_TYPE_UNSPECIFIED => 'EVENT_TYPE_UNSPECIFIED', + self::FINDING => 'FINDING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(EventType::class, \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig_EventType::class); + diff --git a/SecurityCenter/src/V1p1beta1/NotificationConfig/StreamingConfig.php b/SecurityCenter/src/V1p1beta1/NotificationConfig/StreamingConfig.php new file mode 100644 index 000000000000..72e3374b24aa --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/NotificationConfig/StreamingConfig.php @@ -0,0 +1,131 @@ +google.cloud.securitycenter.v1p1beta1.NotificationConfig.StreamingConfig + */ +class StreamingConfig extends \Google\Protobuf\Internal\Message +{ + /** + * 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. + * + * Generated from protobuf field string filter = 1; + */ + private $filter = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $filter + * 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. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\NotificationConfig::initOnce(); + parent::__construct($data); + } + + /** + * 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. + * + * Generated from protobuf field string filter = 1; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * 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. + * + * Generated from protobuf field string filter = 1; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StreamingConfig::class, \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig_StreamingConfig::class); + diff --git a/SecurityCenter/src/V1p1beta1/NotificationConfig_EventType.php b/SecurityCenter/src/V1p1beta1/NotificationConfig_EventType.php new file mode 100644 index 000000000000..f60afa30f2a2 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/NotificationConfig_EventType.php @@ -0,0 +1,16 @@ +google.cloud.securitycenter.v1p1beta1.NotificationMessage + */ +class NotificationMessage extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the notification config that generated current notification. + * + * Generated from protobuf field string notification_config_name = 1; + */ + private $notification_config_name = ''; + protected $event; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $notification_config_name + * Name of the notification config that generated current notification. + * @type \Google\Cloud\SecurityCenter\V1p1beta1\Finding $finding + * If it's a Finding based notification config, this field will be + * populated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\NotificationMessage::initOnce(); + parent::__construct($data); + } + + /** + * Name of the notification config that generated current notification. + * + * Generated from protobuf field string notification_config_name = 1; + * @return string + */ + public function getNotificationConfigName() + { + return $this->notification_config_name; + } + + /** + * Name of the notification config that generated current notification. + * + * Generated from protobuf field string notification_config_name = 1; + * @param string $var + * @return $this + */ + public function setNotificationConfigName($var) + { + GPBUtil::checkString($var, True); + $this->notification_config_name = $var; + + return $this; + } + + /** + * If it's a Finding based notification config, this field will be + * populated. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Finding finding = 2; + * @return \Google\Cloud\SecurityCenter\V1p1beta1\Finding + */ + public function getFinding() + { + return $this->readOneof(2); + } + + /** + * If it's a Finding based notification config, this field will be + * populated. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Finding finding = 2; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\Finding $var + * @return $this + */ + public function setFinding($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\Finding::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getEvent() + { + return $this->whichOneof("event"); + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/OrganizationSettings.php b/SecurityCenter/src/V1p1beta1/OrganizationSettings.php new file mode 100644 index 000000000000..7b0a0e0d7609 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/OrganizationSettings.php @@ -0,0 +1,160 @@ +google.cloud.securitycenter.v1p1beta1.OrganizationSettings + */ +class OrganizationSettings extends \Google\Protobuf\Internal\Message +{ + /** + * The relative resource name of the settings. See: + * https://cloud.google.com/apis/design/resource_names#relative_resource_name + * Example: + * "organizations/{organization_id}/organizationSettings". + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * 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. + * + * Generated from protobuf field bool enable_asset_discovery = 2; + */ + private $enable_asset_discovery = false; + /** + * The configuration used for Asset Discovery runs. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.OrganizationSettings.AssetDiscoveryConfig asset_discovery_config = 3; + */ + private $asset_discovery_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The relative resource name of the settings. See: + * https://cloud.google.com/apis/design/resource_names#relative_resource_name + * Example: + * "organizations/{organization_id}/organizationSettings". + * @type bool $enable_asset_discovery + * 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. + * @type \Google\Cloud\SecurityCenter\V1p1beta1\OrganizationSettings\AssetDiscoveryConfig $asset_discovery_config + * The configuration used for Asset Discovery runs. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\OrganizationSettings::initOnce(); + parent::__construct($data); + } + + /** + * The relative resource name of the settings. See: + * https://cloud.google.com/apis/design/resource_names#relative_resource_name + * Example: + * "organizations/{organization_id}/organizationSettings". + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The relative resource name of the settings. See: + * https://cloud.google.com/apis/design/resource_names#relative_resource_name + * Example: + * "organizations/{organization_id}/organizationSettings". + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field bool enable_asset_discovery = 2; + * @return bool + */ + public function getEnableAssetDiscovery() + { + return $this->enable_asset_discovery; + } + + /** + * 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. + * + * Generated from protobuf field bool enable_asset_discovery = 2; + * @param bool $var + * @return $this + */ + public function setEnableAssetDiscovery($var) + { + GPBUtil::checkBool($var); + $this->enable_asset_discovery = $var; + + return $this; + } + + /** + * The configuration used for Asset Discovery runs. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.OrganizationSettings.AssetDiscoveryConfig asset_discovery_config = 3; + * @return \Google\Cloud\SecurityCenter\V1p1beta1\OrganizationSettings\AssetDiscoveryConfig + */ + public function getAssetDiscoveryConfig() + { + return $this->asset_discovery_config; + } + + /** + * The configuration used for Asset Discovery runs. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.OrganizationSettings.AssetDiscoveryConfig asset_discovery_config = 3; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\OrganizationSettings\AssetDiscoveryConfig $var + * @return $this + */ + public function setAssetDiscoveryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\OrganizationSettings_AssetDiscoveryConfig::class); + $this->asset_discovery_config = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/OrganizationSettings/AssetDiscoveryConfig.php b/SecurityCenter/src/V1p1beta1/OrganizationSettings/AssetDiscoveryConfig.php new file mode 100644 index 000000000000..192058c4eaa5 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/OrganizationSettings/AssetDiscoveryConfig.php @@ -0,0 +1,104 @@ +google.cloud.securitycenter.v1p1beta1.OrganizationSettings.AssetDiscoveryConfig + */ +class AssetDiscoveryConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The project ids to use for filtering asset discovery. + * + * Generated from protobuf field repeated string project_ids = 1; + */ + private $project_ids; + /** + * The mode to use for filtering asset discovery. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.OrganizationSettings.AssetDiscoveryConfig.InclusionMode inclusion_mode = 2; + */ + private $inclusion_mode = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string[]|\Google\Protobuf\Internal\RepeatedField $project_ids + * The project ids to use for filtering asset discovery. + * @type int $inclusion_mode + * The mode to use for filtering asset discovery. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\OrganizationSettings::initOnce(); + parent::__construct($data); + } + + /** + * The project ids to use for filtering asset discovery. + * + * Generated from protobuf field repeated string project_ids = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProjectIds() + { + return $this->project_ids; + } + + /** + * The project ids to use for filtering asset discovery. + * + * Generated from protobuf field repeated string project_ids = 1; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProjectIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->project_ids = $arr; + + return $this; + } + + /** + * The mode to use for filtering asset discovery. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.OrganizationSettings.AssetDiscoveryConfig.InclusionMode inclusion_mode = 2; + * @return int + */ + public function getInclusionMode() + { + return $this->inclusion_mode; + } + + /** + * The mode to use for filtering asset discovery. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.OrganizationSettings.AssetDiscoveryConfig.InclusionMode inclusion_mode = 2; + * @param int $var + * @return $this + */ + public function setInclusionMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\SecurityCenter\V1p1beta1\OrganizationSettings_AssetDiscoveryConfig_InclusionMode::class); + $this->inclusion_mode = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AssetDiscoveryConfig::class, \Google\Cloud\SecurityCenter\V1p1beta1\OrganizationSettings_AssetDiscoveryConfig::class); + diff --git a/SecurityCenter/src/V1p1beta1/OrganizationSettings/AssetDiscoveryConfig/InclusionMode.php b/SecurityCenter/src/V1p1beta1/OrganizationSettings/AssetDiscoveryConfig/InclusionMode.php new file mode 100644 index 000000000000..2e218d0692dc --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/OrganizationSettings/AssetDiscoveryConfig/InclusionMode.php @@ -0,0 +1,74 @@ +google.cloud.securitycenter.v1p1beta1.OrganizationSettings.AssetDiscoveryConfig.InclusionMode + */ +class InclusionMode +{ + /** + * Unspecified. Setting the mode with this value will disable + * inclusion/exclusion filtering for Asset Discovery. + * + * Generated from protobuf enum INCLUSION_MODE_UNSPECIFIED = 0; + */ + const INCLUSION_MODE_UNSPECIFIED = 0; + /** + * Asset Discovery will capture only the resources within the projects + * specified. All other resources will be ignored. + * + * Generated from protobuf enum INCLUDE_ONLY = 1; + */ + const INCLUDE_ONLY = 1; + /** + * Asset Discovery will ignore all resources under the projects specified. + * All other resources will be retrieved. + * + * Generated from protobuf enum EXCLUDE = 2; + */ + const EXCLUDE = 2; + + private static $valueToName = [ + self::INCLUSION_MODE_UNSPECIFIED => 'INCLUSION_MODE_UNSPECIFIED', + self::INCLUDE_ONLY => 'INCLUDE_ONLY', + self::EXCLUDE => 'EXCLUDE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(InclusionMode::class, \Google\Cloud\SecurityCenter\V1p1beta1\OrganizationSettings_AssetDiscoveryConfig_InclusionMode::class); + diff --git a/SecurityCenter/src/V1p1beta1/OrganizationSettings_AssetDiscoveryConfig.php b/SecurityCenter/src/V1p1beta1/OrganizationSettings_AssetDiscoveryConfig.php new file mode 100644 index 000000000000..08f101a82d68 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/OrganizationSettings_AssetDiscoveryConfig.php @@ -0,0 +1,16 @@ + SecurityCenterClient::sourceName('[YOUR ORGANIZATION]', '[YOUR SOURCE]'), + 'displayName' => '[YOUR SOURCE]' +]); + +$res = $security->createSource($parent, $source); +``` diff --git a/SecurityCenter/src/V1p1beta1/RunAssetDiscoveryRequest.php b/SecurityCenter/src/V1p1beta1/RunAssetDiscoveryRequest.php new file mode 100644 index 000000000000..d8a1300fef82 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/RunAssetDiscoveryRequest.php @@ -0,0 +1,71 @@ +google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest + */ +class RunAssetDiscoveryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the organization to run asset discovery for. Its format + * is "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Name of the organization to run asset discovery for. Its format + * is "organizations/[organization_id]". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the organization to run asset discovery for. Its format + * is "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Name of the organization to run asset discovery for. Its format + * is "organizations/[organization_id]". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/RunAssetDiscoveryResponse.php b/SecurityCenter/src/V1p1beta1/RunAssetDiscoveryResponse.php new file mode 100644 index 000000000000..d1725e082e36 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/RunAssetDiscoveryResponse.php @@ -0,0 +1,101 @@ +google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryResponse + */ +class RunAssetDiscoveryResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The state of an asset discovery run. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryResponse.State state = 1; + */ + private $state = 0; + /** + * The duration between asset discovery run start and end + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + */ + private $duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The state of an asset discovery run. + * @type \Google\Protobuf\Duration $duration + * The duration between asset discovery run start and end + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\RunAssetDiscoveryResponse::initOnce(); + parent::__construct($data); + } + + /** + * The state of an asset discovery run. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryResponse.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of an asset discovery run. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryResponse.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\SecurityCenter\V1p1beta1\RunAssetDiscoveryResponse_State::class); + $this->state = $var; + + return $this; + } + + /** + * The duration between asset discovery run start and end + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + * @return \Google\Protobuf\Duration + */ + public function getDuration() + { + return $this->duration; + } + + /** + * The duration between asset discovery run start and end + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/RunAssetDiscoveryResponse/State.php b/SecurityCenter/src/V1p1beta1/RunAssetDiscoveryResponse/State.php new file mode 100644 index 000000000000..ca26f2bcbecd --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/RunAssetDiscoveryResponse/State.php @@ -0,0 +1,72 @@ +google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryResponse.State + */ +class State +{ + /** + * Asset discovery run state was unspecified. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Asset discovery run completed successfully. + * + * Generated from protobuf enum COMPLETED = 1; + */ + const COMPLETED = 1; + /** + * Asset discovery run was cancelled with tasks still pending, as another + * run for the same organization was started with a higher priority. + * + * Generated from protobuf enum SUPERSEDED = 2; + */ + const SUPERSEDED = 2; + /** + * Asset discovery run was killed and terminated. + * + * Generated from protobuf enum TERMINATED = 3; + */ + const TERMINATED = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::COMPLETED => 'COMPLETED', + self::SUPERSEDED => 'SUPERSEDED', + self::TERMINATED => 'TERMINATED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\SecurityCenter\V1p1beta1\RunAssetDiscoveryResponse_State::class); + diff --git a/SecurityCenter/src/V1p1beta1/RunAssetDiscoveryResponse_State.php b/SecurityCenter/src/V1p1beta1/RunAssetDiscoveryResponse_State.php new file mode 100644 index 000000000000..4e86b5fd953f --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/RunAssetDiscoveryResponse_State.php @@ -0,0 +1,16 @@ +_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/CreateSource', + $argument, + ['\Google\Cloud\SecurityCenter\V1p1beta1\Source', 'decode'], + $metadata, $options); + } + + /** + * + * Creates a finding. The corresponding source must exist for finding + * creation to succeed. + * @param \Google\Cloud\SecurityCenter\V1p1beta1\CreateFindingRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function CreateFinding(\Google\Cloud\SecurityCenter\V1p1beta1\CreateFindingRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/CreateFinding', + $argument, + ['\Google\Cloud\SecurityCenter\V1p1beta1\Finding', 'decode'], + $metadata, $options); + } + + /** + * Creates a notification config. + * @param \Google\Cloud\SecurityCenter\V1p1beta1\CreateNotificationConfigRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function CreateNotificationConfig(\Google\Cloud\SecurityCenter\V1p1beta1\CreateNotificationConfigRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/CreateNotificationConfig', + $argument, + ['\Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig', 'decode'], + $metadata, $options); + } + + /** + * Deletes a notification config. + * @param \Google\Cloud\SecurityCenter\V1p1beta1\DeleteNotificationConfigRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function DeleteNotificationConfig(\Google\Cloud\SecurityCenter\V1p1beta1\DeleteNotificationConfigRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/DeleteNotificationConfig', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Gets the access control policy on the specified Source. + * @param \Google\Cloud\Iam\V1\GetIamPolicyRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function GetIamPolicy(\Google\Cloud\Iam\V1\GetIamPolicyRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/GetIamPolicy', + $argument, + ['\Google\Cloud\Iam\V1\Policy', 'decode'], + $metadata, $options); + } + + /** + * Gets a notification config. + * @param \Google\Cloud\SecurityCenter\V1p1beta1\GetNotificationConfigRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function GetNotificationConfig(\Google\Cloud\SecurityCenter\V1p1beta1\GetNotificationConfigRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/GetNotificationConfig', + $argument, + ['\Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig', 'decode'], + $metadata, $options); + } + + /** + * Gets the settings for an organization. + * @param \Google\Cloud\SecurityCenter\V1p1beta1\GetOrganizationSettingsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function GetOrganizationSettings(\Google\Cloud\SecurityCenter\V1p1beta1\GetOrganizationSettingsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/GetOrganizationSettings', + $argument, + ['\Google\Cloud\SecurityCenter\V1p1beta1\OrganizationSettings', 'decode'], + $metadata, $options); + } + + /** + * Gets a source. + * @param \Google\Cloud\SecurityCenter\V1p1beta1\GetSourceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function GetSource(\Google\Cloud\SecurityCenter\V1p1beta1\GetSourceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/GetSource', + $argument, + ['\Google\Cloud\SecurityCenter\V1p1beta1\Source', 'decode'], + $metadata, $options); + } + + /** + * Filters an organization's assets and groups them by their specified + * properties. + * @param \Google\Cloud\SecurityCenter\V1p1beta1\GroupAssetsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function GroupAssets(\Google\Cloud\SecurityCenter\V1p1beta1\GroupAssetsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/GroupAssets', + $argument, + ['\Google\Cloud\SecurityCenter\V1p1beta1\GroupAssetsResponse', 'decode'], + $metadata, $options); + } + + /** + * 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: /v1p1beta1/organizations/{organization_id}/sources/-/findings + * @param \Google\Cloud\SecurityCenter\V1p1beta1\GroupFindingsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function GroupFindings(\Google\Cloud\SecurityCenter\V1p1beta1\GroupFindingsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/GroupFindings', + $argument, + ['\Google\Cloud\SecurityCenter\V1p1beta1\GroupFindingsResponse', 'decode'], + $metadata, $options); + } + + /** + * Lists an organization's assets. + * @param \Google\Cloud\SecurityCenter\V1p1beta1\ListAssetsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function ListAssets(\Google\Cloud\SecurityCenter\V1p1beta1\ListAssetsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/ListAssets', + $argument, + ['\Google\Cloud\SecurityCenter\V1p1beta1\ListAssetsResponse', 'decode'], + $metadata, $options); + } + + /** + * 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 \Google\Cloud\SecurityCenter\V1p1beta1\ListFindingsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function ListFindings(\Google\Cloud\SecurityCenter\V1p1beta1\ListFindingsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/ListFindings', + $argument, + ['\Google\Cloud\SecurityCenter\V1p1beta1\ListFindingsResponse', 'decode'], + $metadata, $options); + } + + /** + * Lists notification configs. + * @param \Google\Cloud\SecurityCenter\V1p1beta1\ListNotificationConfigsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function ListNotificationConfigs(\Google\Cloud\SecurityCenter\V1p1beta1\ListNotificationConfigsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/ListNotificationConfigs', + $argument, + ['\Google\Cloud\SecurityCenter\V1p1beta1\ListNotificationConfigsResponse', 'decode'], + $metadata, $options); + } + + /** + * Lists all sources belonging to an organization. + * @param \Google\Cloud\SecurityCenter\V1p1beta1\ListSourcesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function ListSources(\Google\Cloud\SecurityCenter\V1p1beta1\ListSourcesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/ListSources', + $argument, + ['\Google\Cloud\SecurityCenter\V1p1beta1\ListSourcesResponse', 'decode'], + $metadata, $options); + } + + /** + * 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 \Google\Cloud\SecurityCenter\V1p1beta1\RunAssetDiscoveryRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function RunAssetDiscovery(\Google\Cloud\SecurityCenter\V1p1beta1\RunAssetDiscoveryRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/RunAssetDiscovery', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * + * Updates the state of a finding. + * @param \Google\Cloud\SecurityCenter\V1p1beta1\SetFindingStateRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function SetFindingState(\Google\Cloud\SecurityCenter\V1p1beta1\SetFindingStateRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/SetFindingState', + $argument, + ['\Google\Cloud\SecurityCenter\V1p1beta1\Finding', 'decode'], + $metadata, $options); + } + + /** + * Sets the access control policy on the specified Source. + * @param \Google\Cloud\Iam\V1\SetIamPolicyRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function SetIamPolicy(\Google\Cloud\Iam\V1\SetIamPolicyRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/SetIamPolicy', + $argument, + ['\Google\Cloud\Iam\V1\Policy', 'decode'], + $metadata, $options); + } + + /** + * Returns the permissions that a caller has on the specified source. + * @param \Google\Cloud\Iam\V1\TestIamPermissionsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function TestIamPermissions(\Google\Cloud\Iam\V1\TestIamPermissionsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/TestIamPermissions', + $argument, + ['\Google\Cloud\Iam\V1\TestIamPermissionsResponse', 'decode'], + $metadata, $options); + } + + /** + * + * Creates or updates a finding. The corresponding source must exist for a + * finding creation to succeed. + * @param \Google\Cloud\SecurityCenter\V1p1beta1\UpdateFindingRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function UpdateFinding(\Google\Cloud\SecurityCenter\V1p1beta1\UpdateFindingRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/UpdateFinding', + $argument, + ['\Google\Cloud\SecurityCenter\V1p1beta1\Finding', 'decode'], + $metadata, $options); + } + + /** + * Updates a notification config. + * @param \Google\Cloud\SecurityCenter\V1p1beta1\UpdateNotificationConfigRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function UpdateNotificationConfig(\Google\Cloud\SecurityCenter\V1p1beta1\UpdateNotificationConfigRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/UpdateNotificationConfig', + $argument, + ['\Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig', 'decode'], + $metadata, $options); + } + + /** + * Updates an organization's settings. + * @param \Google\Cloud\SecurityCenter\V1p1beta1\UpdateOrganizationSettingsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function UpdateOrganizationSettings(\Google\Cloud\SecurityCenter\V1p1beta1\UpdateOrganizationSettingsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/UpdateOrganizationSettings', + $argument, + ['\Google\Cloud\SecurityCenter\V1p1beta1\OrganizationSettings', 'decode'], + $metadata, $options); + } + + /** + * Updates a source. + * @param \Google\Cloud\SecurityCenter\V1p1beta1\UpdateSourceRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function UpdateSource(\Google\Cloud\SecurityCenter\V1p1beta1\UpdateSourceRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/UpdateSource', + $argument, + ['\Google\Cloud\SecurityCenter\V1p1beta1\Source', 'decode'], + $metadata, $options); + } + + /** + * Updates security marks. + * @param \Google\Cloud\SecurityCenter\V1p1beta1\UpdateSecurityMarksRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function UpdateSecurityMarks(\Google\Cloud\SecurityCenter\V1p1beta1\UpdateSecurityMarksRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/UpdateSecurityMarks', + $argument, + ['\Google\Cloud\SecurityCenter\V1p1beta1\SecurityMarks', 'decode'], + $metadata, $options); + } + +} diff --git a/SecurityCenter/src/V1p1beta1/SecurityMarks.php b/SecurityCenter/src/V1p1beta1/SecurityMarks.php new file mode 100644 index 000000000000..51e8f9e7edda --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/SecurityMarks.php @@ -0,0 +1,144 @@ +google.cloud.securitycenter.v1p1beta1.SecurityMarks + */ +class SecurityMarks extends \Google\Protobuf\Internal\Message +{ + /** + * 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". + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * 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) + * + * Generated from protobuf field map marks = 2; + */ + private $marks; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * 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". + * @type array|\Google\Protobuf\Internal\MapField $marks + * 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) + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecurityMarks::initOnce(); + parent::__construct($data); + } + + /** + * 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". + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * 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". + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * 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) + * + * Generated from protobuf field map marks = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getMarks() + { + return $this->marks; + } + + /** + * 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) + * + * Generated from protobuf field map marks = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setMarks($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->marks = $arr; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/SetFindingStateRequest.php b/SecurityCenter/src/V1p1beta1/SetFindingStateRequest.php new file mode 100644 index 000000000000..9e5beb57beb2 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/SetFindingStateRequest.php @@ -0,0 +1,147 @@ +google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest + */ +class SetFindingStateRequest extends \Google\Protobuf\Internal\Message +{ + /** + * 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}". + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + /** + * Required. The desired State of the finding. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Finding.State state = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $state = 0; + /** + * Required. The time at which the updated state takes effect. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $start_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $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}". + * @type int $state + * Required. The desired State of the finding. + * @type \Google\Protobuf\Timestamp $start_time + * Required. The time at which the updated state takes effect. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * 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}". + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->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}". + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The desired State of the finding. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Finding.State state = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Required. The desired State of the finding. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Finding.State state = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\SecurityCenter\V1p1beta1\Finding_State::class); + $this->state = $var; + + return $this; + } + + /** + * Required. The time at which the updated state takes effect. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Timestamp + */ + public function getStartTime() + { + return $this->start_time; + } + + /** + * Required. The time at which the updated state takes effect. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/Source.php b/SecurityCenter/src/V1p1beta1/Source.php new file mode 100644 index 000000000000..b7f4f0a84451 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/Source.php @@ -0,0 +1,189 @@ +google.cloud.securitycenter.v1p1beta1.Source + */ +class Source extends \Google\Protobuf\Internal\Message +{ + /** + * 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}" + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * 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). + * + * Generated from protobuf field string display_name = 2; + */ + private $display_name = ''; + /** + * The description of the source (max of 1024 characters). + * Example: + * "Cloud 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." + * + * Generated from protobuf field string description = 3; + */ + private $description = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * 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}" + * @type string $display_name + * 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). + * @type string $description + * The description of the source (max of 1024 characters). + * Example: + * "Cloud 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." + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\Source::initOnce(); + parent::__construct($data); + } + + /** + * 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}" + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * 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}" + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * 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). + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * 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). + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The description of the source (max of 1024 characters). + * Example: + * "Cloud 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." + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The description of the source (max of 1024 characters). + * Example: + * "Cloud 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." + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/UpdateFindingRequest.php b/SecurityCenter/src/V1p1beta1/UpdateFindingRequest.php new file mode 100644 index 000000000000..cc195056398a --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/UpdateFindingRequest.php @@ -0,0 +1,137 @@ +google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest + */ +class UpdateFindingRequest extends \Google\Protobuf\Internal\Message +{ + /** + * 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. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Finding finding = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $finding = null; + /** + * 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. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + private $update_mask = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\SecurityCenter\V1p1beta1\Finding $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. + * @type \Google\Protobuf\FieldMask $update_mask + * 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. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * 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. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Finding finding = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\SecurityCenter\V1p1beta1\Finding + */ + public function getFinding() + { + return $this->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. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Finding finding = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\Finding $var + * @return $this + */ + public function setFinding($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\Finding::class); + $this->finding = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + /** + * 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. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/UpdateNotificationConfigRequest.php b/SecurityCenter/src/V1p1beta1/UpdateNotificationConfigRequest.php new file mode 100644 index 000000000000..15b67b4c1efc --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/UpdateNotificationConfigRequest.php @@ -0,0 +1,105 @@ +google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest + */ +class UpdateNotificationConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The notification config to update. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.NotificationConfig notification_config = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $notification_config = null; + /** + * The FieldMask to use when updating the notification config. + * If empty all mutable fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + private $update_mask = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig $notification_config + * Required. The notification config to update. + * @type \Google\Protobuf\FieldMask $update_mask + * The FieldMask to use when updating the notification config. + * If empty all mutable fields will be updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The notification config to update. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.NotificationConfig notification_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig + */ + public function getNotificationConfig() + { + return $this->notification_config; + } + + /** + * Required. The notification config to update. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.NotificationConfig notification_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig $var + * @return $this + */ + public function setNotificationConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\NotificationConfig::class); + $this->notification_config = $var; + + return $this; + } + + /** + * The FieldMask to use when updating the notification config. + * If empty all mutable fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + /** + * The FieldMask to use when updating the notification config. + * If empty all mutable fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/UpdateOrganizationSettingsRequest.php b/SecurityCenter/src/V1p1beta1/UpdateOrganizationSettingsRequest.php new file mode 100644 index 000000000000..3085ace6eccd --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/UpdateOrganizationSettingsRequest.php @@ -0,0 +1,105 @@ +google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest + */ +class UpdateOrganizationSettingsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The organization settings resource to update. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.OrganizationSettings organization_settings = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $organization_settings = null; + /** + * The FieldMask to use when updating the settings resource. + * If empty all mutable fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + private $update_mask = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\SecurityCenter\V1p1beta1\OrganizationSettings $organization_settings + * Required. The organization settings resource to update. + * @type \Google\Protobuf\FieldMask $update_mask + * The FieldMask to use when updating the settings resource. + * If empty all mutable fields will be updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The organization settings resource to update. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.OrganizationSettings organization_settings = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\SecurityCenter\V1p1beta1\OrganizationSettings + */ + public function getOrganizationSettings() + { + return $this->organization_settings; + } + + /** + * Required. The organization settings resource to update. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.OrganizationSettings organization_settings = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\OrganizationSettings $var + * @return $this + */ + public function setOrganizationSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\OrganizationSettings::class); + $this->organization_settings = $var; + + return $this; + } + + /** + * The FieldMask to use when updating the settings resource. + * If empty all mutable fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + /** + * The FieldMask to use when updating the settings resource. + * If empty all mutable fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/UpdateSecurityMarksRequest.php b/SecurityCenter/src/V1p1beta1/UpdateSecurityMarksRequest.php new file mode 100644 index 000000000000..975aefd90103 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/UpdateSecurityMarksRequest.php @@ -0,0 +1,155 @@ +google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest + */ +class UpdateSecurityMarksRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The security marks resource to update. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.SecurityMarks security_marks = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $security_marks = null; + /** + * 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.". + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + private $update_mask = null; + /** + * 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. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 3; + */ + private $start_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\SecurityCenter\V1p1beta1\SecurityMarks $security_marks + * Required. The security marks resource to update. + * @type \Google\Protobuf\FieldMask $update_mask + * 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.". + * @type \Google\Protobuf\Timestamp $start_time + * 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. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The security marks resource to update. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.SecurityMarks security_marks = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\SecurityCenter\V1p1beta1\SecurityMarks + */ + public function getSecurityMarks() + { + return $this->security_marks; + } + + /** + * Required. The security marks resource to update. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.SecurityMarks security_marks = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\SecurityMarks $var + * @return $this + */ + public function setSecurityMarks($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\SecurityMarks::class); + $this->security_marks = $var; + + return $this; + } + + /** + * 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.". + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + /** + * 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.". + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 3; + * @return \Google\Protobuf\Timestamp + */ + public function getStartTime() + { + return $this->start_time; + } + + /** + * 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. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/UpdateSourceRequest.php b/SecurityCenter/src/V1p1beta1/UpdateSourceRequest.php new file mode 100644 index 000000000000..13c2325a9137 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/UpdateSourceRequest.php @@ -0,0 +1,105 @@ +google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest + */ +class UpdateSourceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The source resource to update. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Source source = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $source = null; + /** + * The FieldMask to use when updating the source resource. + * If empty all mutable fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + private $update_mask = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\SecurityCenter\V1p1beta1\Source $source + * Required. The source resource to update. + * @type \Google\Protobuf\FieldMask $update_mask + * The FieldMask to use when updating the source resource. + * If empty all mutable fields will be updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\SecuritycenterService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The source resource to update. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Source source = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\SecurityCenter\V1p1beta1\Source + */ + public function getSource() + { + return $this->source; + } + + /** + * Required. The source resource to update. + * + * Generated from protobuf field .google.cloud.securitycenter.v1p1beta1.Source source = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\SecurityCenter\V1p1beta1\Source $var + * @return $this + */ + public function setSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\Source::class); + $this->source = $var; + + return $this; + } + + /** + * The FieldMask to use when updating the source resource. + * If empty all mutable fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + /** + * The FieldMask to use when updating the source resource. + * If empty all mutable fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/SecurityCenter/src/V1p1beta1/resources/security_center_client_config.json b/SecurityCenter/src/V1p1beta1/resources/security_center_client_config.json new file mode 100644 index 000000000000..4157f9ff6c2d --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/resources/security_center_client_config.json @@ -0,0 +1,141 @@ +{ + "interfaces": { + "google.cloud.securitycenter.v1p1beta1.SecurityCenter": { + "retry_codes": { + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "non_idempotent": [] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 20000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 20000, + "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": "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" + }, + "GetSource": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GroupAssets": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GroupFindings": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListAssets": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindings": { + "timeout_millis": 60000, + "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": "non_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": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/SecurityCenter/src/V1p1beta1/resources/security_center_descriptor_config.php b/SecurityCenter/src/V1p1beta1/resources/security_center_descriptor_config.php new file mode 100644 index 000000000000..226c4dc027e9 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/resources/security_center_descriptor_config.php @@ -0,0 +1,78 @@ + [ + 'google.cloud.securitycenter.v1p1beta1.SecurityCenter' => [ + 'RunAssetDiscovery' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\SecurityCenter\V1p1beta1\RunAssetDiscoveryResponse', + 'metadataReturnType' => '\Google\Protobuf\GPBEmpty', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'GroupAssets' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getGroupByResults', + ], + ], + 'GroupFindings' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getGroupByResults', + ], + ], + 'ListAssets' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getListAssetsResults', + ], + ], + 'ListFindings' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getListFindingsResults', + ], + ], + 'ListNotificationConfigs' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getNotificationConfigs', + ], + ], + 'ListSources' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSources', + ], + ], + ], + ], +]; diff --git a/SecurityCenter/src/V1p1beta1/resources/security_center_rest_client_config.php b/SecurityCenter/src/V1p1beta1/resources/security_center_rest_client_config.php new file mode 100644 index 000000000000..cf8b1d981380 --- /dev/null +++ b/SecurityCenter/src/V1p1beta1/resources/security_center_rest_client_config.php @@ -0,0 +1,335 @@ + [ + 'google.cloud.securitycenter.v1p1beta1.SecurityCenter' => [ + 'CreateSource' => [ + 'method' => 'post', + 'uriTemplate' => '/v1p1beta1/{parent=organizations/*}/sources', + 'body' => 'source', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateFinding' => [ + 'method' => 'post', + 'uriTemplate' => '/v1p1beta1/{parent=organizations/*/sources/*}/findings', + 'body' => 'finding', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateNotificationConfig' => [ + 'method' => 'post', + 'uriTemplate' => '/v1p1beta1/{parent=organizations/*}/notificationConfigs', + 'body' => 'notification_config', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteNotificationConfig' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1p1beta1/{name=organizations/*/notificationConfigs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1p1beta1/{resource=organizations/*/sources/*}:getIamPolicy', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'GetNotificationConfig' => [ + 'method' => 'get', + 'uriTemplate' => '/v1p1beta1/{name=organizations/*/notificationConfigs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOrganizationSettings' => [ + 'method' => 'get', + 'uriTemplate' => '/v1p1beta1/{name=organizations/*/organizationSettings}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetSource' => [ + 'method' => 'get', + 'uriTemplate' => '/v1p1beta1/{name=organizations/*/sources/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GroupAssets' => [ + 'method' => 'post', + 'uriTemplate' => '/v1p1beta1/{parent=organizations/*}/assets:group', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GroupFindings' => [ + 'method' => 'post', + 'uriTemplate' => '/v1p1beta1/{parent=organizations/*/sources/*}/findings:group', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListAssets' => [ + 'method' => 'get', + 'uriTemplate' => '/v1p1beta1/{parent=organizations/*}/assets', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListFindings' => [ + 'method' => 'get', + 'uriTemplate' => '/v1p1beta1/{parent=organizations/*/sources/*}/findings', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListNotificationConfigs' => [ + 'method' => 'get', + 'uriTemplate' => '/v1p1beta1/{parent=organizations/*}/notificationConfigs', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListSources' => [ + 'method' => 'get', + 'uriTemplate' => '/v1p1beta1/{parent=organizations/*}/sources', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'RunAssetDiscovery' => [ + 'method' => 'post', + 'uriTemplate' => '/v1p1beta1/{parent=organizations/*}/assets:runDiscovery', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'SetFindingState' => [ + 'method' => 'post', + 'uriTemplate' => '/v1p1beta1/{name=organizations/*/sources/*/findings/*}:setState', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1p1beta1/{resource=organizations/*/sources/*}:setIamPolicy', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1p1beta1/{resource=organizations/*/sources/*}:testIamPermissions', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'UpdateFinding' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1p1beta1/{finding.name=organizations/*/sources/*/findings/*}', + 'body' => 'finding', + 'placeholders' => [ + 'finding.name' => [ + 'getters' => [ + 'getFinding', + 'getName', + ], + ], + ], + ], + 'UpdateNotificationConfig' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1p1beta1/{notification_config.name=organizations/*/notificationConfigs/*}', + 'body' => 'notification_config', + 'placeholders' => [ + 'notification_config.name' => [ + 'getters' => [ + 'getNotificationConfig', + 'getName', + ], + ], + ], + ], + 'UpdateOrganizationSettings' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1p1beta1/{organization_settings.name=organizations/*/organizationSettings}', + 'body' => 'organization_settings', + 'placeholders' => [ + 'organization_settings.name' => [ + 'getters' => [ + 'getOrganizationSettings', + 'getName', + ], + ], + ], + ], + 'UpdateSource' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1p1beta1/{source.name=organizations/*/sources/*}', + 'body' => 'source', + 'placeholders' => [ + 'source.name' => [ + 'getters' => [ + 'getSource', + 'getName', + ], + ], + ], + ], + 'UpdateSecurityMarks' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1p1beta1/{security_marks.name=organizations/*/assets/*/securityMarks}', + 'body' => 'security_marks', + 'additionalBindings' => [ + [ + 'method' => 'patch', + 'uriTemplate' => '/v1p1beta1/{security_marks.name=organizations/*/sources/*/findings/*/securityMarks}', + 'body' => 'security_marks', + ], + ], + 'placeholders' => [ + 'security_marks.name' => [ + 'getters' => [ + 'getSecurityMarks', + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=organizations/*/operations}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=organizations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=organizations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=organizations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], +]; diff --git a/SecurityCenter/synth.metadata b/SecurityCenter/synth.metadata index a7e214909b4a..60af85a4cd14 100644 --- a/SecurityCenter/synth.metadata +++ b/SecurityCenter/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2020-01-15T18:01:21.887560Z", + "updateTime": "2020-02-10T22:29:42.162769Z", "sources": [ { "generator": { "name": "artman", - "version": "0.44.0", - "dockerImage": "googleapis/artman@sha256:10a6d0342b8d62544810ac5ad86c3b21049ec0696608ac60175da8e513234344" + "version": "0.45.0", + "dockerImage": "googleapis/artman@sha256:6aec9c34db0e4be221cdaf6faba27bdc07cfea846808b3d3b964dfce3a9a0f9b" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "50b0e8286ac988b0593bd890eb31fef6ea2f5767", - "internalRef": "289876944" + "sha": "fcc86bee0e84dc11e9abbff8d7c3529c0626f390", + "internalRef": "294264582" } } ], @@ -27,6 +27,16 @@ "generator": "gapic", "config": "google/cloud/securitycenter/artman_securitycenter_v1.yaml" } + }, + { + "client": { + "source": "googleapis", + "apiName": "securitycenter", + "apiVersion": "v1p1beta1", + "language": "php", + "generator": "gapic", + "config": "google/cloud/securitycenter/artman_securitycenter_v1p1beta1.yaml" + } } ] } \ No newline at end of file diff --git a/SecurityCenter/synth.py b/SecurityCenter/synth.py index b4ba5fd5311e..cefe707a3d70 100644 --- a/SecurityCenter/synth.py +++ b/SecurityCenter/synth.py @@ -24,21 +24,22 @@ gapic = gcp.GAPICGenerator() common = gcp.CommonTemplates() -library = gapic.php_library( - service='securitycenter', - version='v1', - config_path=f'/google/cloud/securitycenter/artman_securitycenter_v1.yaml', - artman_output_name=f'google-cloud-securitycenter-v1') +for version in ['V1', 'V1p1beta1']: + lower_version = version.lower() + library = gapic.php_library( + service='securitycenter', + version=lower_version, + artman_output_name=f'google-cloud-securitycenter-{lower_version}') -# copy all src -s.move(library / f'src/V1') + # copy all src + s.move(library / f'src/{version}') -# copy proto files to src also -s.move(library / f'proto/src/Google/Cloud/SecurityCenter', f'src/') -s.move(library / f'tests/') + # copy proto files to src also + s.move(library / f'proto/src/Google/Cloud/SecurityCenter', f'src/') + s.move(library / f'tests/') -# copy GPBMetadata file to metadata -s.move(library / f'proto/src/GPBMetadata/Google/Cloud/SecurityCenter', f'metadata/') + # copy GPBMetadata file to metadata + s.move(library / f'proto/src/GPBMetadata/Google/Cloud/SecurityCenter', f'metadata/') # document and utilize apiEndpoint instead of serviceAddress s.replace( @@ -60,13 +61,21 @@ # fix year s.replace( - 'src/**/**/*.php', + 'src/V1/**/*.php', r'Copyright \d{4}', r'Copyright 2019') s.replace( - 'tests/**/**/*Test.php', + 'tests/*/V1/**/*Test.php', r'Copyright \d{4}', r'Copyright 2019') +s.replace( + 'src/V1p1beta1/**/*.php', + r'Copyright \d{4}', + r'Copyright 2020') +s.replace( + 'tests/*/V1p1beta1/**/*Test.php', + r'Copyright \d{4}', + r'Copyright 2020') # Use new namespace in the doc sample. See # https://github.com/googleapis/gapic-generator/issues/2141 diff --git a/SecurityCenter/tests/Unit/V1P1Beta1/SecurityCenterClientTest.php b/SecurityCenter/tests/Unit/V1P1Beta1/SecurityCenterClientTest.php new file mode 100644 index 000000000000..adc038568789 --- /dev/null +++ b/SecurityCenter/tests/Unit/V1P1Beta1/SecurityCenterClientTest.php @@ -0,0 +1,1994 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** + * @return SecurityCenterClient + */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + + return new SecurityCenterClient($options); + } + + /** + * @test + */ + public function createSourceTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new Source(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedParent = $client->organizationName('[ORGANIZATION]'); + $source = new Source(); + + $response = $client->createSource($formattedParent, $source); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/CreateSource', $actualFuncCall); + + $actualValue = $actualRequestObject->getParent(); + + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getSource(); + + $this->assertProtobufEquals($source, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function createSourceExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedParent = $client->organizationName('[ORGANIZATION]'); + $source = new Source(); + + try { + $client->createSource($formattedParent, $source); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function createFindingTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name = 'name3373707'; + $parent2 = 'parent21175163357'; + $resourceName = 'resourceName979421212'; + $category = 'category50511102'; + $externalUri = 'externalUri-1385596168'; + $expectedResponse = new Finding(); + $expectedResponse->setName($name); + $expectedResponse->setParent($parent2); + $expectedResponse->setResourceName($resourceName); + $expectedResponse->setCategory($category); + $expectedResponse->setExternalUri($externalUri); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedParent = $client->sourceName('[ORGANIZATION]', '[SOURCE]'); + $findingId = 'findingId728776081'; + $finding = new Finding(); + + $response = $client->createFinding($formattedParent, $findingId, $finding); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/CreateFinding', $actualFuncCall); + + $actualValue = $actualRequestObject->getParent(); + + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getFindingId(); + + $this->assertProtobufEquals($findingId, $actualValue); + $actualValue = $actualRequestObject->getFinding(); + + $this->assertProtobufEquals($finding, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function createFindingExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedParent = $client->sourceName('[ORGANIZATION]', '[SOURCE]'); + $findingId = 'findingId728776081'; + $finding = new Finding(); + + try { + $client->createFinding($formattedParent, $findingId, $finding); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function createNotificationConfigTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name = 'name3373707'; + $description = 'description-1724546052'; + $pubsubTopic = 'pubsubTopic-338126829'; + $serviceAccount = 'serviceAccount-1948028253'; + $expectedResponse = new NotificationConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setPubsubTopic($pubsubTopic); + $expectedResponse->setServiceAccount($serviceAccount); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedParent = $client->organizationName('[ORGANIZATION]'); + $configId = 'configId-804450504'; + $notificationConfig = new NotificationConfig(); + + $response = $client->createNotificationConfig($formattedParent, $configId, $notificationConfig); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/CreateNotificationConfig', $actualFuncCall); + + $actualValue = $actualRequestObject->getParent(); + + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getConfigId(); + + $this->assertProtobufEquals($configId, $actualValue); + $actualValue = $actualRequestObject->getNotificationConfig(); + + $this->assertProtobufEquals($notificationConfig, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function createNotificationConfigExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedParent = $client->organizationName('[ORGANIZATION]'); + $configId = 'configId-804450504'; + $notificationConfig = new NotificationConfig(); + + try { + $client->createNotificationConfig($formattedParent, $configId, $notificationConfig); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function deleteNotificationConfigTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedName = $client->notificationConfigName('[ORGANIZATION]', '[NOTIFICATION_CONFIG]'); + + $client->deleteNotificationConfig($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/DeleteNotificationConfig', $actualFuncCall); + + $actualValue = $actualRequestObject->getName(); + + $this->assertProtobufEquals($formattedName, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function deleteNotificationConfigExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedName = $client->notificationConfigName('[ORGANIZATION]', '[NOTIFICATION_CONFIG]'); + + try { + $client->deleteNotificationConfig($formattedName); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function getIamPolicyTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + + // Mock request + $resource = 'resource-341064690'; + + $response = $client->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/GetIamPolicy', $actualFuncCall); + + $actualValue = $actualRequestObject->getResource(); + + $this->assertProtobufEquals($resource, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function getIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $resource = 'resource-341064690'; + + try { + $client->getIamPolicy($resource); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function getNotificationConfigTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $pubsubTopic = 'pubsubTopic-338126829'; + $serviceAccount = 'serviceAccount-1948028253'; + $expectedResponse = new NotificationConfig(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setPubsubTopic($pubsubTopic); + $expectedResponse->setServiceAccount($serviceAccount); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedName = $client->notificationConfigName('[ORGANIZATION]', '[NOTIFICATION_CONFIG]'); + + $response = $client->getNotificationConfig($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/GetNotificationConfig', $actualFuncCall); + + $actualValue = $actualRequestObject->getName(); + + $this->assertProtobufEquals($formattedName, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function getNotificationConfigExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedName = $client->notificationConfigName('[ORGANIZATION]', '[NOTIFICATION_CONFIG]'); + + try { + $client->getNotificationConfig($formattedName); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function getOrganizationSettingsTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name2 = 'name2-1052831874'; + $enableAssetDiscovery = false; + $expectedResponse = new OrganizationSettings(); + $expectedResponse->setName($name2); + $expectedResponse->setEnableAssetDiscovery($enableAssetDiscovery); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedName = $client->organizationSettingsName('[ORGANIZATION]'); + + $response = $client->getOrganizationSettings($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/GetOrganizationSettings', $actualFuncCall); + + $actualValue = $actualRequestObject->getName(); + + $this->assertProtobufEquals($formattedName, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function getOrganizationSettingsExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedName = $client->organizationSettingsName('[ORGANIZATION]'); + + try { + $client->getOrganizationSettings($formattedName); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function getSourceTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new Source(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedName = $client->sourceName('[ORGANIZATION]', '[SOURCE]'); + + $response = $client->getSource($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/GetSource', $actualFuncCall); + + $actualValue = $actualRequestObject->getName(); + + $this->assertProtobufEquals($formattedName, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function getSourceExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedName = $client->sourceName('[ORGANIZATION]', '[SOURCE]'); + + try { + $client->getSource($formattedName); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function groupAssetsTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $nextPageToken = ''; + $totalSize = 705419236; + $groupByResultsElement = new GroupResult(); + $groupByResults = [$groupByResultsElement]; + $expectedResponse = new GroupAssetsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTotalSize($totalSize); + $expectedResponse->setGroupByResults($groupByResults); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedParent = $client->organizationName('[ORGANIZATION]'); + $groupBy = 'groupBy506361367'; + + $response = $client->groupAssets($formattedParent, $groupBy); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getGroupByResults()[0], $resources[0]); + + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/GroupAssets', $actualFuncCall); + + $actualValue = $actualRequestObject->getParent(); + + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getGroupBy(); + + $this->assertProtobufEquals($groupBy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function groupAssetsExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedParent = $client->organizationName('[ORGANIZATION]'); + $groupBy = 'groupBy506361367'; + + try { + $client->groupAssets($formattedParent, $groupBy); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function groupFindingsTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $nextPageToken = ''; + $totalSize = 705419236; + $groupByResultsElement = new GroupResult(); + $groupByResults = [$groupByResultsElement]; + $expectedResponse = new GroupFindingsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTotalSize($totalSize); + $expectedResponse->setGroupByResults($groupByResults); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedParent = $client->sourceName('[ORGANIZATION]', '[SOURCE]'); + $groupBy = 'groupBy506361367'; + + $response = $client->groupFindings($formattedParent, $groupBy); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getGroupByResults()[0], $resources[0]); + + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/GroupFindings', $actualFuncCall); + + $actualValue = $actualRequestObject->getParent(); + + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getGroupBy(); + + $this->assertProtobufEquals($groupBy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function groupFindingsExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedParent = $client->sourceName('[ORGANIZATION]', '[SOURCE]'); + $groupBy = 'groupBy506361367'; + + try { + $client->groupFindings($formattedParent, $groupBy); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function listAssetsTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $nextPageToken = ''; + $totalSize = 705419236; + $listAssetsResultsElement = new ListAssetsResult(); + $listAssetsResults = [$listAssetsResultsElement]; + $expectedResponse = new ListAssetsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTotalSize($totalSize); + $expectedResponse->setListAssetsResults($listAssetsResults); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedParent = $client->organizationName('[ORGANIZATION]'); + + $response = $client->listAssets($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getListAssetsResults()[0], $resources[0]); + + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/ListAssets', $actualFuncCall); + + $actualValue = $actualRequestObject->getParent(); + + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function listAssetsExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedParent = $client->organizationName('[ORGANIZATION]'); + + try { + $client->listAssets($formattedParent); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function listFindingsTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $nextPageToken = ''; + $totalSize = 705419236; + $listFindingsResultsElement = new ListFindingsResult(); + $listFindingsResults = [$listFindingsResultsElement]; + $expectedResponse = new ListFindingsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTotalSize($totalSize); + $expectedResponse->setListFindingsResults($listFindingsResults); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedParent = $client->sourceName('[ORGANIZATION]', '[SOURCE]'); + + $response = $client->listFindings($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getListFindingsResults()[0], $resources[0]); + + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/ListFindings', $actualFuncCall); + + $actualValue = $actualRequestObject->getParent(); + + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function listFindingsExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedParent = $client->sourceName('[ORGANIZATION]', '[SOURCE]'); + + try { + $client->listFindings($formattedParent); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function listNotificationConfigsTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $nextPageToken = ''; + $notificationConfigsElement = new NotificationConfig(); + $notificationConfigs = [$notificationConfigsElement]; + $expectedResponse = new ListNotificationConfigsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setNotificationConfigs($notificationConfigs); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedParent = $client->organizationName('[ORGANIZATION]'); + + $response = $client->listNotificationConfigs($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getNotificationConfigs()[0], $resources[0]); + + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/ListNotificationConfigs', $actualFuncCall); + + $actualValue = $actualRequestObject->getParent(); + + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function listNotificationConfigsExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedParent = $client->organizationName('[ORGANIZATION]'); + + try { + $client->listNotificationConfigs($formattedParent); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function listSourcesTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $nextPageToken = ''; + $sourcesElement = new Source(); + $sources = [$sourcesElement]; + $expectedResponse = new ListSourcesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSources($sources); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedParent = $client->organizationName('[ORGANIZATION]'); + + $response = $client->listSources($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSources()[0], $resources[0]); + + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/ListSources', $actualFuncCall); + + $actualValue = $actualRequestObject->getParent(); + + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function listSourcesExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedParent = $client->organizationName('[ORGANIZATION]'); + + try { + $client->listSources($formattedParent); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function runAssetDiscoveryTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'serviceAddress' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $client = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/runAssetDiscoveryTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new RunAssetDiscoveryResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/runAssetDiscoveryTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + + // Mock request + $formattedParent = $client->organizationName('[ORGANIZATION]'); + + $response = $client->runAssetDiscovery($formattedParent); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/RunAssetDiscovery', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + + $this->assertProtobufEquals($formattedParent, $actualValue); + + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/runAssetDiscoveryTest'); + + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** + * @test + */ + public function runAssetDiscoveryExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'serviceAddress' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $client = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/runAssetDiscoveryTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + + // Mock request + $formattedParent = $client->organizationName('[ORGANIZATION]'); + + $response = $client->runAssetDiscovery($formattedParent); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/runAssetDiscoveryTest'); + + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** + * @test + */ + public function setFindingStateTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name2 = 'name2-1052831874'; + $parent = 'parent-995424086'; + $resourceName = 'resourceName979421212'; + $category = 'category50511102'; + $externalUri = 'externalUri-1385596168'; + $expectedResponse = new Finding(); + $expectedResponse->setName($name2); + $expectedResponse->setParent($parent); + $expectedResponse->setResourceName($resourceName); + $expectedResponse->setCategory($category); + $expectedResponse->setExternalUri($externalUri); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedName = $client->findingName('[ORGANIZATION]', '[SOURCE]', '[FINDING]'); + $state = State::STATE_UNSPECIFIED; + $startTime = new Timestamp(); + + $response = $client->setFindingState($formattedName, $state, $startTime); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/SetFindingState', $actualFuncCall); + + $actualValue = $actualRequestObject->getName(); + + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getState(); + + $this->assertProtobufEquals($state, $actualValue); + $actualValue = $actualRequestObject->getStartTime(); + + $this->assertProtobufEquals($startTime, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function setFindingStateExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedName = $client->findingName('[ORGANIZATION]', '[SOURCE]', '[FINDING]'); + $state = State::STATE_UNSPECIFIED; + $startTime = new Timestamp(); + + try { + $client->setFindingState($formattedName, $state, $startTime); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function setIamPolicyTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + + $response = $client->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/SetIamPolicy', $actualFuncCall); + + $actualValue = $actualRequestObject->getResource(); + + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + + $this->assertProtobufEquals($policy, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function setIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + + try { + $client->setIamPolicy($resource, $policy); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function testIamPermissionsTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + + $response = $client->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/TestIamPermissions', $actualFuncCall); + + $actualValue = $actualRequestObject->getResource(); + + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + + $this->assertProtobufEquals($permissions, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function testIamPermissionsExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + + try { + $client->testIamPermissions($resource, $permissions); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function updateFindingTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name = 'name3373707'; + $parent = 'parent-995424086'; + $resourceName = 'resourceName979421212'; + $category = 'category50511102'; + $externalUri = 'externalUri-1385596168'; + $expectedResponse = new Finding(); + $expectedResponse->setName($name); + $expectedResponse->setParent($parent); + $expectedResponse->setResourceName($resourceName); + $expectedResponse->setCategory($category); + $expectedResponse->setExternalUri($externalUri); + $transport->addResponse($expectedResponse); + + // Mock request + $finding = new Finding(); + + $response = $client->updateFinding($finding); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/UpdateFinding', $actualFuncCall); + + $actualValue = $actualRequestObject->getFinding(); + + $this->assertProtobufEquals($finding, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function updateFindingExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $finding = new Finding(); + + try { + $client->updateFinding($finding); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function updateNotificationConfigTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name = 'name3373707'; + $description = 'description-1724546052'; + $pubsubTopic = 'pubsubTopic-338126829'; + $serviceAccount = 'serviceAccount-1948028253'; + $expectedResponse = new NotificationConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setPubsubTopic($pubsubTopic); + $expectedResponse->setServiceAccount($serviceAccount); + $transport->addResponse($expectedResponse); + + // Mock request + $notificationConfig = new NotificationConfig(); + + $response = $client->updateNotificationConfig($notificationConfig); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/UpdateNotificationConfig', $actualFuncCall); + + $actualValue = $actualRequestObject->getNotificationConfig(); + + $this->assertProtobufEquals($notificationConfig, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function updateNotificationConfigExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $notificationConfig = new NotificationConfig(); + + try { + $client->updateNotificationConfig($notificationConfig); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function updateOrganizationSettingsTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name = 'name3373707'; + $enableAssetDiscovery = false; + $expectedResponse = new OrganizationSettings(); + $expectedResponse->setName($name); + $expectedResponse->setEnableAssetDiscovery($enableAssetDiscovery); + $transport->addResponse($expectedResponse); + + // Mock request + $organizationSettings = new OrganizationSettings(); + + $response = $client->updateOrganizationSettings($organizationSettings); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/UpdateOrganizationSettings', $actualFuncCall); + + $actualValue = $actualRequestObject->getOrganizationSettings(); + + $this->assertProtobufEquals($organizationSettings, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function updateOrganizationSettingsExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $organizationSettings = new OrganizationSettings(); + + try { + $client->updateOrganizationSettings($organizationSettings); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function updateSourceTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new Source(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + + // Mock request + $source = new Source(); + + $response = $client->updateSource($source); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/UpdateSource', $actualFuncCall); + + $actualValue = $actualRequestObject->getSource(); + + $this->assertProtobufEquals($source, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function updateSourceExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $source = new Source(); + + try { + $client->updateSource($source); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function updateSecurityMarksTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name = 'name3373707'; + $expectedResponse = new SecurityMarks(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + + // Mock request + $securityMarks = new SecurityMarks(); + + $response = $client->updateSecurityMarks($securityMarks); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.securitycenter.v1p1beta1.SecurityCenter/UpdateSecurityMarks', $actualFuncCall); + + $actualValue = $actualRequestObject->getSecurityMarks(); + + $this->assertProtobufEquals($securityMarks, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function updateSecurityMarksExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $securityMarks = new SecurityMarks(); + + try { + $client->updateSecurityMarks($securityMarks); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/docs/contents/cloud-security-center.json b/docs/contents/cloud-security-center.json index a5676f1e229e..bd10b83fb8d8 100644 --- a/docs/contents/cloud-security-center.json +++ b/docs/contents/cloud-security-center.json @@ -18,6 +18,19 @@ "patterns": [ "securitycenter\/v1\/\\w{1,}" ] + }, + { + "title": "v1p1beta1", + "type": "securitycenter\/v1p1beta1\/readme", + "nav": [ + { + "title": "SecurityCenterClient", + "type": "securitycenter\/v1p1beta1\/securitycenterclient" + } + ], + "patterns": [ + "securitycenter\/v1p1beta1\/\\w{1,}" + ] } ], "pattern": "securitycenter\/\\w{1,}" From 425b035d45d05afe9cf0d45045467aad5fcc81c2 Mon Sep 17 00:00:00 2001 From: David Supplee Date: Mon, 10 Feb 2020 15:01:25 -0800 Subject: [PATCH 2/2] fix namespace --- .../src/V1p1beta1/Gapic/SecurityCenterGapicClient.php | 2 +- SecurityCenter/src/V1p1beta1/SecurityCenterClient.php | 4 ++-- .../tests/Unit/V1P1Beta1/SecurityCenterClientTest.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SecurityCenter/src/V1p1beta1/Gapic/SecurityCenterGapicClient.php b/SecurityCenter/src/V1p1beta1/Gapic/SecurityCenterGapicClient.php index 4ed06f4f14a6..fedc1dc0404d 100644 --- a/SecurityCenter/src/V1p1beta1/Gapic/SecurityCenterGapicClient.php +++ b/SecurityCenter/src/V1p1beta1/Gapic/SecurityCenterGapicClient.php @@ -24,7 +24,7 @@ * @experimental */ -namespace Google\Cloud\SecurityCenter\V1P1Beta1\Gapic; +namespace Google\Cloud\SecurityCenter\V1p1beta1\Gapic; use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; diff --git a/SecurityCenter/src/V1p1beta1/SecurityCenterClient.php b/SecurityCenter/src/V1p1beta1/SecurityCenterClient.php index 66584ec4f3c1..3170db9588d9 100644 --- a/SecurityCenter/src/V1p1beta1/SecurityCenterClient.php +++ b/SecurityCenter/src/V1p1beta1/SecurityCenterClient.php @@ -24,9 +24,9 @@ * @experimental */ -namespace Google\Cloud\SecurityCenter\V1P1Beta1; +namespace Google\Cloud\SecurityCenter\V1p1beta1; -use Google\Cloud\SecurityCenter\V1P1Beta1\Gapic\SecurityCenterGapicClient; +use Google\Cloud\SecurityCenter\V1p1beta1\Gapic\SecurityCenterGapicClient; /** * {@inheritdoc} diff --git a/SecurityCenter/tests/Unit/V1P1Beta1/SecurityCenterClientTest.php b/SecurityCenter/tests/Unit/V1P1Beta1/SecurityCenterClientTest.php index adc038568789..9e49f234aba3 100644 --- a/SecurityCenter/tests/Unit/V1P1Beta1/SecurityCenterClientTest.php +++ b/SecurityCenter/tests/Unit/V1P1Beta1/SecurityCenterClientTest.php @@ -20,9 +20,9 @@ * This file was automatically generated - do not edit! */ -namespace Google\Cloud\SecurityCenter\Tests\Unit\V1P1Beta1; +namespace Google\Cloud\SecurityCenter\Tests\Unit\V1p1beta1; -use Google\Cloud\SecurityCenter\V1P1Beta1\SecurityCenterClient; +use Google\Cloud\SecurityCenter\V1p1beta1\SecurityCenterClient; use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\LongRunning\OperationsClient;