From ee538cc9e40d597c4c17b85ac4868f702aa98494 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Thu, 14 Nov 2019 02:58:43 -0800 Subject: [PATCH 1/4] [CHANGE ME] Re-generated Asset to pick up changes in the API or client library generator. --- Asset/metadata/V1/AssetService.php | 124 ++++++++----- Asset/metadata/V1/Assets.php | 61 ++++--- Asset/src/V1/BatchGetAssetsHistoryRequest.php | 38 ++-- Asset/src/V1/BigQueryDestination.php | 167 ++++++++++++++++++ Asset/src/V1/ContentType.php | 14 ++ Asset/src/V1/ExportAssetsRequest.php | 36 ++-- .../src/V1/Gapic/AssetServiceGapicClient.php | 11 +- Asset/src/V1/GcsDestination.php | 52 ++++++ Asset/src/V1/OutputConfig.php | 37 ++++ .../asset_service_rest_client_config.php | 31 ---- Asset/synth.metadata | 10 +- 11 files changed, 427 insertions(+), 154 deletions(-) create mode 100644 Asset/src/V1/BigQueryDestination.php diff --git a/Asset/metadata/V1/AssetService.php b/Asset/metadata/V1/AssetService.php index 31123243f318..0c0cf14990f9 100644 --- a/Asset/metadata/V1/AssetService.php +++ b/Asset/metadata/V1/AssetService.php @@ -15,61 +15,87 @@ public static function initOnce() { return; } \GPBMetadata\Google\Api\Annotations::initOnce(); + \GPBMetadata\Google\Api\Client::initOnce(); + \GPBMetadata\Google\Api\FieldBehavior::initOnce(); + \GPBMetadata\Google\Api\Resource::initOnce(); \GPBMetadata\Google\Cloud\Asset\V1\Assets::initOnce(); \GPBMetadata\Google\Longrunning\Operations::initOnce(); + \GPBMetadata\Google\Protobuf\GPBEmpty::initOnce(); + \GPBMetadata\Google\Protobuf\FieldMask::initOnce(); \GPBMetadata\Google\Protobuf\Timestamp::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0af40b0a29676f6f676c652f636c6f75642f61737365742f76312f617373" . + "0ae9100a29676f6f676c652f636c6f75642f61737365742f76312f617373" . "65745f736572766963652e70726f746f1215676f6f676c652e636c6f7564" . - "2e61737365742e76311a22676f6f676c652f636c6f75642f61737365742f" . - "76312f6173736574732e70726f746f1a23676f6f676c652f6c6f6e677275" . - "6e6e696e672f6f7065726174696f6e732e70726f746f1a1f676f6f676c65" . - "2f70726f746f6275662f74696d657374616d702e70726f746f22df010a13" . - "4578706f727441737365747352657175657374120e0a06706172656e7418" . - "0120012809122d0a09726561645f74696d6518022001280b321a2e676f6f" . - "676c652e70726f746f6275662e54696d657374616d7012130a0b61737365" . - "745f747970657318032003280912380a0c636f6e74656e745f7479706518" . - "042001280e32222e676f6f676c652e636c6f75642e61737365742e76312e" . - "436f6e74656e7454797065123a0a0d6f75747075745f636f6e6669671805" . - "2001280b32232e676f6f676c652e636c6f75642e61737365742e76312e4f" . - "7574707574436f6e6669672281010a144578706f72744173736574735265" . - "73706f6e7365122d0a09726561645f74696d6518012001280b321a2e676f" . - "6f676c652e70726f746f6275662e54696d657374616d70123a0a0d6f7574" . - "7075745f636f6e66696718022001280b32232e676f6f676c652e636c6f75" . - "642e61737365742e76312e4f7574707574436f6e66696722ba010a1c4261" . - "746368476574417373657473486973746f727952657175657374120e0a06" . - "706172656e7418012001280912130a0b61737365745f6e616d6573180220" . - "03280912380a0c636f6e74656e745f7479706518032001280e32222e676f" . - "6f676c652e636c6f75642e61737365742e76312e436f6e74656e74547970" . - "65123b0a10726561645f74696d655f77696e646f7718042001280b32212e" . + "2e61737365742e76311a17676f6f676c652f6170692f636c69656e742e70" . + "726f746f1a1f676f6f676c652f6170692f6669656c645f6265686176696f" . + "722e70726f746f1a19676f6f676c652f6170692f7265736f757263652e70" . + "726f746f1a22676f6f676c652f636c6f75642f61737365742f76312f6173" . + "736574732e70726f746f1a23676f6f676c652f6c6f6e6772756e6e696e67" . + "2f6f7065726174696f6e732e70726f746f1a1b676f6f676c652f70726f74" . + "6f6275662f656d7074792e70726f746f1a20676f6f676c652f70726f746f" . + "6275662f6669656c645f6d61736b2e70726f746f1a1f676f6f676c652f70" . + "726f746f6275662f74696d657374616d702e70726f746f228d020a134578" . + "706f72744173736574735265717565737412370a06706172656e74180120" . + "0128094227e04102fa4121121f636c6f756461737365742e676f6f676c65" . + "617069732e636f6d2f4173736574122d0a09726561645f74696d65180220" . + "01280b321a2e676f6f676c652e70726f746f6275662e54696d657374616d" . + "7012130a0b61737365745f747970657318032003280912380a0c636f6e74" . + "656e745f7479706518042001280e32222e676f6f676c652e636c6f75642e" . + "61737365742e76312e436f6e74656e7454797065123f0a0d6f7574707574" . + "5f636f6e66696718052001280b32232e676f6f676c652e636c6f75642e61" . + "737365742e76312e4f7574707574436f6e6669674203e041022281010a14" . + "4578706f7274417373657473526573706f6e7365122d0a09726561645f74" . + "696d6518012001280b321a2e676f6f676c652e70726f746f6275662e5469" . + "6d657374616d70123a0a0d6f75747075745f636f6e66696718022001280b" . + "32232e676f6f676c652e636c6f75642e61737365742e76312e4f75747075" . + "74436f6e66696722ed010a1c426174636847657441737365747348697374" . + "6f72795265717565737412370a06706172656e741801200128094227e041" . + "02fa4121121f636c6f756461737365742e676f6f676c65617069732e636f" . + "6d2f417373657412130a0b61737365745f6e616d6573180220032809123d" . + "0a0c636f6e74656e745f7479706518032001280e32222e676f6f676c652e" . + "636c6f75642e61737365742e76312e436f6e74656e74547970654203e041" . + "0112400a10726561645f74696d655f77696e646f7718042001280b32212e" . "676f6f676c652e636c6f75642e61737365742e76312e54696d6557696e64" . - "6f7722550a1d4261746368476574417373657473486973746f7279526573" . - "706f6e736512340a0661737365747318012003280b32242e676f6f676c65" . - "2e636c6f75642e61737365742e76312e54656d706f72616c417373657422" . - "5f0a0c4f7574707574436f6e66696712400a0f6763735f64657374696e61" . - "74696f6e18012001280b32252e676f6f676c652e636c6f75642e61737365" . - "742e76312e47637344657374696e6174696f6e4800420d0a0b6465737469" . - "6e6174696f6e222d0a0e47637344657374696e6174696f6e120d0a037572" . - "691801200128094800420c0a0a6f626a6563745f7572692a490a0b436f6e" . - "74656e7454797065121c0a18434f4e54454e545f545950455f554e535045" . - "4349464945441000120c0a085245534f555243451001120e0a0a49414d5f" . - "504f4c494359100232c9020a0c4173736574536572766963651283010a0c" . - "4578706f7274417373657473122a2e676f6f676c652e636c6f75642e6173" . - "7365742e76312e4578706f7274417373657473526571756573741a1d2e67" . - "6f6f676c652e6c6f6e6772756e6e696e672e4f7065726174696f6e222882" . - "d3e4930222221d2f76312f7b706172656e743d2a2f2a7d3a6578706f7274" . - "4173736574733a012a12b2010a1542617463684765744173736574734869" . - "73746f727912332e676f6f676c652e636c6f75642e61737365742e76312e" . - "4261746368476574417373657473486973746f7279526571756573741a34" . - "2e676f6f676c652e636c6f75642e61737365742e76312e42617463684765" . - "74417373657473486973746f7279526573706f6e7365222e82d3e4930228" . - "12262f76312f7b706172656e743d2a2f2a7d3a6261746368476574417373" . - "657473486973746f7279429c010a19636f6d2e676f6f676c652e636c6f75" . - "642e61737365742e7631421141737365745365727669636550726f746f50" . - "015a3a676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f" . - "676f6f676c65617069732f636c6f75642f61737365742f76313b61737365" . - "74aa0215476f6f676c652e436c6f75642e41737365742e5631ca0215476f" . - "6f676c655c436c6f75645c41737365745c5631620670726f746f33" + "6f774203e0410122550a1d4261746368476574417373657473486973746f" . + "7279526573706f6e736512340a0661737365747318012003280b32242e67" . + "6f6f676c652e636c6f75642e61737365742e76312e54656d706f72616c41" . + "7373657422ab010a0c4f7574707574436f6e66696712400a0f6763735f64" . + "657374696e6174696f6e18012001280b32252e676f6f676c652e636c6f75" . + "642e61737365742e76312e47637344657374696e6174696f6e4800124a0a" . + "1462696771756572795f64657374696e6174696f6e18022001280b322a2e" . + "676f6f676c652e636c6f75642e61737365742e76312e4269675175657279" . + "44657374696e6174696f6e4800420d0a0b64657374696e6174696f6e2243" . + "0a0e47637344657374696e6174696f6e120d0a0375726918012001280948" . + "0012140a0a7572695f7072656669781802200128094800420c0a0a6f626a" . + "6563745f757269224e0a13426967517565727944657374696e6174696f6e" . + "12140a07646174617365741801200128094203e0410212120a057461626c" . + "651802200128094203e04102120d0a05666f7263651803200128082a6c0a" . + "0b436f6e74656e7454797065121c0a18434f4e54454e545f545950455f55" . + "4e5350454349464945441000120c0a085245534f555243451001120e0a0a" . + "49414d5f504f4c4943591002120e0a0a4f52475f504f4c49435910041211" . + "0a0d4143434553535f504f4c494359100532f3030a0c4173736574536572" . + "7669636512de010a0c4578706f7274417373657473122a2e676f6f676c65" . + "2e636c6f75642e61737365742e76312e4578706f72744173736574735265" . + "71756573741a1d2e676f6f676c652e6c6f6e6772756e6e696e672e4f7065" . + "726174696f6e22820182d3e4930222221d2f76312f7b706172656e743d2a" . + "2f2a7d3a6578706f72744173736574733a012aca41570a2a676f6f676c65" . + "2e636c6f75642e61737365742e76312e4578706f72744173736574735265" . + "73706f6e73651229676f6f676c652e636c6f75642e61737365742e76312e" . + "4578706f72744173736574735265717565737412b2010a15426174636847" . + "6574417373657473486973746f727912332e676f6f676c652e636c6f7564" . + "2e61737365742e76312e4261746368476574417373657473486973746f72" . + "79526571756573741a342e676f6f676c652e636c6f75642e61737365742e" . + "76312e4261746368476574417373657473486973746f7279526573706f6e" . + "7365222e82d3e493022812262f76312f7b706172656e743d2a2f2a7d3a62" . + "61746368476574417373657473486973746f72791a4dca4119636c6f7564" . + "61737365742e676f6f676c65617069732e636f6dd2412e68747470733a2f" . + "2f7777772e676f6f676c65617069732e636f6d2f617574682f636c6f7564" . + "2d706c6174666f726d429c010a19636f6d2e676f6f676c652e636c6f7564" . + "2e61737365742e7631421141737365745365727669636550726f746f5001" . + "5a3a676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f67" . + "6f6f676c65617069732f636c6f75642f61737365742f76313b6173736574" . + "aa0215476f6f676c652e436c6f75642e41737365742e5631ca0215476f6f" . + "676c655c436c6f75645c41737365745c5631620670726f746f33" ), true); static::$is_initialized = true; diff --git a/Asset/metadata/V1/Assets.php b/Asset/metadata/V1/Assets.php index 06020d294cc3..0902fac9f328 100644 --- a/Asset/metadata/V1/Assets.php +++ b/Asset/metadata/V1/Assets.php @@ -15,41 +15,44 @@ public static function initOnce() { return; } \GPBMetadata\Google\Api\Annotations::initOnce(); + \GPBMetadata\Google\Api\Resource::initOnce(); \GPBMetadata\Google\Iam\V1\Policy::initOnce(); \GPBMetadata\Google\Protobuf\Any::initOnce(); \GPBMetadata\Google\Protobuf\Struct::initOnce(); \GPBMetadata\Google\Protobuf\Timestamp::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0aed060a22676f6f676c652f636c6f75642f61737365742f76312f617373" . + "0ab4070a22676f6f676c652f636c6f75642f61737365742f76312f617373" . "6574732e70726f746f1215676f6f676c652e636c6f75642e61737365742e" . - "76311a1a676f6f676c652f69616d2f76312f706f6c6963792e70726f746f" . - "1a19676f6f676c652f70726f746f6275662f616e792e70726f746f1a1c67" . - "6f6f676c652f70726f746f6275662f7374727563742e70726f746f1a1f67" . - "6f6f676c652f70726f746f6275662f74696d657374616d702e70726f746f" . - "2280010a0d54656d706f72616c417373657412310a0677696e646f771801" . - "2001280b32212e676f6f676c652e636c6f75642e61737365742e76312e54" . - "696d6557696e646f77120f0a0764656c65746564180220012808122b0a05" . - "617373657418032001280b321c2e676f6f676c652e636c6f75642e617373" . - "65742e76312e4173736574226a0a0a54696d6557696e646f77122e0a0a73" . - "746172745f74696d6518012001280b321a2e676f6f676c652e70726f746f" . - "6275662e54696d657374616d70122c0a08656e645f74696d651802200128" . - "0b321a2e676f6f676c652e70726f746f6275662e54696d657374616d7022" . - "87010a054173736574120c0a046e616d6518012001280912120a0a617373" . - "65745f7479706518022001280912310a087265736f757263651803200128" . - "0b321f2e676f6f676c652e636c6f75642e61737365742e76312e5265736f" . - "7572636512290a0a69616d5f706f6c69637918042001280b32152e676f6f" . - "676c652e69616d2e76312e506f6c69637922a0010a085265736f75726365" . - "120f0a0776657273696f6e180120012809121e0a16646973636f76657279" . - "5f646f63756d656e745f75726918022001280912160a0e646973636f7665" . - "72795f6e616d6518032001280912140a0c7265736f757263655f75726c18" . - "0420012809120e0a06706172656e7418052001280912250a046461746118" . - "062001280b32172e676f6f676c652e70726f746f6275662e537472756374" . - "4295010a19636f6d2e676f6f676c652e636c6f75642e61737365742e7631" . - "420a417373657450726f746f50015a3a676f6f676c652e676f6c616e672e" . - "6f72672f67656e70726f746f2f676f6f676c65617069732f636c6f75642f" . - "61737365742f76313b6173736574aa0215476f6f676c652e436c6f75642e" . - "41737365742e5631ca0215476f6f676c655c436c6f75645c41737365745c" . - "5631620670726f746f33" + "76311a19676f6f676c652f6170692f7265736f757263652e70726f746f1a" . + "1a676f6f676c652f69616d2f76312f706f6c6963792e70726f746f1a1967" . + "6f6f676c652f70726f746f6275662f616e792e70726f746f1a1c676f6f67" . + "6c652f70726f746f6275662f7374727563742e70726f746f1a1f676f6f67" . + "6c652f70726f746f6275662f74696d657374616d702e70726f746f228001" . + "0a0d54656d706f72616c417373657412310a0677696e646f771801200128" . + "0b32212e676f6f676c652e636c6f75642e61737365742e76312e54696d65" . + "57696e646f77120f0a0764656c65746564180220012808122b0a05617373" . + "657418032001280b321c2e676f6f676c652e636c6f75642e61737365742e" . + "76312e4173736574226a0a0a54696d6557696e646f77122e0a0a73746172" . + "745f74696d6518012001280b321a2e676f6f676c652e70726f746f627566" . + "2e54696d657374616d70122c0a08656e645f74696d6518022001280b321a" . + "2e676f6f676c652e70726f746f6275662e54696d657374616d7022b0010a" . + "054173736574120c0a046e616d6518012001280912120a0a61737365745f" . + "7479706518022001280912310a087265736f7572636518032001280b321f" . + "2e676f6f676c652e636c6f75642e61737365742e76312e5265736f757263" . + "6512290a0a69616d5f706f6c69637918042001280b32152e676f6f676c65" . + "2e69616d2e76312e506f6c6963793a27ea41240a1f636c6f756461737365" . + "742e676f6f676c65617069732e636f6d2f417373657412012a22a0010a08" . + "5265736f75726365120f0a0776657273696f6e180120012809121e0a1664" . + "6973636f766572795f646f63756d656e745f75726918022001280912160a" . + "0e646973636f766572795f6e616d6518032001280912140a0c7265736f75" . + "7263655f75726c180420012809120e0a06706172656e7418052001280912" . + "250a046461746118062001280b32172e676f6f676c652e70726f746f6275" . + "662e5374727563744298010a19636f6d2e676f6f676c652e636c6f75642e" . + "61737365742e7631420a417373657450726f746f50015a3a676f6f676c65" . + "2e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c65617069" . + "732f636c6f75642f61737365742f76313b6173736574f80101aa0215476f" . + "6f676c652e436c6f75642e41737365742e5631ca0215476f6f676c655c43" . + "6c6f75645c41737365745c5631620670726f746f33" ), true); static::$is_initialized = true; diff --git a/Asset/src/V1/BatchGetAssetsHistoryRequest.php b/Asset/src/V1/BatchGetAssetsHistoryRequest.php index a1d960393df1..6e4d12c7e8a7 100644 --- a/Asset/src/V1/BatchGetAssetsHistoryRequest.php +++ b/Asset/src/V1/BatchGetAssetsHistoryRequest.php @@ -20,7 +20,7 @@ class BatchGetAssetsHistoryRequest extends \Google\Protobuf\Internal\Message * organization number (such as "organizations/123"), a project ID (such as * "projects/my-project-id")", or a project number (such as "projects/12345"). * - * Generated from protobuf field string parent = 1; + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ private $parent = ''; /** @@ -28,7 +28,8 @@ class BatchGetAssetsHistoryRequest extends \Google\Protobuf\Internal\Message * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. * See [Resource * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - * and [Resource Name Format](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/resource-name-format) + * and [Resource Name + * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) * for more info. * The request becomes a no-op if the asset name list is empty, and the max * size of the asset name list is 100 in one request. @@ -37,9 +38,9 @@ class BatchGetAssetsHistoryRequest extends \Google\Protobuf\Internal\Message */ private $asset_names; /** - * Required. The content type. + * Optional. The content type. * - * Generated from protobuf field .google.cloud.asset.v1.ContentType content_type = 3; + * Generated from protobuf field .google.cloud.asset.v1.ContentType content_type = 3 [(.google.api.field_behavior) = OPTIONAL]; */ private $content_type = 0; /** @@ -50,7 +51,7 @@ class BatchGetAssetsHistoryRequest extends \Google\Protobuf\Internal\Message * returned results contain all temporal assets whose time window overlap with * read_time_window. * - * Generated from protobuf field .google.cloud.asset.v1.TimeWindow read_time_window = 4; + * Generated from protobuf field .google.cloud.asset.v1.TimeWindow read_time_window = 4 [(.google.api.field_behavior) = OPTIONAL]; */ private $read_time_window = null; @@ -69,12 +70,13 @@ class BatchGetAssetsHistoryRequest extends \Google\Protobuf\Internal\Message * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. * See [Resource * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - * and [Resource Name Format](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/resource-name-format) + * and [Resource Name + * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) * for more info. * The request becomes a no-op if the asset name list is empty, and the max * size of the asset name list is 100 in one request. * @type int $content_type - * Required. The content type. + * Optional. The content type. * @type \Google\Cloud\Asset\V1\TimeWindow $read_time_window * Optional. The time window for the asset history. Both start_time and * end_time are optional and if set, it must be after 2018-10-02 UTC. If @@ -94,7 +96,7 @@ public function __construct($data = NULL) { * organization number (such as "organizations/123"), a project ID (such as * "projects/my-project-id")", or a project number (such as "projects/12345"). * - * Generated from protobuf field string parent = 1; + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string */ public function getParent() @@ -107,7 +109,7 @@ public function getParent() * organization number (such as "organizations/123"), a project ID (such as * "projects/my-project-id")", or a project number (such as "projects/12345"). * - * Generated from protobuf field string parent = 1; + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var * @return $this */ @@ -124,7 +126,8 @@ public function setParent($var) * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. * See [Resource * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - * and [Resource Name Format](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/resource-name-format) + * and [Resource Name + * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) * for more info. * The request becomes a no-op if the asset name list is empty, and the max * size of the asset name list is 100 in one request. @@ -142,7 +145,8 @@ public function getAssetNames() * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. * See [Resource * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - * and [Resource Name Format](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/resource-name-format) + * and [Resource Name + * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) * for more info. * The request becomes a no-op if the asset name list is empty, and the max * size of the asset name list is 100 in one request. @@ -160,9 +164,9 @@ public function setAssetNames($var) } /** - * Required. The content type. + * Optional. The content type. * - * Generated from protobuf field .google.cloud.asset.v1.ContentType content_type = 3; + * Generated from protobuf field .google.cloud.asset.v1.ContentType content_type = 3 [(.google.api.field_behavior) = OPTIONAL]; * @return int */ public function getContentType() @@ -171,9 +175,9 @@ public function getContentType() } /** - * Required. The content type. + * Optional. The content type. * - * Generated from protobuf field .google.cloud.asset.v1.ContentType content_type = 3; + * Generated from protobuf field .google.cloud.asset.v1.ContentType content_type = 3 [(.google.api.field_behavior) = OPTIONAL]; * @param int $var * @return $this */ @@ -193,7 +197,7 @@ public function setContentType($var) * returned results contain all temporal assets whose time window overlap with * read_time_window. * - * Generated from protobuf field .google.cloud.asset.v1.TimeWindow read_time_window = 4; + * Generated from protobuf field .google.cloud.asset.v1.TimeWindow read_time_window = 4 [(.google.api.field_behavior) = OPTIONAL]; * @return \Google\Cloud\Asset\V1\TimeWindow */ public function getReadTimeWindow() @@ -209,7 +213,7 @@ public function getReadTimeWindow() * returned results contain all temporal assets whose time window overlap with * read_time_window. * - * Generated from protobuf field .google.cloud.asset.v1.TimeWindow read_time_window = 4; + * Generated from protobuf field .google.cloud.asset.v1.TimeWindow read_time_window = 4 [(.google.api.field_behavior) = OPTIONAL]; * @param \Google\Cloud\Asset\V1\TimeWindow $var * @return $this */ diff --git a/Asset/src/V1/BigQueryDestination.php b/Asset/src/V1/BigQueryDestination.php new file mode 100644 index 000000000000..89037f0c065c --- /dev/null +++ b/Asset/src/V1/BigQueryDestination.php @@ -0,0 +1,167 @@ +google.cloud.asset.v1.BigQueryDestination + */ +class BigQueryDestination extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The BigQuery dataset in format + * "projects/projectId/datasets/datasetId", to which the snapshot result + * should be exported. If this dataset does not exist, the export call returns + * an error. + * + * Generated from protobuf field string dataset = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $dataset = ''; + /** + * Required. The BigQuery table to which the snapshot result should be + * written. If this table does not exist, a new table with the given name + * will be created. + * + * Generated from protobuf field string table = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $table = ''; + /** + * If the destination table already exists and this flag is `TRUE`, the + * table will be overwritten by the contents of assets snapshot. If the flag + * is not set and the destination table already exists, the export call + * returns an error. + * + * Generated from protobuf field bool force = 3; + */ + private $force = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $dataset + * Required. The BigQuery dataset in format + * "projects/projectId/datasets/datasetId", to which the snapshot result + * should be exported. If this dataset does not exist, the export call returns + * an error. + * @type string $table + * Required. The BigQuery table to which the snapshot result should be + * written. If this table does not exist, a new table with the given name + * will be created. + * @type bool $force + * If the destination table already exists and this flag is `TRUE`, the + * table will be overwritten by the contents of assets snapshot. If the flag + * is not set and the destination table already exists, the export call + * returns an error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Asset\V1\AssetService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The BigQuery dataset in format + * "projects/projectId/datasets/datasetId", to which the snapshot result + * should be exported. If this dataset does not exist, the export call returns + * an error. + * + * Generated from protobuf field string dataset = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDataset() + { + return $this->dataset; + } + + /** + * Required. The BigQuery dataset in format + * "projects/projectId/datasets/datasetId", to which the snapshot result + * should be exported. If this dataset does not exist, the export call returns + * an error. + * + * Generated from protobuf field string dataset = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDataset($var) + { + GPBUtil::checkString($var, True); + $this->dataset = $var; + + return $this; + } + + /** + * Required. The BigQuery table to which the snapshot result should be + * written. If this table does not exist, a new table with the given name + * will be created. + * + * Generated from protobuf field string table = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTable() + { + return $this->table; + } + + /** + * Required. The BigQuery table to which the snapshot result should be + * written. If this table does not exist, a new table with the given name + * will be created. + * + * Generated from protobuf field string table = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTable($var) + { + GPBUtil::checkString($var, True); + $this->table = $var; + + return $this; + } + + /** + * If the destination table already exists and this flag is `TRUE`, the + * table will be overwritten by the contents of assets snapshot. If the flag + * is not set and the destination table already exists, the export call + * returns an error. + * + * Generated from protobuf field bool force = 3; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * If the destination table already exists and this flag is `TRUE`, the + * table will be overwritten by the contents of assets snapshot. If the flag + * is not set and the destination table already exists, the export call + * returns an error. + * + * Generated from protobuf field bool force = 3; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/Asset/src/V1/ContentType.php b/Asset/src/V1/ContentType.php index 2d05dfc9030c..293b7b31543e 100644 --- a/Asset/src/V1/ContentType.php +++ b/Asset/src/V1/ContentType.php @@ -31,11 +31,25 @@ class ContentType * Generated from protobuf enum IAM_POLICY = 2; */ const IAM_POLICY = 2; + /** + * The Cloud Organization Policy set on an asset. + * + * Generated from protobuf enum ORG_POLICY = 4; + */ + const ORG_POLICY = 4; + /** + * The Cloud Access context mananger Policy set on an asset. + * + * Generated from protobuf enum ACCESS_POLICY = 5; + */ + const ACCESS_POLICY = 5; private static $valueToName = [ self::CONTENT_TYPE_UNSPECIFIED => 'CONTENT_TYPE_UNSPECIFIED', self::RESOURCE => 'RESOURCE', self::IAM_POLICY => 'IAM_POLICY', + self::ORG_POLICY => 'ORG_POLICY', + self::ACCESS_POLICY => 'ACCESS_POLICY', ]; public static function name($value) diff --git a/Asset/src/V1/ExportAssetsRequest.php b/Asset/src/V1/ExportAssetsRequest.php index e535b0116986..0bb07213776c 100644 --- a/Asset/src/V1/ExportAssetsRequest.php +++ b/Asset/src/V1/ExportAssetsRequest.php @@ -21,7 +21,7 @@ class ExportAssetsRequest extends \Google\Protobuf\Internal\Message * "projects/my-project-id"), or a project number (such as "projects/12345"), * or a folder number (such as "folders/123"). * - * Generated from protobuf field string parent = 1; + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ private $parent = ''; /** @@ -36,9 +36,9 @@ class ExportAssetsRequest extends \Google\Protobuf\Internal\Message private $read_time = null; /** * A list of asset types of which to take a snapshot for. For example: - * "compute.googleapis.com/Disk". If specified, only matching assets will be returned. - * See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + * "compute.googleapis.com/Disk". If specified, only matching assets will be + * returned. See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/asset-inventory/docs/overview) * for all supported asset types. * * Generated from protobuf field repeated string asset_types = 3; @@ -55,7 +55,7 @@ class ExportAssetsRequest extends \Google\Protobuf\Internal\Message * Required. Output configuration indicating where the results will be output * to. All results will be in newline delimited JSON format. * - * Generated from protobuf field .google.cloud.asset.v1.OutputConfig output_config = 5; + * Generated from protobuf field .google.cloud.asset.v1.OutputConfig output_config = 5 [(.google.api.field_behavior) = REQUIRED]; */ private $output_config = null; @@ -78,9 +78,9 @@ class ExportAssetsRequest extends \Google\Protobuf\Internal\Message * query may get different results. * @type string[]|\Google\Protobuf\Internal\RepeatedField $asset_types * A list of asset types of which to take a snapshot for. For example: - * "compute.googleapis.com/Disk". If specified, only matching assets will be returned. - * See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + * "compute.googleapis.com/Disk". If specified, only matching assets will be + * returned. See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/asset-inventory/docs/overview) * for all supported asset types. * @type int $content_type * Asset content type. If not specified, no content but the asset name will be @@ -101,7 +101,7 @@ public function __construct($data = NULL) { * "projects/my-project-id"), or a project number (such as "projects/12345"), * or a folder number (such as "folders/123"). * - * Generated from protobuf field string parent = 1; + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string */ public function getParent() @@ -115,7 +115,7 @@ public function getParent() * "projects/my-project-id"), or a project number (such as "projects/12345"), * or a folder number (such as "folders/123"). * - * Generated from protobuf field string parent = 1; + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var * @return $this */ @@ -163,9 +163,9 @@ public function setReadTime($var) /** * A list of asset types of which to take a snapshot for. For example: - * "compute.googleapis.com/Disk". If specified, only matching assets will be returned. - * See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + * "compute.googleapis.com/Disk". If specified, only matching assets will be + * returned. See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/asset-inventory/docs/overview) * for all supported asset types. * * Generated from protobuf field repeated string asset_types = 3; @@ -178,9 +178,9 @@ public function getAssetTypes() /** * A list of asset types of which to take a snapshot for. For example: - * "compute.googleapis.com/Disk". If specified, only matching assets will be returned. - * See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + * "compute.googleapis.com/Disk". If specified, only matching assets will be + * returned. See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/asset-inventory/docs/overview) * for all supported asset types. * * Generated from protobuf field repeated string asset_types = 3; @@ -227,7 +227,7 @@ public function setContentType($var) * Required. Output configuration indicating where the results will be output * to. All results will be in newline delimited JSON format. * - * Generated from protobuf field .google.cloud.asset.v1.OutputConfig output_config = 5; + * Generated from protobuf field .google.cloud.asset.v1.OutputConfig output_config = 5 [(.google.api.field_behavior) = REQUIRED]; * @return \Google\Cloud\Asset\V1\OutputConfig */ public function getOutputConfig() @@ -239,7 +239,7 @@ public function getOutputConfig() * Required. Output configuration indicating where the results will be output * to. All results will be in newline delimited JSON format. * - * Generated from protobuf field .google.cloud.asset.v1.OutputConfig output_config = 5; + * Generated from protobuf field .google.cloud.asset.v1.OutputConfig output_config = 5 [(.google.api.field_behavior) = REQUIRED]; * @param \Google\Cloud\Asset\V1\OutputConfig $var * @return $this */ diff --git a/Asset/src/V1/Gapic/AssetServiceGapicClient.php b/Asset/src/V1/Gapic/AssetServiceGapicClient.php index d28ff064ab10..fc4a0d10c6a4 100644 --- a/Asset/src/V1/Gapic/AssetServiceGapicClient.php +++ b/Asset/src/V1/Gapic/AssetServiceGapicClient.php @@ -389,9 +389,9 @@ public function __construct(array $options = []) * query may get different results. * @type string[] $assetTypes * A list of asset types of which to take a snapshot for. For example: - * "compute.googleapis.com/Disk". If specified, only matching assets will be returned. - * See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + * "compute.googleapis.com/Disk". If specified, only matching assets will be + * returned. See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/asset-inventory/docs/overview) * for all supported asset types. * @type int $contentType * Asset content type. If not specified, no content but the asset name will be @@ -464,7 +464,7 @@ public function exportAssets($parent, $outputConfig, array $optionalArgs = []) * @param string $parent Required. The relative name of the root asset. It can only be an * organization number (such as "organizations/123"), a project ID (such as * "projects/my-project-id")", or a project number (such as "projects/12345"). - * @param int $contentType Required. The content type. + * @param int $contentType Optional. The content type. * For allowed values, use constants defined on {@see \Google\Cloud\Asset\V1\ContentType} * @param TimeWindow $readTimeWindow Optional. The time window for the asset history. Both start_time and * end_time are optional and if set, it must be after 2018-10-02 UTC. If @@ -480,7 +480,8 @@ public function exportAssets($parent, $outputConfig, array $optionalArgs = []) * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. * See [Resource * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - * and [Resource Name Format](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/resource-name-format) + * and [Resource Name + * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) * for more info. * * The request becomes a no-op if the asset name list is empty, and the max diff --git a/Asset/src/V1/GcsDestination.php b/Asset/src/V1/GcsDestination.php index b02dbe3eb9ca..7924e9beb5b5 100644 --- a/Asset/src/V1/GcsDestination.php +++ b/Asset/src/V1/GcsDestination.php @@ -29,6 +29,16 @@ class GcsDestination extends \Google\Protobuf\Internal\Message * Editing Object * Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) * for more information. + * @type string $uri_prefix + * The uri prefix of all generated Cloud Storage objects. For example: + * "gs://bucket_name/object_name_prefix". Each object uri is in format: + * "gs://bucket_name/object_name_prefix// and only + * contains assets for that type. starts from 0. For example: + * "gs://bucket_name/object_name_prefix/compute.googleapis.com/Disk/0" is + * the first shard of output objects containing all + * compute.googleapis.com/Disk assets. An INVALID_ARGUMENT error will be + * returned if file with the same name "gs://bucket_name/object_name_prefix" + * already exists. * } */ public function __construct($data = NULL) { @@ -70,6 +80,48 @@ public function setUri($var) return $this; } + /** + * The uri prefix of all generated Cloud Storage objects. For example: + * "gs://bucket_name/object_name_prefix". Each object uri is in format: + * "gs://bucket_name/object_name_prefix// and only + * contains assets for that type. starts from 0. For example: + * "gs://bucket_name/object_name_prefix/compute.googleapis.com/Disk/0" is + * the first shard of output objects containing all + * compute.googleapis.com/Disk assets. An INVALID_ARGUMENT error will be + * returned if file with the same name "gs://bucket_name/object_name_prefix" + * already exists. + * + * Generated from protobuf field string uri_prefix = 2; + * @return string + */ + public function getUriPrefix() + { + return $this->readOneof(2); + } + + /** + * The uri prefix of all generated Cloud Storage objects. For example: + * "gs://bucket_name/object_name_prefix". Each object uri is in format: + * "gs://bucket_name/object_name_prefix// and only + * contains assets for that type. starts from 0. For example: + * "gs://bucket_name/object_name_prefix/compute.googleapis.com/Disk/0" is + * the first shard of output objects containing all + * compute.googleapis.com/Disk assets. An INVALID_ARGUMENT error will be + * returned if file with the same name "gs://bucket_name/object_name_prefix" + * already exists. + * + * Generated from protobuf field string uri_prefix = 2; + * @param string $var + * @return $this + */ + public function setUriPrefix($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + /** * @return string */ diff --git a/Asset/src/V1/OutputConfig.php b/Asset/src/V1/OutputConfig.php index 05d71948e4c2..2724c9c7f5d7 100644 --- a/Asset/src/V1/OutputConfig.php +++ b/Asset/src/V1/OutputConfig.php @@ -25,6 +25,11 @@ class OutputConfig extends \Google\Protobuf\Internal\Message * * @type \Google\Cloud\Asset\V1\GcsDestination $gcs_destination * Destination on Cloud Storage. + * @type \Google\Cloud\Asset\V1\BigQueryDestination $bigquery_destination + * Destination on BigQuery. The output table stores the fields in asset + * proto as columns in BigQuery. The resource/iam_policy field is converted + * to a record with each field to a column, except metadata to a single JSON + * string. * } */ public function __construct($data = NULL) { @@ -58,6 +63,38 @@ public function setGcsDestination($var) return $this; } + /** + * Destination on BigQuery. The output table stores the fields in asset + * proto as columns in BigQuery. The resource/iam_policy field is converted + * to a record with each field to a column, except metadata to a single JSON + * string. + * + * Generated from protobuf field .google.cloud.asset.v1.BigQueryDestination bigquery_destination = 2; + * @return \Google\Cloud\Asset\V1\BigQueryDestination + */ + public function getBigqueryDestination() + { + return $this->readOneof(2); + } + + /** + * Destination on BigQuery. The output table stores the fields in asset + * proto as columns in BigQuery. The resource/iam_policy field is converted + * to a record with each field to a column, except metadata to a single JSON + * string. + * + * Generated from protobuf field .google.cloud.asset.v1.BigQueryDestination bigquery_destination = 2; + * @param \Google\Cloud\Asset\V1\BigQueryDestination $var + * @return $this + */ + public function setBigqueryDestination($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\BigQueryDestination::class); + $this->writeOneof(2, $var); + + return $this; + } + /** * @return string */ diff --git a/Asset/src/V1/resources/asset_service_rest_client_config.php b/Asset/src/V1/resources/asset_service_rest_client_config.php index b4e65a5f6507..d780466d18f5 100644 --- a/Asset/src/V1/resources/asset_service_rest_client_config.php +++ b/Asset/src/V1/resources/asset_service_rest_client_config.php @@ -27,36 +27,5 @@ ], ], ], - 'google.longrunning.Operations' => [ - 'GetOperation' => [ - 'method' => 'get', - 'uriTemplate' => '/v1beta1/{name=projects/*/operations/*/**}', - 'additionalBindings' => [ - [ - 'method' => 'get', - 'uriTemplate' => '/v1beta1/{name=folders/*/operations/*/**}', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1beta1/{name=organizations/*/operations/*/**}', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1p1alpha1/{name=*/*/operations/*/**}', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=*/*/operations/*/**}', - ], - ], - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], ], ]; diff --git a/Asset/synth.metadata b/Asset/synth.metadata index 38ea0617b1cc..feb207dd4e1b 100644 --- a/Asset/synth.metadata +++ b/Asset/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-08-07T17:57:35.563124Z", + "updateTime": "2019-11-14T10:58:43.454776Z", "sources": [ { "generator": { "name": "artman", - "version": "0.29.1", - "dockerImage": "googleapis/artman@sha256:b2a73f4dda03ef8fcaa973e3ba26d0cf34091f6c22c70add663af325931aef4d" + "version": "0.41.1", + "dockerImage": "googleapis/artman@sha256:545c758c76c3f779037aa259023ec3d1ef2d57d2c8cd00a222cb187d63ceac5e" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "3a1b46a6668194a527e532a2c355b404c79b0e6a", - "internalRef": "262167956" + "sha": "bc76ffd87360ce1cd34e3a6eac28afd5e1efda76", + "internalRef": "280356106" } } ], From 42f2fce13ddc9411ba1433736bad2a8300dc4037 Mon Sep 17 00:00:00 2001 From: David Supplee Date: Tue, 17 Dec 2019 12:22:07 -0800 Subject: [PATCH 2/4] regenerate --- Asset/metadata/V1/AssetService.php | 130 ++++-- Asset/metadata/V1/Assets.php | 65 +-- Asset/src/V1/Asset.php | 50 +++ Asset/src/V1/AssetServiceGrpcClient.php | 71 ++++ Asset/src/V1/CreateFeedRequest.php | 171 ++++++++ Asset/src/V1/DeleteFeedRequest.php | 77 ++++ Asset/src/V1/Feed.php | 287 +++++++++++++ Asset/src/V1/FeedOutputConfig.php | 70 ++++ .../src/V1/Gapic/AssetServiceGapicClient.php | 320 +++++++++++++++ Asset/src/V1/GetFeedRequest.php | 79 ++++ Asset/src/V1/ListFeedsRequest.php | 75 ++++ Asset/src/V1/ListFeedsResponse.php | 65 +++ Asset/src/V1/PubsubDestination.php | 71 ++++ Asset/src/V1/UpdateFeedRequest.php | 125 ++++++ .../asset_service_client_config.json | 25 ++ .../asset_service_rest_client_config.php | 58 +++ Asset/synth.metadata | 10 +- .../tests/Unit/V1/AssetServiceClientTest.php | 379 ++++++++++++++++++ 18 files changed, 2053 insertions(+), 75 deletions(-) create mode 100644 Asset/src/V1/CreateFeedRequest.php create mode 100644 Asset/src/V1/DeleteFeedRequest.php create mode 100644 Asset/src/V1/Feed.php create mode 100644 Asset/src/V1/FeedOutputConfig.php create mode 100644 Asset/src/V1/GetFeedRequest.php create mode 100644 Asset/src/V1/ListFeedsRequest.php create mode 100644 Asset/src/V1/ListFeedsResponse.php create mode 100644 Asset/src/V1/PubsubDestination.php create mode 100644 Asset/src/V1/UpdateFeedRequest.php diff --git a/Asset/metadata/V1/AssetService.php b/Asset/metadata/V1/AssetService.php index 0c0cf14990f9..99c42fc4917b 100644 --- a/Asset/metadata/V1/AssetService.php +++ b/Asset/metadata/V1/AssetService.php @@ -24,7 +24,7 @@ public static function initOnce() { \GPBMetadata\Google\Protobuf\FieldMask::initOnce(); \GPBMetadata\Google\Protobuf\Timestamp::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0ae9100a29676f6f676c652f636c6f75642f61737365742f76312f617373" . + "0abb1d0a29676f6f676c652f636c6f75642f61737365742f76312f617373" . "65745f736572766963652e70726f746f1215676f6f676c652e636c6f7564" . "2e61737365742e76311a17676f6f676c652f6170692f636c69656e742e70" . "726f746f1a1f676f6f676c652f6170692f6669656c645f6265686176696f" . @@ -59,43 +59,97 @@ public static function initOnce() { "6f774203e0410122550a1d4261746368476574417373657473486973746f" . "7279526573706f6e736512340a0661737365747318012003280b32242e67" . "6f6f676c652e636c6f75642e61737365742e76312e54656d706f72616c41" . - "7373657422ab010a0c4f7574707574436f6e66696712400a0f6763735f64" . - "657374696e6174696f6e18012001280b32252e676f6f676c652e636c6f75" . - "642e61737365742e76312e47637344657374696e6174696f6e4800124a0a" . - "1462696771756572795f64657374696e6174696f6e18022001280b322a2e" . - "676f6f676c652e636c6f75642e61737365742e76312e4269675175657279" . - "44657374696e6174696f6e4800420d0a0b64657374696e6174696f6e2243" . - "0a0e47637344657374696e6174696f6e120d0a0375726918012001280948" . - "0012140a0a7572695f7072656669781802200128094800420c0a0a6f626a" . - "6563745f757269224e0a13426967517565727944657374696e6174696f6e" . - "12140a07646174617365741801200128094203e0410212120a057461626c" . - "651802200128094203e04102120d0a05666f7263651803200128082a6c0a" . - "0b436f6e74656e7454797065121c0a18434f4e54454e545f545950455f55" . - "4e5350454349464945441000120c0a085245534f555243451001120e0a0a" . - "49414d5f504f4c4943591002120e0a0a4f52475f504f4c49435910041211" . - "0a0d4143434553535f504f4c494359100532f3030a0c4173736574536572" . - "7669636512de010a0c4578706f7274417373657473122a2e676f6f676c65" . - "2e636c6f75642e61737365742e76312e4578706f72744173736574735265" . - "71756573741a1d2e676f6f676c652e6c6f6e6772756e6e696e672e4f7065" . - "726174696f6e22820182d3e4930222221d2f76312f7b706172656e743d2a" . - "2f2a7d3a6578706f72744173736574733a012aca41570a2a676f6f676c65" . - "2e636c6f75642e61737365742e76312e4578706f72744173736574735265" . - "73706f6e73651229676f6f676c652e636c6f75642e61737365742e76312e" . - "4578706f72744173736574735265717565737412b2010a15426174636847" . - "6574417373657473486973746f727912332e676f6f676c652e636c6f7564" . - "2e61737365742e76312e4261746368476574417373657473486973746f72" . - "79526571756573741a342e676f6f676c652e636c6f75642e61737365742e" . - "76312e4261746368476574417373657473486973746f7279526573706f6e" . - "7365222e82d3e493022812262f76312f7b706172656e743d2a2f2a7d3a62" . - "61746368476574417373657473486973746f72791a4dca4119636c6f7564" . - "61737365742e676f6f676c65617069732e636f6dd2412e68747470733a2f" . - "2f7777772e676f6f676c65617069732e636f6d2f617574682f636c6f7564" . - "2d706c6174666f726d429c010a19636f6d2e676f6f676c652e636c6f7564" . - "2e61737365742e7631421141737365745365727669636550726f746f5001" . - "5a3a676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f67" . - "6f6f676c65617069732f636c6f75642f61737365742f76313b6173736574" . - "aa0215476f6f676c652e436c6f75642e41737365742e5631ca0215476f6f" . - "676c655c436c6f75645c41737365745c5631620670726f746f33" + "73736574226e0a11437265617465466565645265717565737412130a0670" . + "6172656e741801200128094203e0410212140a07666565645f6964180220" . + "0128094203e04102122e0a046665656418032001280b321b2e676f6f676c" . + "652e636c6f75642e61737365742e76312e466565644203e0410222460a0e" . + "476574466565645265717565737412340a046e616d651801200128094226" . + "e04102fa41200a1e636c6f756461737365742e676f6f676c65617069732e" . + "636f6d2f4665656422270a104c6973744665656473526571756573741213" . + "0a06706172656e741801200128094203e04102223f0a114c697374466565" . + "6473526573706f6e7365122a0a05666565647318012003280b321b2e676f" . + "6f676c652e636c6f75642e61737365742e76312e4665656422790a115570" . + "646174654665656452657175657374122e0a046665656418012001280b32" . + "1b2e676f6f676c652e636c6f75642e61737365742e76312e466565644203" . + "e0410212340a0b7570646174655f6d61736b18022001280b321a2e676f6f" . + "676c652e70726f746f6275662e4669656c644d61736b4203e0410222490a" . + "1144656c657465466565645265717565737412340a046e616d6518012001" . + "28094226e04102fa41200a1e636c6f756461737365742e676f6f676c6561" . + "7069732e636f6d2f4665656422ab010a0c4f7574707574436f6e66696712" . + "400a0f6763735f64657374696e6174696f6e18012001280b32252e676f6f" . + "676c652e636c6f75642e61737365742e76312e47637344657374696e6174" . + "696f6e4800124a0a1462696771756572795f64657374696e6174696f6e18" . + "022001280b322a2e676f6f676c652e636c6f75642e61737365742e76312e" . + "426967517565727944657374696e6174696f6e4800420d0a0b6465737469" . + "6e6174696f6e22430a0e47637344657374696e6174696f6e120d0a037572" . + "69180120012809480012140a0a7572695f70726566697818022001280948" . + "00420c0a0a6f626a6563745f757269224e0a134269675175657279446573" . + "74696e6174696f6e12140a07646174617365741801200128094203e04102" . + "12120a057461626c651802200128094203e04102120d0a05666f72636518" . + "032001280822220a1150756273756244657374696e6174696f6e120d0a05" . + "746f70696318012001280922690a10466565644f7574707574436f6e6669" . + "6712460a127075627375625f64657374696e6174696f6e18012001280b32" . + "282e676f6f676c652e636c6f75642e61737365742e76312e507562737562" . + "44657374696e6174696f6e4800420d0a0b64657374696e6174696f6e22db" . + "020a044665656412110a046e616d651801200128094203e0410212130a0b" . + "61737365745f6e616d657318022003280912130a0b61737365745f747970" . + "657318032003280912380a0c636f6e74656e745f7479706518042001280e" . + "32222e676f6f676c652e636c6f75642e61737365742e76312e436f6e7465" . + "6e745479706512480a12666565645f6f75747075745f636f6e6669671805" . + "2001280b32272e676f6f676c652e636c6f75642e61737365742e76312e46" . + "6565644f7574707574436f6e6669674203e041023a9101ea418d010a1e63" . + "6c6f756461737365742e676f6f676c65617069732e636f6d2f4665656412" . + "1f70726f6a656374732f7b70726f6a6563747d2f66656564732f7b666565" . + "647d121d666f6c646572732f7b666f6c6465727d2f66656564732f7b6665" . + "65647d12296f7267616e697a6174696f6e732f7b6f7267616e697a617469" . + "6f6e7d2f66656564732f7b666565647d20012a6c0a0b436f6e74656e7454" . + "797065121c0a18434f4e54454e545f545950455f554e5350454349464945" . + "441000120c0a085245534f555243451001120e0a0a49414d5f504f4c4943" . + "591002120e0a0a4f52475f504f4c494359100412110a0d4143434553535f" . + "504f4c494359100532f0080a0c41737365745365727669636512de010a0c" . + "4578706f7274417373657473122a2e676f6f676c652e636c6f75642e6173" . + "7365742e76312e4578706f7274417373657473526571756573741a1d2e67" . + "6f6f676c652e6c6f6e6772756e6e696e672e4f7065726174696f6e228201" . + "82d3e4930222221d2f76312f7b706172656e743d2a2f2a7d3a6578706f72" . + "744173736574733a012aca41570a2a676f6f676c652e636c6f75642e6173" . + "7365742e76312e4578706f7274417373657473526573706f6e7365122967" . + "6f6f676c652e636c6f75642e61737365742e76312e4578706f7274417373" . + "6574735265717565737412b2010a15426174636847657441737365747348" . + "6973746f727912332e676f6f676c652e636c6f75642e61737365742e7631" . + "2e4261746368476574417373657473486973746f7279526571756573741a" . + "342e676f6f676c652e636c6f75642e61737365742e76312e426174636847" . + "6574417373657473486973746f7279526573706f6e7365222e82d3e49302" . + "2812262f76312f7b706172656e743d2a2f2a7d3a62617463684765744173" . + "73657473486973746f7279127f0a0a4372656174654665656412282e676f" . + "6f676c652e636c6f75642e61737365742e76312e43726561746546656564" . + "526571756573741a1b2e676f6f676c652e636c6f75642e61737365742e76" . + "312e46656564222a82d3e493021b22162f76312f7b706172656e743d2a2f" . + "2a7d2f66656564733a012ada4106706172656e7412740a07476574466565" . + "6412252e676f6f676c652e636c6f75642e61737365742e76312e47657446" . + "656564526571756573741a1b2e676f6f676c652e636c6f75642e61737365" . + "742e76312e46656564222582d3e493021812162f76312f7b6e616d653d2a" . + "2f2a2f66656564732f2a7dda41046e616d651287010a094c697374466565" . + "647312272e676f6f676c652e636c6f75642e61737365742e76312e4c6973" . + "744665656473526571756573741a282e676f6f676c652e636c6f75642e61" . + "737365742e76312e4c6973744665656473526573706f6e7365222782d3e4" . + "93021812162f76312f7b706172656e743d2a2f2a7d2f6665656473da4106" . + "706172656e741282010a0a5570646174654665656412282e676f6f676c65" . + "2e636c6f75642e61737365742e76312e5570646174654665656452657175" . + "6573741a1b2e676f6f676c652e636c6f75642e61737365742e76312e4665" . + "6564222d82d3e4930220321b2f76312f7b666565642e6e616d653d2a2f2a" . + "2f66656564732f2a7d3a012ada41046665656412750a0a44656c65746546" . + "65656412282e676f6f676c652e636c6f75642e61737365742e76312e4465" . + "6c65746546656564526571756573741a162e676f6f676c652e70726f746f" . + "6275662e456d707479222582d3e49302182a162f76312f7b6e616d653d2a" . + "2f2a2f66656564732f2a7dda41046e616d651a4dca4119636c6f75646173" . + "7365742e676f6f676c65617069732e636f6dd2412e68747470733a2f2f77" . + "77772e676f6f676c65617069732e636f6d2f617574682f636c6f75642d70" . + "6c6174666f726d429c010a19636f6d2e676f6f676c652e636c6f75642e61" . + "737365742e7631421141737365745365727669636550726f746f50015a3a" . + "676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f" . + "676c65617069732f636c6f75642f61737365742f76313b6173736574aa02" . + "15476f6f676c652e436c6f75642e41737365742e5631ca0215476f6f676c" . + "655c436c6f75645c41737365745c5631620670726f746f33" ), true); static::$is_initialized = true; diff --git a/Asset/metadata/V1/Assets.php b/Asset/metadata/V1/Assets.php index 0902fac9f328..f01df8c8de41 100644 --- a/Asset/metadata/V1/Assets.php +++ b/Asset/metadata/V1/Assets.php @@ -14,45 +14,46 @@ public static function initOnce() { if (static::$is_initialized == true) { return; } - \GPBMetadata\Google\Api\Annotations::initOnce(); \GPBMetadata\Google\Api\Resource::initOnce(); \GPBMetadata\Google\Iam\V1\Policy::initOnce(); \GPBMetadata\Google\Protobuf\Any::initOnce(); \GPBMetadata\Google\Protobuf\Struct::initOnce(); \GPBMetadata\Google\Protobuf\Timestamp::initOnce(); + \GPBMetadata\Google\Api\Annotations::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0ab4070a22676f6f676c652f636c6f75642f61737365742f76312f617373" . + "0aca070a22676f6f676c652f636c6f75642f61737365742f76312f617373" . "6574732e70726f746f1215676f6f676c652e636c6f75642e61737365742e" . - "76311a19676f6f676c652f6170692f7265736f757263652e70726f746f1a" . - "1a676f6f676c652f69616d2f76312f706f6c6963792e70726f746f1a1967" . - "6f6f676c652f70726f746f6275662f616e792e70726f746f1a1c676f6f67" . - "6c652f70726f746f6275662f7374727563742e70726f746f1a1f676f6f67" . - "6c652f70726f746f6275662f74696d657374616d702e70726f746f228001" . - "0a0d54656d706f72616c417373657412310a0677696e646f771801200128" . - "0b32212e676f6f676c652e636c6f75642e61737365742e76312e54696d65" . - "57696e646f77120f0a0764656c65746564180220012808122b0a05617373" . - "657418032001280b321c2e676f6f676c652e636c6f75642e61737365742e" . - "76312e4173736574226a0a0a54696d6557696e646f77122e0a0a73746172" . - "745f74696d6518012001280b321a2e676f6f676c652e70726f746f627566" . - "2e54696d657374616d70122c0a08656e645f74696d6518022001280b321a" . - "2e676f6f676c652e70726f746f6275662e54696d657374616d7022b0010a" . - "054173736574120c0a046e616d6518012001280912120a0a61737365745f" . - "7479706518022001280912310a087265736f7572636518032001280b321f" . - "2e676f6f676c652e636c6f75642e61737365742e76312e5265736f757263" . - "6512290a0a69616d5f706f6c69637918042001280b32152e676f6f676c65" . - "2e69616d2e76312e506f6c6963793a27ea41240a1f636c6f756461737365" . - "742e676f6f676c65617069732e636f6d2f417373657412012a22a0010a08" . - "5265736f75726365120f0a0776657273696f6e180120012809121e0a1664" . - "6973636f766572795f646f63756d656e745f75726918022001280912160a" . - "0e646973636f766572795f6e616d6518032001280912140a0c7265736f75" . - "7263655f75726c180420012809120e0a06706172656e7418052001280912" . - "250a046461746118062001280b32172e676f6f676c652e70726f746f6275" . - "662e5374727563744298010a19636f6d2e676f6f676c652e636c6f75642e" . - "61737365742e7631420a417373657450726f746f50015a3a676f6f676c65" . - "2e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c65617069" . - "732f636c6f75642f61737365742f76313b6173736574f80101aa0215476f" . - "6f676c652e436c6f75642e41737365742e5631ca0215476f6f676c655c43" . - "6c6f75645c41737365745c5631620670726f746f33" + "76311a1a676f6f676c652f69616d2f76312f706f6c6963792e70726f746f" . + "1a19676f6f676c652f70726f746f6275662f616e792e70726f746f1a1c67" . + "6f6f676c652f70726f746f6275662f7374727563742e70726f746f1a1f67" . + "6f6f676c652f70726f746f6275662f74696d657374616d702e70726f746f" . + "1a1c676f6f676c652f6170692f616e6e6f746174696f6e732e70726f746f" . + "2280010a0d54656d706f72616c417373657412310a0677696e646f771801" . + "2001280b32212e676f6f676c652e636c6f75642e61737365742e76312e54" . + "696d6557696e646f77120f0a0764656c65746564180220012808122b0a05" . + "617373657418032001280b321c2e676f6f676c652e636c6f75642e617373" . + "65742e76312e4173736574226a0a0a54696d6557696e646f77122e0a0a73" . + "746172745f74696d6518012001280b321a2e676f6f676c652e70726f746f" . + "6275662e54696d657374616d70122c0a08656e645f74696d651802200128" . + "0b321a2e676f6f676c652e70726f746f6275662e54696d657374616d7022" . + "c3010a054173736574120c0a046e616d6518012001280912120a0a617373" . + "65745f7479706518022001280912310a087265736f757263651803200128" . + "0b321f2e676f6f676c652e636c6f75642e61737365742e76312e5265736f" . + "7572636512290a0a69616d5f706f6c69637918042001280b32152e676f6f" . + "676c652e69616d2e76312e506f6c69637912110a09616e636573746f7273" . + "180a200328093a27ea41240a1f636c6f756461737365742e676f6f676c65" . + "617069732e636f6d2f417373657412012a22a0010a085265736f75726365" . + "120f0a0776657273696f6e180120012809121e0a16646973636f76657279" . + "5f646f63756d656e745f75726918022001280912160a0e646973636f7665" . + "72795f6e616d6518032001280912140a0c7265736f757263655f75726c18" . + "0420012809120e0a06706172656e7418052001280912250a046461746118" . + "062001280b32172e676f6f676c652e70726f746f6275662e537472756374" . + "4298010a19636f6d2e676f6f676c652e636c6f75642e61737365742e7631" . + "420a417373657450726f746f50015a3a676f6f676c652e676f6c616e672e" . + "6f72672f67656e70726f746f2f676f6f676c65617069732f636c6f75642f" . + "61737365742f76313b6173736574f80101aa0215476f6f676c652e436c6f" . + "75642e41737365742e5631ca0215476f6f676c655c436c6f75645c417373" . + "65745c5631620670726f746f33" ), true); static::$is_initialized = true; diff --git a/Asset/src/V1/Asset.php b/Asset/src/V1/Asset.php index 154529347efe..18c4a23950b8 100644 --- a/Asset/src/V1/Asset.php +++ b/Asset/src/V1/Asset.php @@ -45,6 +45,16 @@ class Asset extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.iam.v1.Policy iam_policy = 4; */ private $iam_policy = null; + /** + * Asset's ancestry path in Cloud Resource Manager (CRM) hierarchy, + * represented as a list of relative resource names. Ancestry path starts with + * the closest CRM ancestor and ends at root. If the asset is a CRM + * project/folder/organization, this starts from the asset itself. + * Example: ["projects/123456789", "folders/5432", "organizations/1234"] + * + * Generated from protobuf field repeated string ancestors = 10; + */ + private $ancestors; /** * Constructor. @@ -65,6 +75,12 @@ class Asset extends \Google\Protobuf\Internal\Message * @type \Google\Cloud\Iam\V1\Policy $iam_policy * Representation of the actual Cloud IAM policy set on a cloud resource. For * each resource, there must be at most one Cloud IAM policy set on it. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $ancestors + * Asset's ancestry path in Cloud Resource Manager (CRM) hierarchy, + * represented as a list of relative resource names. Ancestry path starts with + * the closest CRM ancestor and ends at root. If the asset is a CRM + * project/folder/organization, this starts from the asset itself. + * Example: ["projects/123456789", "folders/5432", "organizations/1234"] * } */ public function __construct($data = NULL) { @@ -186,5 +202,39 @@ public function setIamPolicy($var) return $this; } + /** + * Asset's ancestry path in Cloud Resource Manager (CRM) hierarchy, + * represented as a list of relative resource names. Ancestry path starts with + * the closest CRM ancestor and ends at root. If the asset is a CRM + * project/folder/organization, this starts from the asset itself. + * Example: ["projects/123456789", "folders/5432", "organizations/1234"] + * + * Generated from protobuf field repeated string ancestors = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAncestors() + { + return $this->ancestors; + } + + /** + * Asset's ancestry path in Cloud Resource Manager (CRM) hierarchy, + * represented as a list of relative resource names. Ancestry path starts with + * the closest CRM ancestor and ends at root. If the asset is a CRM + * project/folder/organization, this starts from the asset itself. + * Example: ["projects/123456789", "folders/5432", "organizations/1234"] + * + * Generated from protobuf field repeated string ancestors = 10; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAncestors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->ancestors = $arr; + + return $this; + } + } diff --git a/Asset/src/V1/AssetServiceGrpcClient.php b/Asset/src/V1/AssetServiceGrpcClient.php index 7b5f7ca91291..4574bc0d6dc2 100644 --- a/Asset/src/V1/AssetServiceGrpcClient.php +++ b/Asset/src/V1/AssetServiceGrpcClient.php @@ -70,4 +70,75 @@ public function BatchGetAssetsHistory(\Google\Cloud\Asset\V1\BatchGetAssetsHisto $metadata, $options); } + /** + * Creates a feed in a parent project/folder/organization to listen to its + * asset updates. + * @param \Google\Cloud\Asset\V1\CreateFeedRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function CreateFeed(\Google\Cloud\Asset\V1\CreateFeedRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.asset.v1.AssetService/CreateFeed', + $argument, + ['\Google\Cloud\Asset\V1\Feed', 'decode'], + $metadata, $options); + } + + /** + * Gets details about an asset feed. + * @param \Google\Cloud\Asset\V1\GetFeedRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function GetFeed(\Google\Cloud\Asset\V1\GetFeedRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.asset.v1.AssetService/GetFeed', + $argument, + ['\Google\Cloud\Asset\V1\Feed', 'decode'], + $metadata, $options); + } + + /** + * Lists all asset feeds in a parent project/folder/organization. + * @param \Google\Cloud\Asset\V1\ListFeedsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function ListFeeds(\Google\Cloud\Asset\V1\ListFeedsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.asset.v1.AssetService/ListFeeds', + $argument, + ['\Google\Cloud\Asset\V1\ListFeedsResponse', 'decode'], + $metadata, $options); + } + + /** + * Updates an asset feed configuration. + * @param \Google\Cloud\Asset\V1\UpdateFeedRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function UpdateFeed(\Google\Cloud\Asset\V1\UpdateFeedRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.asset.v1.AssetService/UpdateFeed', + $argument, + ['\Google\Cloud\Asset\V1\Feed', 'decode'], + $metadata, $options); + } + + /** + * Deletes an asset feed. + * @param \Google\Cloud\Asset\V1\DeleteFeedRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function DeleteFeed(\Google\Cloud\Asset\V1\DeleteFeedRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.asset.v1.AssetService/DeleteFeed', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + } diff --git a/Asset/src/V1/CreateFeedRequest.php b/Asset/src/V1/CreateFeedRequest.php new file mode 100644 index 000000000000..0872362ebb73 --- /dev/null +++ b/Asset/src/V1/CreateFeedRequest.php @@ -0,0 +1,171 @@ +google.cloud.asset.v1.CreateFeedRequest + */ +class CreateFeedRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the project/folder/organization where this feed + * should be created in. It can only be an organization number (such as + * "organizations/123"), a folder number (such as "folders/123"), a project ID + * (such as "projects/my-project-id")", or a project number (such as + * "projects/12345"). + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $parent = ''; + /** + * Required. This is the client-assigned asset feed identifier and it needs to + * be unique under a specific parent project/folder/organization. + * + * Generated from protobuf field string feed_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $feed_id = ''; + /** + * Required. The feed details. The field `name` must be empty and it will be generated + * in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_id + * + * Generated from protobuf field .google.cloud.asset.v1.Feed feed = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $feed = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the project/folder/organization where this feed + * should be created in. It can only be an organization number (such as + * "organizations/123"), a folder number (such as "folders/123"), a project ID + * (such as "projects/my-project-id")", or a project number (such as + * "projects/12345"). + * @type string $feed_id + * Required. This is the client-assigned asset feed identifier and it needs to + * be unique under a specific parent project/folder/organization. + * @type \Google\Cloud\Asset\V1\Feed $feed + * Required. The feed details. The field `name` must be empty and it will be generated + * in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_id + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Asset\V1\AssetService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the project/folder/organization where this feed + * should be created in. It can only be an organization number (such as + * "organizations/123"), a folder number (such as "folders/123"), a project ID + * (such as "projects/my-project-id")", or a project number (such as + * "projects/12345"). + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the project/folder/organization where this feed + * should be created in. It can only be an organization number (such as + * "organizations/123"), a folder number (such as "folders/123"), a project ID + * (such as "projects/my-project-id")", or a project number (such as + * "projects/12345"). + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. This is the client-assigned asset feed identifier and it needs to + * be unique under a specific parent project/folder/organization. + * + * Generated from protobuf field string feed_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFeedId() + { + return $this->feed_id; + } + + /** + * Required. This is the client-assigned asset feed identifier and it needs to + * be unique under a specific parent project/folder/organization. + * + * Generated from protobuf field string feed_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFeedId($var) + { + GPBUtil::checkString($var, True); + $this->feed_id = $var; + + return $this; + } + + /** + * Required. The feed details. The field `name` must be empty and it will be generated + * in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_id + * + * Generated from protobuf field .google.cloud.asset.v1.Feed feed = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Asset\V1\Feed + */ + public function getFeed() + { + return $this->feed; + } + + /** + * Required. The feed details. The field `name` must be empty and it will be generated + * in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_id + * + * Generated from protobuf field .google.cloud.asset.v1.Feed feed = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Asset\V1\Feed $var + * @return $this + */ + public function setFeed($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\Feed::class); + $this->feed = $var; + + return $this; + } + +} + diff --git a/Asset/src/V1/DeleteFeedRequest.php b/Asset/src/V1/DeleteFeedRequest.php new file mode 100644 index 000000000000..a2c8d24184e1 --- /dev/null +++ b/Asset/src/V1/DeleteFeedRequest.php @@ -0,0 +1,77 @@ +google.cloud.asset.v1.DeleteFeedRequest + */ +class DeleteFeedRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the feed and it must be in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_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. The name of the feed and it must be in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_id + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Asset\V1\AssetService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the feed and it must be in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_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 name of the feed and it must be in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_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/Asset/src/V1/Feed.php b/Asset/src/V1/Feed.php new file mode 100644 index 000000000000..aa4527076c6b --- /dev/null +++ b/Asset/src/V1/Feed.php @@ -0,0 +1,287 @@ +google.cloud.asset.v1.Feed + */ +class Feed extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The format will be + * projects/{project_number}/feeds/{client-assigned_feed_identifier} or + * folders/{folder_number}/feeds/{client-assigned_feed_identifier} or + * organizations/{organization_number}/feeds/{client-assigned_feed_identifier} + * The client-assigned feed identifier must be unique within the parent + * project/folder/organization. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $name = ''; + /** + * A list of the full names of the assets to receive updates. You must specify + * either or both of asset_names and asset_types. Only asset updates matching + * specified asset_names and asset_types are exported to the feed. For + * example: + * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + * See [Resource + * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + * for more info. + * + * Generated from protobuf field repeated string asset_names = 2; + */ + private $asset_names; + /** + * A list of types of the assets to receive updates. You must specify either + * or both of asset_names and asset_types. Only asset updates matching + * specified asset_names and asset_types are exported to the feed. + * For example: + * "compute.googleapis.com/Disk" See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + * for all supported asset types. + * + * Generated from protobuf field repeated string asset_types = 3; + */ + private $asset_types; + /** + * Asset content type. If not specified, no content but the asset name and + * type will be returned. + * + * Generated from protobuf field .google.cloud.asset.v1.ContentType content_type = 4; + */ + private $content_type = 0; + /** + * Required. Feed output configuration defining where the asset updates are + * published to. + * + * Generated from protobuf field .google.cloud.asset.v1.FeedOutputConfig feed_output_config = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + private $feed_output_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The format will be + * projects/{project_number}/feeds/{client-assigned_feed_identifier} or + * folders/{folder_number}/feeds/{client-assigned_feed_identifier} or + * organizations/{organization_number}/feeds/{client-assigned_feed_identifier} + * The client-assigned feed identifier must be unique within the parent + * project/folder/organization. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $asset_names + * A list of the full names of the assets to receive updates. You must specify + * either or both of asset_names and asset_types. Only asset updates matching + * specified asset_names and asset_types are exported to the feed. For + * example: + * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + * See [Resource + * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + * for more info. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $asset_types + * A list of types of the assets to receive updates. You must specify either + * or both of asset_names and asset_types. Only asset updates matching + * specified asset_names and asset_types are exported to the feed. + * For example: + * "compute.googleapis.com/Disk" See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + * for all supported asset types. + * @type int $content_type + * Asset content type. If not specified, no content but the asset name and + * type will be returned. + * @type \Google\Cloud\Asset\V1\FeedOutputConfig $feed_output_config + * Required. Feed output configuration defining where the asset updates are + * published to. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Asset\V1\AssetService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The format will be + * projects/{project_number}/feeds/{client-assigned_feed_identifier} or + * folders/{folder_number}/feeds/{client-assigned_feed_identifier} or + * organizations/{organization_number}/feeds/{client-assigned_feed_identifier} + * The client-assigned feed identifier must be unique within the parent + * project/folder/organization. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The format will be + * projects/{project_number}/feeds/{client-assigned_feed_identifier} or + * folders/{folder_number}/feeds/{client-assigned_feed_identifier} or + * organizations/{organization_number}/feeds/{client-assigned_feed_identifier} + * The client-assigned feed identifier must be unique within the parent + * project/folder/organization. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A list of the full names of the assets to receive updates. You must specify + * either or both of asset_names and asset_types. Only asset updates matching + * specified asset_names and asset_types are exported to the feed. For + * example: + * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + * See [Resource + * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + * for more info. + * + * Generated from protobuf field repeated string asset_names = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAssetNames() + { + return $this->asset_names; + } + + /** + * A list of the full names of the assets to receive updates. You must specify + * either or both of asset_names and asset_types. Only asset updates matching + * specified asset_names and asset_types are exported to the feed. For + * example: + * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + * See [Resource + * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + * for more info. + * + * Generated from protobuf field repeated string asset_names = 2; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAssetNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->asset_names = $arr; + + return $this; + } + + /** + * A list of types of the assets to receive updates. You must specify either + * or both of asset_names and asset_types. Only asset updates matching + * specified asset_names and asset_types are exported to the feed. + * For example: + * "compute.googleapis.com/Disk" See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + * for all supported asset types. + * + * Generated from protobuf field repeated string asset_types = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAssetTypes() + { + return $this->asset_types; + } + + /** + * A list of types of the assets to receive updates. You must specify either + * or both of asset_names and asset_types. Only asset updates matching + * specified asset_names and asset_types are exported to the feed. + * For example: + * "compute.googleapis.com/Disk" See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + * for all supported asset types. + * + * Generated from protobuf field repeated string asset_types = 3; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAssetTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->asset_types = $arr; + + return $this; + } + + /** + * Asset content type. If not specified, no content but the asset name and + * type will be returned. + * + * Generated from protobuf field .google.cloud.asset.v1.ContentType content_type = 4; + * @return int + */ + public function getContentType() + { + return $this->content_type; + } + + /** + * Asset content type. If not specified, no content but the asset name and + * type will be returned. + * + * Generated from protobuf field .google.cloud.asset.v1.ContentType content_type = 4; + * @param int $var + * @return $this + */ + public function setContentType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Asset\V1\ContentType::class); + $this->content_type = $var; + + return $this; + } + + /** + * Required. Feed output configuration defining where the asset updates are + * published to. + * + * Generated from protobuf field .google.cloud.asset.v1.FeedOutputConfig feed_output_config = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Asset\V1\FeedOutputConfig + */ + public function getFeedOutputConfig() + { + return $this->feed_output_config; + } + + /** + * Required. Feed output configuration defining where the asset updates are + * published to. + * + * Generated from protobuf field .google.cloud.asset.v1.FeedOutputConfig feed_output_config = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Asset\V1\FeedOutputConfig $var + * @return $this + */ + public function setFeedOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\FeedOutputConfig::class); + $this->feed_output_config = $var; + + return $this; + } + +} + diff --git a/Asset/src/V1/FeedOutputConfig.php b/Asset/src/V1/FeedOutputConfig.php new file mode 100644 index 000000000000..27ae5263d169 --- /dev/null +++ b/Asset/src/V1/FeedOutputConfig.php @@ -0,0 +1,70 @@ +google.cloud.asset.v1.FeedOutputConfig + */ +class FeedOutputConfig extends \Google\Protobuf\Internal\Message +{ + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Asset\V1\PubsubDestination $pubsub_destination + * Destination on Cloud Pubsub. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Asset\V1\AssetService::initOnce(); + parent::__construct($data); + } + + /** + * Destination on Cloud Pubsub. + * + * Generated from protobuf field .google.cloud.asset.v1.PubsubDestination pubsub_destination = 1; + * @return \Google\Cloud\Asset\V1\PubsubDestination + */ + public function getPubsubDestination() + { + return $this->readOneof(1); + } + + /** + * Destination on Cloud Pubsub. + * + * Generated from protobuf field .google.cloud.asset.v1.PubsubDestination pubsub_destination = 1; + * @param \Google\Cloud\Asset\V1\PubsubDestination $var + * @return $this + */ + public function setPubsubDestination($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\PubsubDestination::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/Asset/src/V1/Gapic/AssetServiceGapicClient.php b/Asset/src/V1/Gapic/AssetServiceGapicClient.php index fc4a0d10c6a4..65f0ed25c40c 100644 --- a/Asset/src/V1/Gapic/AssetServiceGapicClient.php +++ b/Asset/src/V1/Gapic/AssetServiceGapicClient.php @@ -40,10 +40,19 @@ use Google\Cloud\Asset\V1\BatchGetAssetsHistoryRequest; use Google\Cloud\Asset\V1\BatchGetAssetsHistoryResponse; use Google\Cloud\Asset\V1\ContentType; +use Google\Cloud\Asset\V1\CreateFeedRequest; +use Google\Cloud\Asset\V1\DeleteFeedRequest; use Google\Cloud\Asset\V1\ExportAssetsRequest; +use Google\Cloud\Asset\V1\Feed; +use Google\Cloud\Asset\V1\GetFeedRequest; +use Google\Cloud\Asset\V1\ListFeedsRequest; +use Google\Cloud\Asset\V1\ListFeedsResponse; use Google\Cloud\Asset\V1\OutputConfig; use Google\Cloud\Asset\V1\TimeWindow; +use Google\Cloud\Asset\V1\UpdateFeedRequest; use Google\LongRunning\Operation; +use Google\Protobuf\FieldMask; +use Google\Protobuf\GPBEmpty; use Google\Protobuf\Timestamp; /** @@ -128,6 +137,7 @@ class AssetServiceGapicClient public static $serviceScopes = [ 'https://www.googleapis.com/auth/cloud-platform', ]; + private static $feedNameTemplate; private static $projectNameTemplate; private static $pathTemplateMap; @@ -152,6 +162,15 @@ private static function getClientDefaults() ]; } + private static function getFeedNameTemplate() + { + if (null == self::$feedNameTemplate) { + self::$feedNameTemplate = new PathTemplate('projects/{project}/feeds/{feed}'); + } + + return self::$feedNameTemplate; + } + private static function getProjectNameTemplate() { if (null == self::$projectNameTemplate) { @@ -165,6 +184,7 @@ private static function getPathTemplateMap() { if (null == self::$pathTemplateMap) { self::$pathTemplateMap = [ + 'feed' => self::getFeedNameTemplate(), 'project' => self::getProjectNameTemplate(), ]; } @@ -172,6 +192,24 @@ private static function getPathTemplateMap() return self::$pathTemplateMap; } + /** + * Formats a string containing the fully-qualified path to represent + * a feed resource. + * + * @param string $project + * @param string $feed + * + * @return string The formatted feed resource. + * @experimental + */ + public static function feedName($project, $feed) + { + return self::getFeedNameTemplate()->render([ + 'project' => $project, + 'feed' => $feed, + ]); + } + /** * Formats a string containing the fully-qualified path to represent * a project resource. @@ -192,6 +230,7 @@ public static function projectName($project) * Parses a formatted name string and returns an associative array of the components in the name. * The following name formats are supported: * Template: Pattern + * - feed: projects/{project}/feeds/{feed} * - project: projects/{project}. * * The optional $template argument can be supplied to specify a particular pattern, and must @@ -522,4 +561,285 @@ public function batchGetAssetsHistory($parent, $contentType, $readTimeWindow, ar $request )->wait(); } + + /** + * Creates a feed in a parent project/folder/organization to listen to its + * asset updates. + * + * Sample code: + * ``` + * $assetServiceClient = new AssetServiceClient(); + * try { + * $parent = ''; + * $feedId = ''; + * $feed = new Feed(); + * $response = $assetServiceClient->createFeed($parent, $feedId, $feed); + * } finally { + * $assetServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the project/folder/organization where this feed + * should be created in. It can only be an organization number (such as + * "organizations/123"), a folder number (such as "folders/123"), a project ID + * (such as "projects/my-project-id")", or a project number (such as + * "projects/12345"). + * @param string $feedId Required. This is the client-assigned asset feed identifier and it needs to + * be unique under a specific parent project/folder/organization. + * @param Feed $feed Required. The feed details. The field `name` must be empty and it will be generated + * in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_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\Asset\V1\Feed + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function createFeed($parent, $feedId, $feed, array $optionalArgs = []) + { + $request = new CreateFeedRequest(); + $request->setParent($parent); + $request->setFeedId($feedId); + $request->setFeed($feed); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'CreateFeed', + Feed::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Gets details about an asset feed. + * + * Sample code: + * ``` + * $assetServiceClient = new AssetServiceClient(); + * try { + * $formattedName = $assetServiceClient->feedName('[PROJECT]', '[FEED]'); + * $response = $assetServiceClient->getFeed($formattedName); + * } finally { + * $assetServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the Feed and it must be in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_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\Asset\V1\Feed + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function getFeed($name, array $optionalArgs = []) + { + $request = new GetFeedRequest(); + $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( + 'GetFeed', + Feed::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Lists all asset feeds in a parent project/folder/organization. + * + * Sample code: + * ``` + * $assetServiceClient = new AssetServiceClient(); + * try { + * $parent = ''; + * $response = $assetServiceClient->listFeeds($parent); + * } finally { + * $assetServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent project/folder/organization whose feeds are to be + * listed. It can only be using project/folder/organization number (such as + * "folders/12345")", or a project ID (such as "projects/my-project-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\Asset\V1\ListFeedsResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function listFeeds($parent, array $optionalArgs = []) + { + $request = new ListFeedsRequest(); + $request->setParent($parent); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'ListFeeds', + ListFeedsResponse::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Updates an asset feed configuration. + * + * Sample code: + * ``` + * $assetServiceClient = new AssetServiceClient(); + * try { + * $feed = new Feed(); + * $updateMask = new FieldMask(); + * $response = $assetServiceClient->updateFeed($feed, $updateMask); + * } finally { + * $assetServiceClient->close(); + * } + * ``` + * + * @param Feed $feed Required. The new values of feed details. It must match an existing feed and the + * field `name` must be in the format of: + * projects/project_number/feeds/feed_id or + * folders/folder_number/feeds/feed_id or + * organizations/organization_number/feeds/feed_id. + * @param FieldMask $updateMask Required. Only updates the `feed` fields indicated by this mask. + * The field mask must not be empty, and it must not contain fields that + * are immutable or only set by the server. + * @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\Asset\V1\Feed + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function updateFeed($feed, $updateMask, array $optionalArgs = []) + { + $request = new UpdateFeedRequest(); + $request->setFeed($feed); + $request->setUpdateMask($updateMask); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'feed.name' => $request->getFeed()->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + + return $this->startCall( + 'UpdateFeed', + Feed::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Deletes an asset feed. + * + * Sample code: + * ``` + * $assetServiceClient = new AssetServiceClient(); + * try { + * $formattedName = $assetServiceClient->feedName('[PROJECT]', '[FEED]'); + * $assetServiceClient->deleteFeed($formattedName); + * } finally { + * $assetServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the feed and it must be in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_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 deleteFeed($name, array $optionalArgs = []) + { + $request = new DeleteFeedRequest(); + $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( + 'DeleteFeed', + GPBEmpty::class, + $optionalArgs, + $request + )->wait(); + } } diff --git a/Asset/src/V1/GetFeedRequest.php b/Asset/src/V1/GetFeedRequest.php new file mode 100644 index 000000000000..fb56290cc0c3 --- /dev/null +++ b/Asset/src/V1/GetFeedRequest.php @@ -0,0 +1,79 @@ +google.cloud.asset.v1.GetFeedRequest + */ +class GetFeedRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the Feed and it must be in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_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. The name of the Feed and it must be in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_id + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Asset\V1\AssetService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the Feed and it must be in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_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 name of the Feed and it must be in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_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/Asset/src/V1/ListFeedsRequest.php b/Asset/src/V1/ListFeedsRequest.php new file mode 100644 index 000000000000..cf8076f289c6 --- /dev/null +++ b/Asset/src/V1/ListFeedsRequest.php @@ -0,0 +1,75 @@ +google.cloud.asset.v1.ListFeedsRequest + */ +class ListFeedsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent project/folder/organization whose feeds are to be + * listed. It can only be using project/folder/organization number (such as + * "folders/12345")", or a project ID (such as "projects/my-project-id"). + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $parent = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent project/folder/organization whose feeds are to be + * listed. It can only be using project/folder/organization number (such as + * "folders/12345")", or a project ID (such as "projects/my-project-id"). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Asset\V1\AssetService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent project/folder/organization whose feeds are to be + * listed. It can only be using project/folder/organization number (such as + * "folders/12345")", or a project ID (such as "projects/my-project-id"). + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent project/folder/organization whose feeds are to be + * listed. It can only be using project/folder/organization number (such as + * "folders/12345")", or a project ID (such as "projects/my-project-id"). + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + +} + diff --git a/Asset/src/V1/ListFeedsResponse.php b/Asset/src/V1/ListFeedsResponse.php new file mode 100644 index 000000000000..a67352e724f9 --- /dev/null +++ b/Asset/src/V1/ListFeedsResponse.php @@ -0,0 +1,65 @@ +google.cloud.asset.v1.ListFeedsResponse + */ +class ListFeedsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of feeds. + * + * Generated from protobuf field repeated .google.cloud.asset.v1.Feed feeds = 1; + */ + private $feeds; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Asset\V1\Feed[]|\Google\Protobuf\Internal\RepeatedField $feeds + * A list of feeds. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Asset\V1\AssetService::initOnce(); + parent::__construct($data); + } + + /** + * A list of feeds. + * + * Generated from protobuf field repeated .google.cloud.asset.v1.Feed feeds = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFeeds() + { + return $this->feeds; + } + + /** + * A list of feeds. + * + * Generated from protobuf field repeated .google.cloud.asset.v1.Feed feeds = 1; + * @param \Google\Cloud\Asset\V1\Feed[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFeeds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Asset\V1\Feed::class); + $this->feeds = $arr; + + return $this; + } + +} + diff --git a/Asset/src/V1/PubsubDestination.php b/Asset/src/V1/PubsubDestination.php new file mode 100644 index 000000000000..e1095f6b5a42 --- /dev/null +++ b/Asset/src/V1/PubsubDestination.php @@ -0,0 +1,71 @@ +google.cloud.asset.v1.PubsubDestination + */ +class PubsubDestination extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the Cloud Pub/Sub topic to publish to. + * For example: `projects/PROJECT_ID/topics/TOPIC_ID`. + * + * Generated from protobuf field string topic = 1; + */ + private $topic = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $topic + * The name of the Cloud Pub/Sub topic to publish to. + * For example: `projects/PROJECT_ID/topics/TOPIC_ID`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Asset\V1\AssetService::initOnce(); + parent::__construct($data); + } + + /** + * The name of the Cloud Pub/Sub topic to publish to. + * For example: `projects/PROJECT_ID/topics/TOPIC_ID`. + * + * Generated from protobuf field string topic = 1; + * @return string + */ + public function getTopic() + { + return $this->topic; + } + + /** + * The name of the Cloud Pub/Sub topic to publish to. + * For example: `projects/PROJECT_ID/topics/TOPIC_ID`. + * + * Generated from protobuf field string topic = 1; + * @param string $var + * @return $this + */ + public function setTopic($var) + { + GPBUtil::checkString($var, True); + $this->topic = $var; + + return $this; + } + +} + diff --git a/Asset/src/V1/UpdateFeedRequest.php b/Asset/src/V1/UpdateFeedRequest.php new file mode 100644 index 000000000000..fdd12a8bca8b --- /dev/null +++ b/Asset/src/V1/UpdateFeedRequest.php @@ -0,0 +1,125 @@ +google.cloud.asset.v1.UpdateFeedRequest + */ +class UpdateFeedRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The new values of feed details. It must match an existing feed and the + * field `name` must be in the format of: + * projects/project_number/feeds/feed_id or + * folders/folder_number/feeds/feed_id or + * organizations/organization_number/feeds/feed_id. + * + * Generated from protobuf field .google.cloud.asset.v1.Feed feed = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $feed = null; + /** + * Required. Only updates the `feed` fields indicated by this mask. + * The field mask must not be empty, and it must not contain fields that + * are immutable or only set by the server. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $update_mask = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Asset\V1\Feed $feed + * Required. The new values of feed details. It must match an existing feed and the + * field `name` must be in the format of: + * projects/project_number/feeds/feed_id or + * folders/folder_number/feeds/feed_id or + * organizations/organization_number/feeds/feed_id. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Only updates the `feed` fields indicated by this mask. + * The field mask must not be empty, and it must not contain fields that + * are immutable or only set by the server. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Asset\V1\AssetService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The new values of feed details. It must match an existing feed and the + * field `name` must be in the format of: + * projects/project_number/feeds/feed_id or + * folders/folder_number/feeds/feed_id or + * organizations/organization_number/feeds/feed_id. + * + * Generated from protobuf field .google.cloud.asset.v1.Feed feed = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Asset\V1\Feed + */ + public function getFeed() + { + return $this->feed; + } + + /** + * Required. The new values of feed details. It must match an existing feed and the + * field `name` must be in the format of: + * projects/project_number/feeds/feed_id or + * folders/folder_number/feeds/feed_id or + * organizations/organization_number/feeds/feed_id. + * + * Generated from protobuf field .google.cloud.asset.v1.Feed feed = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Asset\V1\Feed $var + * @return $this + */ + public function setFeed($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\Feed::class); + $this->feed = $var; + + return $this; + } + + /** + * Required. Only updates the `feed` fields indicated by this mask. + * The field mask must not be empty, and it must not contain fields that + * are immutable or only set by the server. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + /** + * Required. Only updates the `feed` fields indicated by this mask. + * The field mask must not be empty, and it must not contain fields that + * are immutable or only set by the server. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @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/Asset/src/V1/resources/asset_service_client_config.json b/Asset/src/V1/resources/asset_service_client_config.json index e1004902b799..dc56b109a4c8 100644 --- a/Asset/src/V1/resources/asset_service_client_config.json +++ b/Asset/src/V1/resources/asset_service_client_config.json @@ -29,6 +29,31 @@ "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" + }, + "CreateFeed": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetFeed": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFeeds": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateFeed": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteFeed": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" } } } diff --git a/Asset/src/V1/resources/asset_service_rest_client_config.php b/Asset/src/V1/resources/asset_service_rest_client_config.php index d780466d18f5..001a6af66767 100644 --- a/Asset/src/V1/resources/asset_service_rest_client_config.php +++ b/Asset/src/V1/resources/asset_service_rest_client_config.php @@ -26,6 +26,64 @@ ], ], ], + 'CreateFeed' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=*/*}/feeds', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetFeed' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=*/*/feeds/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListFeeds' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=*/*}/feeds', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateFeed' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{feed.name=*/*/feeds/*}', + 'body' => '*', + 'placeholders' => [ + 'feed.name' => [ + 'getters' => [ + 'getFeed', + 'getName', + ], + ], + ], + ], + 'DeleteFeed' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=*/*/feeds/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], ], ], ]; diff --git a/Asset/synth.metadata b/Asset/synth.metadata index feb207dd4e1b..27ca7c855dd5 100644 --- a/Asset/synth.metadata +++ b/Asset/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-11-14T10:58:43.454776Z", + "updateTime": "2019-12-17T20:09:48.724906Z", "sources": [ { "generator": { "name": "artman", - "version": "0.41.1", - "dockerImage": "googleapis/artman@sha256:545c758c76c3f779037aa259023ec3d1ef2d57d2c8cd00a222cb187d63ceac5e" + "version": "0.42.3", + "dockerImage": "googleapis/artman@sha256:feed210b5723c6f524b52ef6d7740a030f2d1a8f7c29a71c5e5b4481ceaad7f5" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "bc76ffd87360ce1cd34e3a6eac28afd5e1efda76", - "internalRef": "280356106" + "sha": "6ad2bb13bc4b0f3f785517f0563118f6ca52ddfd", + "internalRef": "286008145" } } ], diff --git a/Asset/tests/Unit/V1/AssetServiceClientTest.php b/Asset/tests/Unit/V1/AssetServiceClientTest.php index d05d0ab1c92f..f738fcefa62d 100644 --- a/Asset/tests/Unit/V1/AssetServiceClientTest.php +++ b/Asset/tests/Unit/V1/AssetServiceClientTest.php @@ -31,11 +31,15 @@ use Google\Cloud\Asset\V1\BatchGetAssetsHistoryResponse; use Google\Cloud\Asset\V1\ContentType; use Google\Cloud\Asset\V1\ExportAssetsResponse; +use Google\Cloud\Asset\V1\Feed; +use Google\Cloud\Asset\V1\ListFeedsResponse; use Google\Cloud\Asset\V1\OutputConfig; use Google\Cloud\Asset\V1\TimeWindow; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; +use Google\Protobuf\FieldMask; +use Google\Protobuf\GPBEmpty; use Google\Rpc\Code; use stdClass; @@ -300,4 +304,379 @@ public function batchGetAssetsHistoryExceptionTest() $transport->popReceivedCalls(); $this->assertTrue($transport->isExhausted()); } + + /** + * @test + */ + public function createFeedTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name = 'name3373707'; + $expectedResponse = new Feed(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + + // Mock request + $parent = 'parent-995424086'; + $feedId = 'feedId-976011428'; + $feed = new Feed(); + + $response = $client->createFeed($parent, $feedId, $feed); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.asset.v1.AssetService/CreateFeed', $actualFuncCall); + + $actualValue = $actualRequestObject->getParent(); + + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualRequestObject->getFeedId(); + + $this->assertProtobufEquals($feedId, $actualValue); + $actualValue = $actualRequestObject->getFeed(); + + $this->assertProtobufEquals($feed, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function createFeedExceptionTest() + { + $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 + $parent = 'parent-995424086'; + $feedId = 'feedId-976011428'; + $feed = new Feed(); + + try { + $client->createFeed($parent, $feedId, $feed); + // 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 getFeedTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new Feed(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedName = $client->feedName('[PROJECT]', '[FEED]'); + + $response = $client->getFeed($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.asset.v1.AssetService/GetFeed', $actualFuncCall); + + $actualValue = $actualRequestObject->getName(); + + $this->assertProtobufEquals($formattedName, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function getFeedExceptionTest() + { + $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->feedName('[PROJECT]', '[FEED]'); + + try { + $client->getFeed($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 listFeedsTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $expectedResponse = new ListFeedsResponse(); + $transport->addResponse($expectedResponse); + + // Mock request + $parent = 'parent-995424086'; + + $response = $client->listFeeds($parent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.asset.v1.AssetService/ListFeeds', $actualFuncCall); + + $actualValue = $actualRequestObject->getParent(); + + $this->assertProtobufEquals($parent, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function listFeedsExceptionTest() + { + $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 + $parent = 'parent-995424086'; + + try { + $client->listFeeds($parent); + // 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 updateFeedTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name = 'name3373707'; + $expectedResponse = new Feed(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + + // Mock request + $feed = new Feed(); + $updateMask = new FieldMask(); + + $response = $client->updateFeed($feed, $updateMask); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.asset.v1.AssetService/UpdateFeed', $actualFuncCall); + + $actualValue = $actualRequestObject->getFeed(); + + $this->assertProtobufEquals($feed, $actualValue); + $actualValue = $actualRequestObject->getUpdateMask(); + + $this->assertProtobufEquals($updateMask, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function updateFeedExceptionTest() + { + $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 + $feed = new Feed(); + $updateMask = new FieldMask(); + + try { + $client->updateFeed($feed, $updateMask); + // 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 deleteFeedTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedName = $client->feedName('[PROJECT]', '[FEED]'); + + $client->deleteFeed($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.asset.v1.AssetService/DeleteFeed', $actualFuncCall); + + $actualValue = $actualRequestObject->getName(); + + $this->assertProtobufEquals($formattedName, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function deleteFeedExceptionTest() + { + $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->feedName('[PROJECT]', '[FEED]'); + + try { + $client->deleteFeed($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()); + } } From 68743ae78305571d9b9e0180c6f3a180c774e78d Mon Sep 17 00:00:00 2001 From: David Supplee Date: Tue, 17 Dec 2019 12:23:29 -0800 Subject: [PATCH 3/4] manually add operations bindings back in --- .../asset_service_rest_client_config.php | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/Asset/src/V1/resources/asset_service_rest_client_config.php b/Asset/src/V1/resources/asset_service_rest_client_config.php index 001a6af66767..5e47dc10b282 100644 --- a/Asset/src/V1/resources/asset_service_rest_client_config.php +++ b/Asset/src/V1/resources/asset_service_rest_client_config.php @@ -85,5 +85,48 @@ ], ], ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha1/{name=projects/*/operations/*/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha1/{name=organizations/*/operations/*/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha2/{name=projects/*/operations/*/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha2/{name=organizations/*/operations/*/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{name=projects/*/operations/*/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{name=folders/*/operations/*/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/{name=organizations/*/operations/*/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=*/*/operations/*/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], ], ]; From 6815827f50456e1f2b835fa803b646144860f5c8 Mon Sep 17 00:00:00 2001 From: David Supplee Date: Tue, 17 Dec 2019 13:59:58 -0800 Subject: [PATCH 4/4] pin to working version of prophecy --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 1617dccfb6c8..6f6f2cb35e8f 100644 --- a/composer.json +++ b/composer.json @@ -57,6 +57,7 @@ }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", + "phpspec/prophecy": "1.9.0", "squizlabs/php_codesniffer": "2.*", "phpdocumentor/reflection": "^3.0", "symfony/console": "^3.0",