From fc42c84256373bf5ddda75e6a8414cce9ecd3e89 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 19 Dec 2024 21:05:04 +0000 Subject: [PATCH 1/8] feat: introduce ParamaterManager --- .repo-metadata-full.json | 8 + ParameterManager/.OwlBot.yaml | 4 + ParameterManager/.gitattributes | 7 + .../.github/pull_request_template.md | 24 + ParameterManager/CONTRIBUTING.md | 10 + ParameterManager/LICENSE | 202 ++++ ParameterManager/README.md | 50 + ParameterManager/VERSION | 1 + ParameterManager/composer.json | 30 + ParameterManager/metadata/V1/Service.php | Bin 0 -> 7785 bytes ParameterManager/owlbot.py | 56 + ParameterManager/phpunit.xml.dist | 16 + .../create_parameter.php | 77 ++ .../create_parameter_version.php | 90 ++ .../delete_parameter.php | 70 ++ .../delete_parameter_version.php | 75 ++ .../ParameterManagerClient/get_location.php | 57 + .../ParameterManagerClient/get_parameter.php | 72 ++ .../get_parameter_version.php | 77 ++ .../ParameterManagerClient/list_locations.php | 62 + .../list_parameter_versions.php | 77 ++ .../list_parameters.php | 77 ++ .../render_parameter_version.php | 76 ++ .../update_parameter.php | 59 + .../update_parameter_version.php | 75 ++ .../src/V1/Client/ParameterManagerClient.php | 634 ++++++++++ .../src/V1/CreateParameterRequest.php | 242 ++++ .../src/V1/CreateParameterVersionRequest.php | 242 ++++ .../src/V1/DeleteParameterRequest.php | 160 +++ .../src/V1/DeleteParameterVersionRequest.php | 160 +++ .../src/V1/GetParameterRequest.php | 86 ++ .../src/V1/GetParameterVersionRequest.php | 128 ++ .../src/V1/ListParameterVersionsRequest.php | 226 ++++ .../src/V1/ListParameterVersionsResponse.php | 135 +++ .../src/V1/ListParametersRequest.php | 226 ++++ .../src/V1/ListParametersResponse.php | 135 +++ ParameterManager/src/V1/Parameter.php | 275 +++++ ParameterManager/src/V1/ParameterFormat.php | 71 ++ ParameterManager/src/V1/ParameterVersion.php | 261 ++++ .../src/V1/ParameterVersionPayload.php | 67 ++ .../src/V1/RenderParameterVersionRequest.php | 81 ++ .../src/V1/RenderParameterVersionResponse.php | 161 +++ .../src/V1/UpdateParameterRequest.php | 235 ++++ .../src/V1/UpdateParameterVersionRequest.php | 235 ++++ ParameterManager/src/V1/View.php | 64 + ParameterManager/src/V1/gapic_metadata.json | 83 ++ .../parameter_manager_client_config.json | 109 ++ .../parameter_manager_descriptor_config.php | 217 ++++ .../parameter_manager_rest_client_config.php | 186 +++ .../V1/Client/ParameterManagerClientTest.php | 1052 +++++++++++++++++ composer.json | 3 + 51 files changed, 6826 insertions(+) create mode 100644 ParameterManager/.OwlBot.yaml create mode 100644 ParameterManager/.gitattributes create mode 100644 ParameterManager/.github/pull_request_template.md create mode 100644 ParameterManager/CONTRIBUTING.md create mode 100644 ParameterManager/LICENSE create mode 100644 ParameterManager/README.md create mode 100644 ParameterManager/VERSION create mode 100644 ParameterManager/composer.json create mode 100644 ParameterManager/metadata/V1/Service.php create mode 100644 ParameterManager/owlbot.py create mode 100644 ParameterManager/phpunit.xml.dist create mode 100644 ParameterManager/samples/V1/ParameterManagerClient/create_parameter.php create mode 100644 ParameterManager/samples/V1/ParameterManagerClient/create_parameter_version.php create mode 100644 ParameterManager/samples/V1/ParameterManagerClient/delete_parameter.php create mode 100644 ParameterManager/samples/V1/ParameterManagerClient/delete_parameter_version.php create mode 100644 ParameterManager/samples/V1/ParameterManagerClient/get_location.php create mode 100644 ParameterManager/samples/V1/ParameterManagerClient/get_parameter.php create mode 100644 ParameterManager/samples/V1/ParameterManagerClient/get_parameter_version.php create mode 100644 ParameterManager/samples/V1/ParameterManagerClient/list_locations.php create mode 100644 ParameterManager/samples/V1/ParameterManagerClient/list_parameter_versions.php create mode 100644 ParameterManager/samples/V1/ParameterManagerClient/list_parameters.php create mode 100644 ParameterManager/samples/V1/ParameterManagerClient/render_parameter_version.php create mode 100644 ParameterManager/samples/V1/ParameterManagerClient/update_parameter.php create mode 100644 ParameterManager/samples/V1/ParameterManagerClient/update_parameter_version.php create mode 100644 ParameterManager/src/V1/Client/ParameterManagerClient.php create mode 100644 ParameterManager/src/V1/CreateParameterRequest.php create mode 100644 ParameterManager/src/V1/CreateParameterVersionRequest.php create mode 100644 ParameterManager/src/V1/DeleteParameterRequest.php create mode 100644 ParameterManager/src/V1/DeleteParameterVersionRequest.php create mode 100644 ParameterManager/src/V1/GetParameterRequest.php create mode 100644 ParameterManager/src/V1/GetParameterVersionRequest.php create mode 100644 ParameterManager/src/V1/ListParameterVersionsRequest.php create mode 100644 ParameterManager/src/V1/ListParameterVersionsResponse.php create mode 100644 ParameterManager/src/V1/ListParametersRequest.php create mode 100644 ParameterManager/src/V1/ListParametersResponse.php create mode 100644 ParameterManager/src/V1/Parameter.php create mode 100644 ParameterManager/src/V1/ParameterFormat.php create mode 100644 ParameterManager/src/V1/ParameterVersion.php create mode 100644 ParameterManager/src/V1/ParameterVersionPayload.php create mode 100644 ParameterManager/src/V1/RenderParameterVersionRequest.php create mode 100644 ParameterManager/src/V1/RenderParameterVersionResponse.php create mode 100644 ParameterManager/src/V1/UpdateParameterRequest.php create mode 100644 ParameterManager/src/V1/UpdateParameterVersionRequest.php create mode 100644 ParameterManager/src/V1/View.php create mode 100644 ParameterManager/src/V1/gapic_metadata.json create mode 100644 ParameterManager/src/V1/resources/parameter_manager_client_config.json create mode 100644 ParameterManager/src/V1/resources/parameter_manager_descriptor_config.php create mode 100644 ParameterManager/src/V1/resources/parameter_manager_rest_client_config.php create mode 100644 ParameterManager/tests/Unit/V1/Client/ParameterManagerClientTest.php diff --git a/.repo-metadata-full.json b/.repo-metadata-full.json index 47293b0e4b2a..7e97d2634bb1 100644 --- a/.repo-metadata-full.json +++ b/.repo-metadata-full.json @@ -1038,6 +1038,14 @@ "library_type": "GAPIC_AUTO", "api_shortname": "parallelstore" }, + "ParameterManager": { + "language": "php", + "distribution_name": "google/cloud-parametermanager", + "release_level": "preview", + "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-parametermanager/latest", + "library_type": "GAPIC_AUTO", + "api_shortname": "parametermanager" + }, "PolicySimulator": { "language": "php", "distribution_name": "google/cloud-policysimulator", diff --git a/ParameterManager/.OwlBot.yaml b/ParameterManager/.OwlBot.yaml new file mode 100644 index 000000000000..226724acf610 --- /dev/null +++ b/ParameterManager/.OwlBot.yaml @@ -0,0 +1,4 @@ +deep-copy-regex: + - source: /google/cloud/parametermanager/(v1)/.*-php/(.*) + dest: /owl-bot-staging/ParameterManager/$1/$2 +api-name: ParameterManager diff --git a/ParameterManager/.gitattributes b/ParameterManager/.gitattributes new file mode 100644 index 000000000000..4bf0fe6f415b --- /dev/null +++ b/ParameterManager/.gitattributes @@ -0,0 +1,7 @@ +/*.xml.dist export-ignore +/.OwlBot.yaml export-ignore +/.github export-ignore +/owlbot.py export-ignore +/src/**/gapic_metadata.json export-ignore +/samples export-ignore +/tests export-ignore diff --git a/ParameterManager/.github/pull_request_template.md b/ParameterManager/.github/pull_request_template.md new file mode 100644 index 000000000000..e0eea34eb4ba --- /dev/null +++ b/ParameterManager/.github/pull_request_template.md @@ -0,0 +1,24 @@ +**PLEASE READ THIS ENTIRE MESSAGE** + +Hello, and thank you for your contribution! Please note that this repository is +a read-only split of `googleapis/google-cloud-php`. As such, we are +unable to accept pull requests to this repository. + +We welcome your pull request and would be happy to consider it for inclusion in +our library if you follow these steps: + +* Clone the parent client library repository: + +```sh +$ git clone git@github.com:googleapis/google-cloud-php.git +``` + +* Move your changes into the correct location in that library. Library code +belongs in `ParameterManager/src`, and tests in `ParameterManager/tests`. + +* Push the changes in a new branch to a fork, and open a new pull request +[here](https://github.com/googleapis/google-cloud-php). + +Thanks again, and we look forward to seeing your proposed change! + +The Google Cloud PHP team diff --git a/ParameterManager/CONTRIBUTING.md b/ParameterManager/CONTRIBUTING.md new file mode 100644 index 000000000000..76ea811cacdb --- /dev/null +++ b/ParameterManager/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. We accept +and review pull requests against the main +[Google Cloud PHP](https://github.com/googleapis/google-cloud-php) +repository, which contains all of our client libraries. You will also need to +sign a Contributor License Agreement. For more details about how to contribute, +see the +[CONTRIBUTING.md](https://github.com/googleapis/google-cloud-php/blob/main/CONTRIBUTING.md) +file in the main Google Cloud PHP repository. diff --git a/ParameterManager/LICENSE b/ParameterManager/LICENSE new file mode 100644 index 000000000000..8f71f43fee3f --- /dev/null +++ b/ParameterManager/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/ParameterManager/README.md b/ParameterManager/README.md new file mode 100644 index 000000000000..b8858259a328 --- /dev/null +++ b/ParameterManager/README.md @@ -0,0 +1,50 @@ +# Google Cloud Parameter Manager for PHP + +> Idiomatic PHP client for [Google Cloud Parameter Manager](https://cloud.google.com/secret-manager/parameter-manager/docs/overview). + +[![Latest Stable Version](https://poser.pugx.org/google/cloud-parametermanager/v/stable)](https://packagist.org/packages/google/cloud-parametermanager) [![Packagist](https://img.shields.io/packagist/dm/google/cloud-parametermanager.svg)](https://packagist.org/packages/google/cloud-parametermanager) + +* [API documentation](https://cloud.google.com/php/docs/reference/cloud-parametermanager/latest) + +**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any +support requests, bug reports, or development contributions should be directed to +that project. + +### Installation + +To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/). + +Now, install this component: + +```sh +$ composer require google/cloud-parametermanager +``` + +> Browse the complete list of [Google Cloud APIs](https://cloud.google.com/php/docs/reference) +> for PHP + +This component supports both REST over HTTP/1.1 and gRPC. In order to take advantage of the benefits +offered by gRPC (such as streaming methods) please see our +[gRPC installation guide](https://cloud.google.com/php/grpc). + +### Authentication + +Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information +on authenticating your client. Once authenticated, you'll be ready to start making requests. + +### Sample + +See the [samples directory](https://github.com/googleapis/google-cloud-php-parametermanager/tree/main/samples) for a canonical list of samples. + +### Debugging + +Please see our [Debugging guide](https://github.com/googleapis/google-cloud-php/blob/main/DEBUG.md) +for more information about the debugging tools. + +### Version + +This component is considered alpha. As such, it is still a work-in-progress and is more likely to get backwards-incompatible updates. + +### Next Steps + +1. Understand the [official documentation](https://cloud.google.com/secret-manager/parameter-manager/docs/overview). diff --git a/ParameterManager/VERSION b/ParameterManager/VERSION new file mode 100644 index 000000000000..77d6f4ca2371 --- /dev/null +++ b/ParameterManager/VERSION @@ -0,0 +1 @@ +0.0.0 diff --git a/ParameterManager/composer.json b/ParameterManager/composer.json new file mode 100644 index 000000000000..aa289b6e3e11 --- /dev/null +++ b/ParameterManager/composer.json @@ -0,0 +1,30 @@ +{ + "name": "google/cloud-parametermanager", + "description": "Google Cloud Parameter Manager Client for PHP", + "license": "Apache-2.0", + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "Google\\Cloud\\ParameterManager\\": "src", + "GPBMetadata\\Google\\Cloud\\Parametermanager\\": "metadata" + } + }, + "extra": { + "component": { + "id": "cloud-parametermanager", + "path": "ParameterManager", + "target": "googleapis/google-cloud-php-parametermanager" + } + }, + "require": { + "php": "^8.0", + "google/gax": "^1.36.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-grpc": "Enables use of gRPC, a universal high-performance RPC framework created by Google.", + "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions." + } +} diff --git a/ParameterManager/metadata/V1/Service.php b/ParameterManager/metadata/V1/Service.php new file mode 100644 index 0000000000000000000000000000000000000000..b6da564e5897fcaae9bb8edb159dc90b7005cd5b GIT binary patch literal 7785 zcmc&(O>7&-74DLfDvcaV8OOGwM)ig^8kw=lkWEp06G1-8I zWn10a-cyS!>wB+)sP8nr8qw54$2qh}wq`lade${Oqd@}VH4NK0BwqG7m-UHvY}QDI zsYb|#3BGI8h`LrPY?8pJ8-YdXUmp4+Ht9Y!vyf!8F_ z)m7CaLDRDrnB7#tY51$$C2G2BmUY{9XcQdV*R+;TEfu{4mo1an!C*40Cb8-Ta%3Ev zjyHtpx_#gbCbmNa-um`!-Dm)A%2Kf808magNux>zusF;+M7`K>gOmQP4nn#K@%Ze;TO>erMDSHRpuuO z$>;hweiKdBJOUJ3p`tSh7@5q^iZpN~U{)qfG?hwHsiq6WD5R48No}Ap%cv5|pBYh; zu*^5*GCi}G32o18Fv+4Fcqh~b1+Sv90|$sam>GrTFXwXuXj^51T+b4Ep)E5rW6YbI zQXQlbaFpp*s4N(>chO|TI6R4xkI4y-F@6D!9vfDZ2X;bB+*7pomCy9|6m+`-tQJV zGL?Pc3|~i6Hu-T-iC9UCVgk-!fvb-wl0pXHnTaC4U+n9W^;hHnf)%hwn8k} zM0QyHMH3zi8G~J+ZS9YfXgXYWpLjm(r~cop4mDageOePd%i}y5JLt=$O z={x#naj&>jS>4{*)b}cnwsuR!<@MF|;>z@w@D!SSw8cmE;Ddt4(a3l8&5h{<{q=Bn zduuwG&Y=-X2lyp4y}w@kc1*&skt_0a|h=Rdg;*(+@F`!4)P1zm0GD-sNU1D~K4wZT*N(s`Z ze)APNlm&M9Hynn$@4RpyvF|P^llS)dap|Q%WN$m_X92&>ayN{h8ZbO;&G0W09akGN zi+#8o+4C`z N&E$`cr|1-+{{lpieo6oU literal 0 HcmV?d00001 diff --git a/ParameterManager/owlbot.py b/ParameterManager/owlbot.py new file mode 100644 index 000000000000..85c5c9e0450f --- /dev/null +++ b/ParameterManager/owlbot.py @@ -0,0 +1,56 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This script is used to synthesize generated parts of this library.""" + +import logging +from pathlib import Path +import subprocess + +import synthtool as s +from synthtool.languages import php +from synthtool import _tracked_paths + +logging.basicConfig(level=logging.DEBUG) + +src = Path(f"../{php.STAGING_DIR}/ParameterManager").resolve() +dest = Path().resolve() + +# Added so that we can pass copy_excludes in the owlbot_main() call +_tracked_paths.add(src) + +php.owlbot_main(src=src, dest=dest) + +# remove class_alias code +s.replace( + "src/V*/**/*.php", + r"^// Adding a class alias for backwards compatibility with the previous class name.$" + + "\n" + + r"^class_alias\(.*\);$" + + "\n", + '') + +# format generated clients +subprocess.run([ + 'npm', + 'exec', + '--yes', + '--package=@prettier/plugin-php@^0.16', + '--', + 'prettier', + '**/Client/*', + '--write', + '--parser=php', + '--single-quote', + '--print-width=120']) diff --git a/ParameterManager/phpunit.xml.dist b/ParameterManager/phpunit.xml.dist new file mode 100644 index 000000000000..a0b4bca798f9 --- /dev/null +++ b/ParameterManager/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + src + + + src/V[!a-zA-Z]* + + + + + tests/Unit + + + diff --git a/ParameterManager/samples/V1/ParameterManagerClient/create_parameter.php b/ParameterManager/samples/V1/ParameterManagerClient/create_parameter.php new file mode 100644 index 000000000000..e8230ffcee4f --- /dev/null +++ b/ParameterManager/samples/V1/ParameterManagerClient/create_parameter.php @@ -0,0 +1,77 @@ +setParent($formattedParent) + ->setParameterId($parameterId) + ->setParameter($parameter); + + // Call the API and handle any network failures. + try { + /** @var Parameter $response */ + $response = $parameterManagerClient->createParameter($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ParameterManagerClient::locationName('[PROJECT]', '[LOCATION]'); + $parameterId = '[PARAMETER_ID]'; + + create_parameter_sample($formattedParent, $parameterId); +} +// [END parametermanager_v1_generated_ParameterManager_CreateParameter_sync] diff --git a/ParameterManager/samples/V1/ParameterManagerClient/create_parameter_version.php b/ParameterManager/samples/V1/ParameterManagerClient/create_parameter_version.php new file mode 100644 index 000000000000..84a9a93e363e --- /dev/null +++ b/ParameterManager/samples/V1/ParameterManagerClient/create_parameter_version.php @@ -0,0 +1,90 @@ +setData($parameterVersionPayloadData); + $parameterVersion = (new ParameterVersion()) + ->setPayload($parameterVersionPayload); + $request = (new CreateParameterVersionRequest()) + ->setParent($formattedParent) + ->setParameterVersionId($parameterVersionId) + ->setParameterVersion($parameterVersion); + + // Call the API and handle any network failures. + try { + /** @var ParameterVersion $response */ + $response = $parameterManagerClient->createParameterVersion($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ParameterManagerClient::parameterName('[PROJECT]', '[LOCATION]', '[PARAMETER]'); + $parameterVersionId = '[PARAMETER_VERSION_ID]'; + $parameterVersionPayloadData = '...'; + + create_parameter_version_sample( + $formattedParent, + $parameterVersionId, + $parameterVersionPayloadData + ); +} +// [END parametermanager_v1_generated_ParameterManager_CreateParameterVersion_sync] diff --git a/ParameterManager/samples/V1/ParameterManagerClient/delete_parameter.php b/ParameterManager/samples/V1/ParameterManagerClient/delete_parameter.php new file mode 100644 index 000000000000..2198a140365f --- /dev/null +++ b/ParameterManager/samples/V1/ParameterManagerClient/delete_parameter.php @@ -0,0 +1,70 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $parameterManagerClient->deleteParameter($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ParameterManagerClient::parameterName('[PROJECT]', '[LOCATION]', '[PARAMETER]'); + + delete_parameter_sample($formattedName); +} +// [END parametermanager_v1_generated_ParameterManager_DeleteParameter_sync] diff --git a/ParameterManager/samples/V1/ParameterManagerClient/delete_parameter_version.php b/ParameterManager/samples/V1/ParameterManagerClient/delete_parameter_version.php new file mode 100644 index 000000000000..d7eb9a27cd7a --- /dev/null +++ b/ParameterManager/samples/V1/ParameterManagerClient/delete_parameter_version.php @@ -0,0 +1,75 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $parameterManagerClient->deleteParameterVersion($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ParameterManagerClient::parameterVersionName( + '[PROJECT]', + '[LOCATION]', + '[PARAMETER]', + '[PARAMETER_VERSION]' + ); + + delete_parameter_version_sample($formattedName); +} +// [END parametermanager_v1_generated_ParameterManager_DeleteParameterVersion_sync] diff --git a/ParameterManager/samples/V1/ParameterManagerClient/get_location.php b/ParameterManager/samples/V1/ParameterManagerClient/get_location.php new file mode 100644 index 000000000000..ed93a505e551 --- /dev/null +++ b/ParameterManager/samples/V1/ParameterManagerClient/get_location.php @@ -0,0 +1,57 @@ +getLocation($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END parametermanager_v1_generated_ParameterManager_GetLocation_sync] diff --git a/ParameterManager/samples/V1/ParameterManagerClient/get_parameter.php b/ParameterManager/samples/V1/ParameterManagerClient/get_parameter.php new file mode 100644 index 000000000000..4e0996315f29 --- /dev/null +++ b/ParameterManager/samples/V1/ParameterManagerClient/get_parameter.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Parameter $response */ + $response = $parameterManagerClient->getParameter($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ParameterManagerClient::parameterName('[PROJECT]', '[LOCATION]', '[PARAMETER]'); + + get_parameter_sample($formattedName); +} +// [END parametermanager_v1_generated_ParameterManager_GetParameter_sync] diff --git a/ParameterManager/samples/V1/ParameterManagerClient/get_parameter_version.php b/ParameterManager/samples/V1/ParameterManagerClient/get_parameter_version.php new file mode 100644 index 000000000000..1064499bc072 --- /dev/null +++ b/ParameterManager/samples/V1/ParameterManagerClient/get_parameter_version.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var ParameterVersion $response */ + $response = $parameterManagerClient->getParameterVersion($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ParameterManagerClient::parameterVersionName( + '[PROJECT]', + '[LOCATION]', + '[PARAMETER]', + '[PARAMETER_VERSION]' + ); + + get_parameter_version_sample($formattedName); +} +// [END parametermanager_v1_generated_ParameterManager_GetParameterVersion_sync] diff --git a/ParameterManager/samples/V1/ParameterManagerClient/list_locations.php b/ParameterManager/samples/V1/ParameterManagerClient/list_locations.php new file mode 100644 index 000000000000..557afc074dbe --- /dev/null +++ b/ParameterManager/samples/V1/ParameterManagerClient/list_locations.php @@ -0,0 +1,62 @@ +listLocations($request); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END parametermanager_v1_generated_ParameterManager_ListLocations_sync] diff --git a/ParameterManager/samples/V1/ParameterManagerClient/list_parameter_versions.php b/ParameterManager/samples/V1/ParameterManagerClient/list_parameter_versions.php new file mode 100644 index 000000000000..ff58d1f91f01 --- /dev/null +++ b/ParameterManager/samples/V1/ParameterManagerClient/list_parameter_versions.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $parameterManagerClient->listParameterVersions($request); + + /** @var ParameterVersion $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ParameterManagerClient::parameterName('[PROJECT]', '[LOCATION]', '[PARAMETER]'); + + list_parameter_versions_sample($formattedParent); +} +// [END parametermanager_v1_generated_ParameterManager_ListParameterVersions_sync] diff --git a/ParameterManager/samples/V1/ParameterManagerClient/list_parameters.php b/ParameterManager/samples/V1/ParameterManagerClient/list_parameters.php new file mode 100644 index 000000000000..da67c2994786 --- /dev/null +++ b/ParameterManager/samples/V1/ParameterManagerClient/list_parameters.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $parameterManagerClient->listParameters($request); + + /** @var Parameter $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ParameterManagerClient::locationName('[PROJECT]', '[LOCATION]'); + + list_parameters_sample($formattedParent); +} +// [END parametermanager_v1_generated_ParameterManager_ListParameters_sync] diff --git a/ParameterManager/samples/V1/ParameterManagerClient/render_parameter_version.php b/ParameterManager/samples/V1/ParameterManagerClient/render_parameter_version.php new file mode 100644 index 000000000000..2ad0d6d91f8b --- /dev/null +++ b/ParameterManager/samples/V1/ParameterManagerClient/render_parameter_version.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var RenderParameterVersionResponse $response */ + $response = $parameterManagerClient->renderParameterVersion($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ParameterManagerClient::parameterVersionName( + '[PROJECT]', + '[LOCATION]', + '[PARAMETER]', + '[PARAMETER_VERSION]' + ); + + render_parameter_version_sample($formattedName); +} +// [END parametermanager_v1_generated_ParameterManager_RenderParameterVersion_sync] diff --git a/ParameterManager/samples/V1/ParameterManagerClient/update_parameter.php b/ParameterManager/samples/V1/ParameterManagerClient/update_parameter.php new file mode 100644 index 000000000000..39c0b3f7e826 --- /dev/null +++ b/ParameterManager/samples/V1/ParameterManagerClient/update_parameter.php @@ -0,0 +1,59 @@ +setParameter($parameter); + + // Call the API and handle any network failures. + try { + /** @var Parameter $response */ + $response = $parameterManagerClient->updateParameter($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END parametermanager_v1_generated_ParameterManager_UpdateParameter_sync] diff --git a/ParameterManager/samples/V1/ParameterManagerClient/update_parameter_version.php b/ParameterManager/samples/V1/ParameterManagerClient/update_parameter_version.php new file mode 100644 index 000000000000..a5a777506807 --- /dev/null +++ b/ParameterManager/samples/V1/ParameterManagerClient/update_parameter_version.php @@ -0,0 +1,75 @@ +setData($parameterVersionPayloadData); + $parameterVersion = (new ParameterVersion()) + ->setPayload($parameterVersionPayload); + $request = (new UpdateParameterVersionRequest()) + ->setParameterVersion($parameterVersion); + + // Call the API and handle any network failures. + try { + /** @var ParameterVersion $response */ + $response = $parameterManagerClient->updateParameterVersion($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $parameterVersionPayloadData = '...'; + + update_parameter_version_sample($parameterVersionPayloadData); +} +// [END parametermanager_v1_generated_ParameterManager_UpdateParameterVersion_sync] diff --git a/ParameterManager/src/V1/Client/ParameterManagerClient.php b/ParameterManager/src/V1/Client/ParameterManagerClient.php new file mode 100644 index 000000000000..4908879ba257 --- /dev/null +++ b/ParameterManager/src/V1/Client/ParameterManagerClient.php @@ -0,0 +1,634 @@ + createParameterAsync(CreateParameterRequest $request, array $optionalArgs = []) + * @method PromiseInterface createParameterVersionAsync(CreateParameterVersionRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteParameterAsync(DeleteParameterRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteParameterVersionAsync(DeleteParameterVersionRequest $request, array $optionalArgs = []) + * @method PromiseInterface getParameterAsync(GetParameterRequest $request, array $optionalArgs = []) + * @method PromiseInterface getParameterVersionAsync(GetParameterVersionRequest $request, array $optionalArgs = []) + * @method PromiseInterface listParameterVersionsAsync(ListParameterVersionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listParametersAsync(ListParametersRequest $request, array $optionalArgs = []) + * @method PromiseInterface renderParameterVersionAsync(RenderParameterVersionRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateParameterAsync(UpdateParameterRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateParameterVersionAsync(UpdateParameterVersionRequest $request, array $optionalArgs = []) + * @method PromiseInterface getLocationAsync(GetLocationRequest $request, array $optionalArgs = []) + * @method PromiseInterface listLocationsAsync(ListLocationsRequest $request, array $optionalArgs = []) + */ +final class ParameterManagerClient +{ + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.cloud.parametermanager.v1.ParameterManager'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'parametermanager.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'parametermanager.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = ['https://www.googleapis.com/auth/cloud-platform']; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/parameter_manager_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/parameter_manager_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/parameter_manager_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/parameter_manager_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a parameter + * resource. + * + * @param string $project + * @param string $location + * @param string $parameter + * + * @return string The formatted parameter resource. + */ + public static function parameterName(string $project, string $location, string $parameter): string + { + return self::getPathTemplate('parameter')->render([ + 'project' => $project, + 'location' => $location, + 'parameter' => $parameter, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * parameter_version resource. + * + * @param string $project + * @param string $location + * @param string $parameter + * @param string $parameterVersion + * + * @return string The formatted parameter_version resource. + */ + public static function parameterVersionName( + string $project, + string $location, + string $parameter, + string $parameterVersion + ): string { + return self::getPathTemplate('parameterVersion')->render([ + 'project' => $project, + 'location' => $location, + 'parameter' => $parameter, + 'parameter_version' => $parameterVersion, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - location: projects/{project}/locations/{location} + * - parameter: projects/{project}/locations/{location}/parameters/{parameter} + * - parameterVersion: projects/{project}/locations/{location}/parameters/{parameter}/versions/{parameter_version} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, ?string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'parametermanager.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a new Parameter in a given project and location. + * + * The async variant is {@see ParameterManagerClient::createParameterAsync()} . + * + * @example samples/V1/ParameterManagerClient/create_parameter.php + * + * @param CreateParameterRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Parameter + * + * @throws ApiException Thrown if the API call fails. + */ + public function createParameter(CreateParameterRequest $request, array $callOptions = []): Parameter + { + return $this->startApiCall('CreateParameter', $request, $callOptions)->wait(); + } + + /** + * Creates a new ParameterVersion in a given project, location, and parameter. + * + * The async variant is + * {@see ParameterManagerClient::createParameterVersionAsync()} . + * + * @example samples/V1/ParameterManagerClient/create_parameter_version.php + * + * @param CreateParameterVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ParameterVersion + * + * @throws ApiException Thrown if the API call fails. + */ + public function createParameterVersion( + CreateParameterVersionRequest $request, + array $callOptions = [] + ): ParameterVersion { + return $this->startApiCall('CreateParameterVersion', $request, $callOptions)->wait(); + } + + /** + * Deletes a single Parameter. + * + * The async variant is {@see ParameterManagerClient::deleteParameterAsync()} . + * + * @example samples/V1/ParameterManagerClient/delete_parameter.php + * + * @param DeleteParameterRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteParameter(DeleteParameterRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteParameter', $request, $callOptions)->wait(); + } + + /** + * Deletes a single ParameterVersion. + * + * The async variant is + * {@see ParameterManagerClient::deleteParameterVersionAsync()} . + * + * @example samples/V1/ParameterManagerClient/delete_parameter_version.php + * + * @param DeleteParameterVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteParameterVersion(DeleteParameterVersionRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteParameterVersion', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single Parameter. + * + * The async variant is {@see ParameterManagerClient::getParameterAsync()} . + * + * @example samples/V1/ParameterManagerClient/get_parameter.php + * + * @param GetParameterRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Parameter + * + * @throws ApiException Thrown if the API call fails. + */ + public function getParameter(GetParameterRequest $request, array $callOptions = []): Parameter + { + return $this->startApiCall('GetParameter', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single ParameterVersion. + * + * The async variant is {@see ParameterManagerClient::getParameterVersionAsync()} . + * + * @example samples/V1/ParameterManagerClient/get_parameter_version.php + * + * @param GetParameterVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ParameterVersion + * + * @throws ApiException Thrown if the API call fails. + */ + public function getParameterVersion(GetParameterVersionRequest $request, array $callOptions = []): ParameterVersion + { + return $this->startApiCall('GetParameterVersion', $request, $callOptions)->wait(); + } + + /** + * Lists ParameterVersions in a given project, location, and parameter. + * + * The async variant is {@see ParameterManagerClient::listParameterVersionsAsync()} + * . + * + * @example samples/V1/ParameterManagerClient/list_parameter_versions.php + * + * @param ListParameterVersionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listParameterVersions( + ListParameterVersionsRequest $request, + array $callOptions = [] + ): PagedListResponse { + return $this->startApiCall('ListParameterVersions', $request, $callOptions); + } + + /** + * Lists Parameters in a given project and location. + * + * The async variant is {@see ParameterManagerClient::listParametersAsync()} . + * + * @example samples/V1/ParameterManagerClient/list_parameters.php + * + * @param ListParametersRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listParameters(ListParametersRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListParameters', $request, $callOptions); + } + + /** + * Gets rendered version of a ParameterVersion. + * + * The async variant is + * {@see ParameterManagerClient::renderParameterVersionAsync()} . + * + * @example samples/V1/ParameterManagerClient/render_parameter_version.php + * + * @param RenderParameterVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return RenderParameterVersionResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function renderParameterVersion( + RenderParameterVersionRequest $request, + array $callOptions = [] + ): RenderParameterVersionResponse { + return $this->startApiCall('RenderParameterVersion', $request, $callOptions)->wait(); + } + + /** + * Updates a single Parameter. + * + * The async variant is {@see ParameterManagerClient::updateParameterAsync()} . + * + * @example samples/V1/ParameterManagerClient/update_parameter.php + * + * @param UpdateParameterRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Parameter + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateParameter(UpdateParameterRequest $request, array $callOptions = []): Parameter + { + return $this->startApiCall('UpdateParameter', $request, $callOptions)->wait(); + } + + /** + * Updates a single ParameterVersion. + * + * The async variant is + * {@see ParameterManagerClient::updateParameterVersionAsync()} . + * + * @example samples/V1/ParameterManagerClient/update_parameter_version.php + * + * @param UpdateParameterVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ParameterVersion + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateParameterVersion( + UpdateParameterVersionRequest $request, + array $callOptions = [] + ): ParameterVersion { + return $this->startApiCall('UpdateParameterVersion', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see ParameterManagerClient::getLocationAsync()} . + * + * @example samples/V1/ParameterManagerClient/get_location.php + * + * @param GetLocationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see ParameterManagerClient::listLocationsAsync()} . + * + * @example samples/V1/ParameterManagerClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } +} diff --git a/ParameterManager/src/V1/CreateParameterRequest.php b/ParameterManager/src/V1/CreateParameterRequest.php new file mode 100644 index 000000000000..6c4905474e2e --- /dev/null +++ b/ParameterManager/src/V1/CreateParameterRequest.php @@ -0,0 +1,242 @@ +google.cloud.parametermanager.v1.CreateParameterRequest + */ +class CreateParameterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Value for parent in the format + * `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Id of the Parameter resource + * + * Generated from protobuf field string parameter_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $parameter_id = ''; + /** + * Required. The Parameter resource being created + * + * Generated from protobuf field .google.cloud.parametermanager.v1.Parameter parameter = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $parameter = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $parent Required. Value for parent in the format + * `projects/*/locations/*`. Please see + * {@see ParameterManagerClient::locationName()} for help formatting this field. + * @param \Google\Cloud\ParameterManager\V1\Parameter $parameter Required. The Parameter resource being created + * @param string $parameterId Required. Id of the Parameter resource + * + * @return \Google\Cloud\ParameterManager\V1\CreateParameterRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\ParameterManager\V1\Parameter $parameter, string $parameterId): self + { + return (new self()) + ->setParent($parent) + ->setParameter($parameter) + ->setParameterId($parameterId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Value for parent in the format + * `projects/*/locations/*`. + * @type string $parameter_id + * Required. Id of the Parameter resource + * @type \Google\Cloud\ParameterManager\V1\Parameter $parameter + * Required. The Parameter resource being created + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Parametermanager\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Value for parent in the format + * `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Value for parent in the format + * `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Id of the Parameter resource + * + * Generated from protobuf field string parameter_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getParameterId() + { + return $this->parameter_id; + } + + /** + * Required. Id of the Parameter resource + * + * Generated from protobuf field string parameter_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setParameterId($var) + { + GPBUtil::checkString($var, True); + $this->parameter_id = $var; + + return $this; + } + + /** + * Required. The Parameter resource being created + * + * Generated from protobuf field .google.cloud.parametermanager.v1.Parameter parameter = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\ParameterManager\V1\Parameter|null + */ + public function getParameter() + { + return $this->parameter; + } + + public function hasParameter() + { + return isset($this->parameter); + } + + public function clearParameter() + { + unset($this->parameter); + } + + /** + * Required. The Parameter resource being created + * + * Generated from protobuf field .google.cloud.parametermanager.v1.Parameter parameter = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\ParameterManager\V1\Parameter $var + * @return $this + */ + public function setParameter($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ParameterManager\V1\Parameter::class); + $this->parameter = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/ParameterManager/src/V1/CreateParameterVersionRequest.php b/ParameterManager/src/V1/CreateParameterVersionRequest.php new file mode 100644 index 000000000000..8c790bd22283 --- /dev/null +++ b/ParameterManager/src/V1/CreateParameterVersionRequest.php @@ -0,0 +1,242 @@ +google.cloud.parametermanager.v1.CreateParameterVersionRequest + */ +class CreateParameterVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Value for parent in the format + * `projects/*/locations/*/parameters/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Id of the ParameterVersion resource + * + * Generated from protobuf field string parameter_version_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $parameter_version_id = ''; + /** + * Required. The ParameterVersion resource being created + * + * Generated from protobuf field .google.cloud.parametermanager.v1.ParameterVersion parameter_version = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $parameter_version = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $parent Required. Value for parent in the format + * `projects/*/locations/*/parameters/*`. Please see + * {@see ParameterManagerClient::parameterName()} for help formatting this field. + * @param \Google\Cloud\ParameterManager\V1\ParameterVersion $parameterVersion Required. The ParameterVersion resource being created + * @param string $parameterVersionId Required. Id of the ParameterVersion resource + * + * @return \Google\Cloud\ParameterManager\V1\CreateParameterVersionRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\ParameterManager\V1\ParameterVersion $parameterVersion, string $parameterVersionId): self + { + return (new self()) + ->setParent($parent) + ->setParameterVersion($parameterVersion) + ->setParameterVersionId($parameterVersionId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Value for parent in the format + * `projects/*/locations/*/parameters/*`. + * @type string $parameter_version_id + * Required. Id of the ParameterVersion resource + * @type \Google\Cloud\ParameterManager\V1\ParameterVersion $parameter_version + * Required. The ParameterVersion resource being created + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Parametermanager\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Value for parent in the format + * `projects/*/locations/*/parameters/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Value for parent in the format + * `projects/*/locations/*/parameters/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Id of the ParameterVersion resource + * + * Generated from protobuf field string parameter_version_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getParameterVersionId() + { + return $this->parameter_version_id; + } + + /** + * Required. Id of the ParameterVersion resource + * + * Generated from protobuf field string parameter_version_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setParameterVersionId($var) + { + GPBUtil::checkString($var, True); + $this->parameter_version_id = $var; + + return $this; + } + + /** + * Required. The ParameterVersion resource being created + * + * Generated from protobuf field .google.cloud.parametermanager.v1.ParameterVersion parameter_version = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\ParameterManager\V1\ParameterVersion|null + */ + public function getParameterVersion() + { + return $this->parameter_version; + } + + public function hasParameterVersion() + { + return isset($this->parameter_version); + } + + public function clearParameterVersion() + { + unset($this->parameter_version); + } + + /** + * Required. The ParameterVersion resource being created + * + * Generated from protobuf field .google.cloud.parametermanager.v1.ParameterVersion parameter_version = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\ParameterManager\V1\ParameterVersion $var + * @return $this + */ + public function setParameterVersion($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ParameterManager\V1\ParameterVersion::class); + $this->parameter_version = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/ParameterManager/src/V1/DeleteParameterRequest.php b/ParameterManager/src/V1/DeleteParameterRequest.php new file mode 100644 index 000000000000..65e90086ec3f --- /dev/null +++ b/ParameterManager/src/V1/DeleteParameterRequest.php @@ -0,0 +1,160 @@ +google.cloud.parametermanager.v1.DeleteParameterRequest + */ +class DeleteParameterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $name Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*`. Please see + * {@see ParameterManagerClient::parameterName()} for help formatting this field. + * + * @return \Google\Cloud\ParameterManager\V1\DeleteParameterRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*`. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Parametermanager\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*`. + * + * 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; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/ParameterManager/src/V1/DeleteParameterVersionRequest.php b/ParameterManager/src/V1/DeleteParameterVersionRequest.php new file mode 100644 index 000000000000..3dd164c5f08d --- /dev/null +++ b/ParameterManager/src/V1/DeleteParameterVersionRequest.php @@ -0,0 +1,160 @@ +google.cloud.parametermanager.v1.DeleteParameterVersionRequest + */ +class DeleteParameterVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*/versions/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $name Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*/versions/*`. Please see + * {@see ParameterManagerClient::parameterVersionName()} for help formatting this field. + * + * @return \Google\Cloud\ParameterManager\V1\DeleteParameterVersionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*/versions/*`. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Parametermanager\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*/versions/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*/versions/*`. + * + * 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; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/ParameterManager/src/V1/GetParameterRequest.php b/ParameterManager/src/V1/GetParameterRequest.php new file mode 100644 index 000000000000..2b5b26388f61 --- /dev/null +++ b/ParameterManager/src/V1/GetParameterRequest.php @@ -0,0 +1,86 @@ +google.cloud.parametermanager.v1.GetParameterRequest + */ +class GetParameterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*`. Please see + * {@see ParameterManagerClient::parameterName()} for help formatting this field. + * + * @return \Google\Cloud\ParameterManager\V1\GetParameterRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Parametermanager\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*`. + * + * 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/ParameterManager/src/V1/GetParameterVersionRequest.php b/ParameterManager/src/V1/GetParameterVersionRequest.php new file mode 100644 index 000000000000..e5a7586c28fd --- /dev/null +++ b/ParameterManager/src/V1/GetParameterVersionRequest.php @@ -0,0 +1,128 @@ +google.cloud.parametermanager.v1.GetParameterVersionRequest + */ +class GetParameterVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*/versions/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. View of the ParameterVersion. + * In the default FULL view, all metadata & payload associated with the + * ParameterVersion will be returned. + * + * Generated from protobuf field .google.cloud.parametermanager.v1.View view = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $view = 0; + + /** + * @param string $name Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*/versions/*`. Please see + * {@see ParameterManagerClient::parameterVersionName()} for help formatting this field. + * + * @return \Google\Cloud\ParameterManager\V1\GetParameterVersionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*/versions/*`. + * @type int $view + * Optional. View of the ParameterVersion. + * In the default FULL view, all metadata & payload associated with the + * ParameterVersion will be returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Parametermanager\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*/versions/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the resource in the format + * `projects/*/locations/*/parameters/*/versions/*`. + * + * 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; + } + + /** + * Optional. View of the ParameterVersion. + * In the default FULL view, all metadata & payload associated with the + * ParameterVersion will be returned. + * + * Generated from protobuf field .google.cloud.parametermanager.v1.View view = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * Optional. View of the ParameterVersion. + * In the default FULL view, all metadata & payload associated with the + * ParameterVersion will be returned. + * + * Generated from protobuf field .google.cloud.parametermanager.v1.View view = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\ParameterManager\V1\View::class); + $this->view = $var; + + return $this; + } + +} + diff --git a/ParameterManager/src/V1/ListParameterVersionsRequest.php b/ParameterManager/src/V1/ListParameterVersionsRequest.php new file mode 100644 index 000000000000..9f2e5c767cfc --- /dev/null +++ b/ParameterManager/src/V1/ListParameterVersionsRequest.php @@ -0,0 +1,226 @@ +google.cloud.parametermanager.v1.ListParameterVersionsRequest + */ +class ListParameterVersionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Parent value for ListParameterVersionsRequest in the format + * `projects/*/locations/*/parameters/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. Parent value for ListParameterVersionsRequest in the format + * `projects/*/locations/*/parameters/*`. Please see + * {@see ParameterManagerClient::parameterName()} for help formatting this field. + * + * @return \Google\Cloud\ParameterManager\V1\ListParameterVersionsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Parent value for ListParameterVersionsRequest in the format + * `projects/*/locations/*/parameters/*`. + * @type int $page_size + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @type string $page_token + * Optional. A token identifying a page of results the server should return. + * @type string $filter + * Optional. Filtering results + * @type string $order_by + * Optional. Hint for how to order the results + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Parametermanager\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Parent value for ListParameterVersionsRequest in the format + * `projects/*/locations/*/parameters/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Parent value for ListParameterVersionsRequest in the format + * `projects/*/locations/*/parameters/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/ParameterManager/src/V1/ListParameterVersionsResponse.php b/ParameterManager/src/V1/ListParameterVersionsResponse.php new file mode 100644 index 000000000000..5165de8150d5 --- /dev/null +++ b/ParameterManager/src/V1/ListParameterVersionsResponse.php @@ -0,0 +1,135 @@ +google.cloud.parametermanager.v1.ListParameterVersionsResponse + */ +class ListParameterVersionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of ParameterVersions + * + * Generated from protobuf field repeated .google.cloud.parametermanager.v1.ParameterVersion parameter_versions = 1; + */ + private $parameter_versions; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Unordered list. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = UNORDERED_LIST]; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\ParameterManager\V1\ParameterVersion>|\Google\Protobuf\Internal\RepeatedField $parameter_versions + * The list of ParameterVersions + * @type string $next_page_token + * A token identifying a page of results the server should return. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Unordered list. Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Parametermanager\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The list of ParameterVersions + * + * Generated from protobuf field repeated .google.cloud.parametermanager.v1.ParameterVersion parameter_versions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParameterVersions() + { + return $this->parameter_versions; + } + + /** + * The list of ParameterVersions + * + * Generated from protobuf field repeated .google.cloud.parametermanager.v1.ParameterVersion parameter_versions = 1; + * @param array<\Google\Cloud\ParameterManager\V1\ParameterVersion>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParameterVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ParameterManager\V1\ParameterVersion::class); + $this->parameter_versions = $arr; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Unordered list. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = UNORDERED_LIST]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Unordered list. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = UNORDERED_LIST]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/ParameterManager/src/V1/ListParametersRequest.php b/ParameterManager/src/V1/ListParametersRequest.php new file mode 100644 index 000000000000..e862a5412c42 --- /dev/null +++ b/ParameterManager/src/V1/ListParametersRequest.php @@ -0,0 +1,226 @@ +google.cloud.parametermanager.v1.ListParametersRequest + */ +class ListParametersRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Parent value for ListParametersRequest in the format + * `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. Parent value for ListParametersRequest in the format + * `projects/*/locations/*`. Please see + * {@see ParameterManagerClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\ParameterManager\V1\ListParametersRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Parent value for ListParametersRequest in the format + * `projects/*/locations/*`. + * @type int $page_size + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @type string $page_token + * Optional. A token identifying a page of results the server should return. + * @type string $filter + * Optional. Filtering results + * @type string $order_by + * Optional. Hint for how to order the results + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Parametermanager\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Parent value for ListParametersRequest in the format + * `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Parent value for ListParametersRequest in the format + * `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/ParameterManager/src/V1/ListParametersResponse.php b/ParameterManager/src/V1/ListParametersResponse.php new file mode 100644 index 000000000000..9d71f6d1f4f4 --- /dev/null +++ b/ParameterManager/src/V1/ListParametersResponse.php @@ -0,0 +1,135 @@ +google.cloud.parametermanager.v1.ListParametersResponse + */ +class ListParametersResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Parameters + * + * Generated from protobuf field repeated .google.cloud.parametermanager.v1.Parameter parameters = 1; + */ + private $parameters; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Unordered list. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = UNORDERED_LIST]; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\ParameterManager\V1\Parameter>|\Google\Protobuf\Internal\RepeatedField $parameters + * The list of Parameters + * @type string $next_page_token + * A token identifying a page of results the server should return. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Unordered list. Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Parametermanager\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The list of Parameters + * + * Generated from protobuf field repeated .google.cloud.parametermanager.v1.Parameter parameters = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParameters() + { + return $this->parameters; + } + + /** + * The list of Parameters + * + * Generated from protobuf field repeated .google.cloud.parametermanager.v1.Parameter parameters = 1; + * @param array<\Google\Cloud\ParameterManager\V1\Parameter>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParameters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ParameterManager\V1\Parameter::class); + $this->parameters = $arr; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Unordered list. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = UNORDERED_LIST]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Unordered list. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = UNORDERED_LIST]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/ParameterManager/src/V1/Parameter.php b/ParameterManager/src/V1/Parameter.php new file mode 100644 index 000000000000..8a1ef9170081 --- /dev/null +++ b/ParameterManager/src/V1/Parameter.php @@ -0,0 +1,275 @@ +google.cloud.parametermanager.v1.Parameter + */ +class Parameter extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. [Output only] The resource name of the Parameter in the format + * `projects/*/locations/*/parameters/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Output only. [Output only] Create time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. [Output only] Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Optional. Labels as key value pairs + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + /** + * Optional. Specifies the format of a Parameter. + * + * Generated from protobuf field .google.cloud.parametermanager.v1.ParameterFormat format = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $format = 0; + /** + * Output only. [Output-only] policy member strings of a Google Cloud + * resource. + * + * Generated from protobuf field .google.iam.v1.ResourcePolicyMember policy_member = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $policy_member = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. [Output only] The resource name of the Parameter in the format + * `projects/*/locations/*/parameters/*`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. [Output only] Create time stamp + * @type \Google\Protobuf\Timestamp $update_time + * Output only. [Output only] Update time stamp + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. Labels as key value pairs + * @type int $format + * Optional. Specifies the format of a Parameter. + * @type \Google\Cloud\Iam\V1\ResourcePolicyMember $policy_member + * Output only. [Output-only] policy member strings of a Google Cloud + * resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Parametermanager\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. [Output only] The resource name of the Parameter in the format + * `projects/*/locations/*/parameters/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. [Output only] The resource name of the Parameter in the format + * `projects/*/locations/*/parameters/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. [Output only] Create time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. [Output only] Create time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. [Output only] Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. [Output only] Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Optional. Labels as key value pairs + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. Labels as key value pairs + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Optional. Specifies the format of a Parameter. + * + * Generated from protobuf field .google.cloud.parametermanager.v1.ParameterFormat format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getFormat() + { + return $this->format; + } + + /** + * Optional. Specifies the format of a Parameter. + * + * Generated from protobuf field .google.cloud.parametermanager.v1.ParameterFormat format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setFormat($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\ParameterManager\V1\ParameterFormat::class); + $this->format = $var; + + return $this; + } + + /** + * Output only. [Output-only] policy member strings of a Google Cloud + * resource. + * + * Generated from protobuf field .google.iam.v1.ResourcePolicyMember policy_member = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Iam\V1\ResourcePolicyMember|null + */ + public function getPolicyMember() + { + return $this->policy_member; + } + + public function hasPolicyMember() + { + return isset($this->policy_member); + } + + public function clearPolicyMember() + { + unset($this->policy_member); + } + + /** + * Output only. [Output-only] policy member strings of a Google Cloud + * resource. + * + * Generated from protobuf field .google.iam.v1.ResourcePolicyMember policy_member = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Iam\V1\ResourcePolicyMember $var + * @return $this + */ + public function setPolicyMember($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Iam\V1\ResourcePolicyMember::class); + $this->policy_member = $var; + + return $this; + } + +} + diff --git a/ParameterManager/src/V1/ParameterFormat.php b/ParameterManager/src/V1/ParameterFormat.php new file mode 100644 index 000000000000..79a10566627e --- /dev/null +++ b/ParameterManager/src/V1/ParameterFormat.php @@ -0,0 +1,71 @@ +google.cloud.parametermanager.v1.ParameterFormat + */ +class ParameterFormat +{ + /** + * The default / unset value. + * The API will default to the UNFORMATTED format. + * + * Generated from protobuf enum PARAMETER_FORMAT_UNSPECIFIED = 0; + */ + const PARAMETER_FORMAT_UNSPECIFIED = 0; + /** + * Unformatted. + * + * Generated from protobuf enum UNFORMATTED = 1; + */ + const UNFORMATTED = 1; + /** + * YAML format. + * + * Generated from protobuf enum YAML = 2; + */ + const YAML = 2; + /** + * JSON format. + * + * Generated from protobuf enum JSON = 3; + */ + const JSON = 3; + + private static $valueToName = [ + self::PARAMETER_FORMAT_UNSPECIFIED => 'PARAMETER_FORMAT_UNSPECIFIED', + self::UNFORMATTED => 'UNFORMATTED', + self::YAML => 'YAML', + self::JSON => 'JSON', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/ParameterManager/src/V1/ParameterVersion.php b/ParameterManager/src/V1/ParameterVersion.php new file mode 100644 index 000000000000..21cae1151937 --- /dev/null +++ b/ParameterManager/src/V1/ParameterVersion.php @@ -0,0 +1,261 @@ +google.cloud.parametermanager.v1.ParameterVersion + */ +class ParameterVersion extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. [Output only] The resource name of the ParameterVersion in the + * format `projects/*/locations/*/parameters/*/versions/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Output only. [Output only] Create time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. [Output only] Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Optional. Disabled boolean to determine if a ParameterVersion acts as a + * metadata only resource (payload is never returned if disabled is true). If + * true any calls will always default to BASIC view even if the user + * explicitly passes FULL view as part of the request. A render call on a + * disabled resource fails with an error. Default value is False. + * + * Generated from protobuf field bool disabled = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $disabled = false; + /** + * Required. Immutable. Payload content of a ParameterVersion resource. This + * is only returned when the request provides the View value of FULL (default + * for GET request). + * + * Generated from protobuf field .google.cloud.parametermanager.v1.ParameterVersionPayload payload = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + */ + protected $payload = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. [Output only] The resource name of the ParameterVersion in the + * format `projects/*/locations/*/parameters/*/versions/*`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. [Output only] Create time stamp + * @type \Google\Protobuf\Timestamp $update_time + * Output only. [Output only] Update time stamp + * @type bool $disabled + * Optional. Disabled boolean to determine if a ParameterVersion acts as a + * metadata only resource (payload is never returned if disabled is true). If + * true any calls will always default to BASIC view even if the user + * explicitly passes FULL view as part of the request. A render call on a + * disabled resource fails with an error. Default value is False. + * @type \Google\Cloud\ParameterManager\V1\ParameterVersionPayload $payload + * Required. Immutable. Payload content of a ParameterVersion resource. This + * is only returned when the request provides the View value of FULL (default + * for GET request). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Parametermanager\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. [Output only] The resource name of the ParameterVersion in the + * format `projects/*/locations/*/parameters/*/versions/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. [Output only] The resource name of the ParameterVersion in the + * format `projects/*/locations/*/parameters/*/versions/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. [Output only] Create time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. [Output only] Create time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. [Output only] Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. [Output only] Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Optional. Disabled boolean to determine if a ParameterVersion acts as a + * metadata only resource (payload is never returned if disabled is true). If + * true any calls will always default to BASIC view even if the user + * explicitly passes FULL view as part of the request. A render call on a + * disabled resource fails with an error. Default value is False. + * + * Generated from protobuf field bool disabled = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getDisabled() + { + return $this->disabled; + } + + /** + * Optional. Disabled boolean to determine if a ParameterVersion acts as a + * metadata only resource (payload is never returned if disabled is true). If + * true any calls will always default to BASIC view even if the user + * explicitly passes FULL view as part of the request. A render call on a + * disabled resource fails with an error. Default value is False. + * + * Generated from protobuf field bool disabled = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setDisabled($var) + { + GPBUtil::checkBool($var); + $this->disabled = $var; + + return $this; + } + + /** + * Required. Immutable. Payload content of a ParameterVersion resource. This + * is only returned when the request provides the View value of FULL (default + * for GET request). + * + * Generated from protobuf field .google.cloud.parametermanager.v1.ParameterVersionPayload payload = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Cloud\ParameterManager\V1\ParameterVersionPayload|null + */ + public function getPayload() + { + return $this->payload; + } + + public function hasPayload() + { + return isset($this->payload); + } + + public function clearPayload() + { + unset($this->payload); + } + + /** + * Required. Immutable. Payload content of a ParameterVersion resource. This + * is only returned when the request provides the View value of FULL (default + * for GET request). + * + * Generated from protobuf field .google.cloud.parametermanager.v1.ParameterVersionPayload payload = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * @param \Google\Cloud\ParameterManager\V1\ParameterVersionPayload $var + * @return $this + */ + public function setPayload($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ParameterManager\V1\ParameterVersionPayload::class); + $this->payload = $var; + + return $this; + } + +} + diff --git a/ParameterManager/src/V1/ParameterVersionPayload.php b/ParameterManager/src/V1/ParameterVersionPayload.php new file mode 100644 index 000000000000..5b51d229c5ad --- /dev/null +++ b/ParameterManager/src/V1/ParameterVersionPayload.php @@ -0,0 +1,67 @@ +google.cloud.parametermanager.v1.ParameterVersionPayload + */ +class ParameterVersionPayload extends \Google\Protobuf\Internal\Message +{ + /** + * Required. bytes data for storing payload. + * + * Generated from protobuf field bytes data = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $data = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $data + * Required. bytes data for storing payload. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Parametermanager\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. bytes data for storing payload. + * + * Generated from protobuf field bytes data = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getData() + { + return $this->data; + } + + /** + * Required. bytes data for storing payload. + * + * Generated from protobuf field bytes data = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setData($var) + { + GPBUtil::checkString($var, False); + $this->data = $var; + + return $this; + } + +} + diff --git a/ParameterManager/src/V1/RenderParameterVersionRequest.php b/ParameterManager/src/V1/RenderParameterVersionRequest.php new file mode 100644 index 000000000000..51ad1f82f41b --- /dev/null +++ b/ParameterManager/src/V1/RenderParameterVersionRequest.php @@ -0,0 +1,81 @@ +google.cloud.parametermanager.v1.RenderParameterVersionRequest + */ +class RenderParameterVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the resource + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the resource + * Please see {@see ParameterManagerClient::parameterVersionName()} for help formatting this field. + * + * @return \Google\Cloud\ParameterManager\V1\RenderParameterVersionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the resource + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Parametermanager\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the resource + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the resource + * + * 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/ParameterManager/src/V1/RenderParameterVersionResponse.php b/ParameterManager/src/V1/RenderParameterVersionResponse.php new file mode 100644 index 000000000000..649aba1994b9 --- /dev/null +++ b/ParameterManager/src/V1/RenderParameterVersionResponse.php @@ -0,0 +1,161 @@ +google.cloud.parametermanager.v1.RenderParameterVersionResponse + */ +class RenderParameterVersionResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Resource identifier of a ParameterVersion in the format + * `projects/*/locations/*/parameters/*/versions/*`. + * + * Generated from protobuf field string parameter_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $parameter_version = ''; + /** + * Payload content of a ParameterVersion resource. + * + * Generated from protobuf field .google.cloud.parametermanager.v1.ParameterVersionPayload payload = 2; + */ + protected $payload = null; + /** + * Output only. Server generated rendered version of the user provided payload + * data (ParameterVersionPayload) which has substitutions of all (if any) + * references to a SecretManager SecretVersion resources. This substituion + * only works for a Parameter which is in JSON or YAML format. + * + * Generated from protobuf field bytes rendered_payload = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $rendered_payload = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parameter_version + * Output only. Resource identifier of a ParameterVersion in the format + * `projects/*/locations/*/parameters/*/versions/*`. + * @type \Google\Cloud\ParameterManager\V1\ParameterVersionPayload $payload + * Payload content of a ParameterVersion resource. + * @type string $rendered_payload + * Output only. Server generated rendered version of the user provided payload + * data (ParameterVersionPayload) which has substitutions of all (if any) + * references to a SecretManager SecretVersion resources. This substituion + * only works for a Parameter which is in JSON or YAML format. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Parametermanager\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Resource identifier of a ParameterVersion in the format + * `projects/*/locations/*/parameters/*/versions/*`. + * + * Generated from protobuf field string parameter_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getParameterVersion() + { + return $this->parameter_version; + } + + /** + * Output only. Resource identifier of a ParameterVersion in the format + * `projects/*/locations/*/parameters/*/versions/*`. + * + * Generated from protobuf field string parameter_version = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParameterVersion($var) + { + GPBUtil::checkString($var, True); + $this->parameter_version = $var; + + return $this; + } + + /** + * Payload content of a ParameterVersion resource. + * + * Generated from protobuf field .google.cloud.parametermanager.v1.ParameterVersionPayload payload = 2; + * @return \Google\Cloud\ParameterManager\V1\ParameterVersionPayload|null + */ + public function getPayload() + { + return $this->payload; + } + + public function hasPayload() + { + return isset($this->payload); + } + + public function clearPayload() + { + unset($this->payload); + } + + /** + * Payload content of a ParameterVersion resource. + * + * Generated from protobuf field .google.cloud.parametermanager.v1.ParameterVersionPayload payload = 2; + * @param \Google\Cloud\ParameterManager\V1\ParameterVersionPayload $var + * @return $this + */ + public function setPayload($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ParameterManager\V1\ParameterVersionPayload::class); + $this->payload = $var; + + return $this; + } + + /** + * Output only. Server generated rendered version of the user provided payload + * data (ParameterVersionPayload) which has substitutions of all (if any) + * references to a SecretManager SecretVersion resources. This substituion + * only works for a Parameter which is in JSON or YAML format. + * + * Generated from protobuf field bytes rendered_payload = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRenderedPayload() + { + return $this->rendered_payload; + } + + /** + * Output only. Server generated rendered version of the user provided payload + * data (ParameterVersionPayload) which has substitutions of all (if any) + * references to a SecretManager SecretVersion resources. This substituion + * only works for a Parameter which is in JSON or YAML format. + * + * Generated from protobuf field bytes rendered_payload = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRenderedPayload($var) + { + GPBUtil::checkString($var, False); + $this->rendered_payload = $var; + + return $this; + } + +} + diff --git a/ParameterManager/src/V1/UpdateParameterRequest.php b/ParameterManager/src/V1/UpdateParameterRequest.php new file mode 100644 index 000000000000..e095c265ca5a --- /dev/null +++ b/ParameterManager/src/V1/UpdateParameterRequest.php @@ -0,0 +1,235 @@ +google.cloud.parametermanager.v1.UpdateParameterRequest + */ +class UpdateParameterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Parameter resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A mutable field will be overwritten if it is in the + * mask. If the user does not provide a mask then all mutable fields present + * in the request will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. The Parameter resource being updated + * + * Generated from protobuf field .google.cloud.parametermanager.v1.Parameter parameter = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $parameter = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\ParameterManager\V1\Parameter $parameter Required. The Parameter resource being updated + * @param \Google\Protobuf\FieldMask $updateMask Optional. Field mask is used to specify the fields to be overwritten in the + * Parameter resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A mutable field will be overwritten if it is in the + * mask. If the user does not provide a mask then all mutable fields present + * in the request will be overwritten. + * + * @return \Google\Cloud\ParameterManager\V1\UpdateParameterRequest + * + * @experimental + */ + public static function build(\Google\Cloud\ParameterManager\V1\Parameter $parameter, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setParameter($parameter) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Parameter resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A mutable field will be overwritten if it is in the + * mask. If the user does not provide a mask then all mutable fields present + * in the request will be overwritten. + * @type \Google\Cloud\ParameterManager\V1\Parameter $parameter + * Required. The Parameter resource being updated + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Parametermanager\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Parameter resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A mutable field will be overwritten if it is in the + * mask. If the user does not provide a mask then all mutable fields present + * in the request will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Parameter resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A mutable field will be overwritten if it is in the + * mask. If the user does not provide a mask then all mutable fields present + * in the request will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The Parameter resource being updated + * + * Generated from protobuf field .google.cloud.parametermanager.v1.Parameter parameter = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\ParameterManager\V1\Parameter|null + */ + public function getParameter() + { + return $this->parameter; + } + + public function hasParameter() + { + return isset($this->parameter); + } + + public function clearParameter() + { + unset($this->parameter); + } + + /** + * Required. The Parameter resource being updated + * + * Generated from protobuf field .google.cloud.parametermanager.v1.Parameter parameter = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\ParameterManager\V1\Parameter $var + * @return $this + */ + public function setParameter($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ParameterManager\V1\Parameter::class); + $this->parameter = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/ParameterManager/src/V1/UpdateParameterVersionRequest.php b/ParameterManager/src/V1/UpdateParameterVersionRequest.php new file mode 100644 index 000000000000..074142fc7ef0 --- /dev/null +++ b/ParameterManager/src/V1/UpdateParameterVersionRequest.php @@ -0,0 +1,235 @@ +google.cloud.parametermanager.v1.UpdateParameterVersionRequest + */ +class UpdateParameterVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * ParameterVersion resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A mutable field will be overwritten if it is in the + * mask. If the user does not provide a mask then all mutable fields present + * in the request will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. The ParameterVersion resource being updated + * + * Generated from protobuf field .google.cloud.parametermanager.v1.ParameterVersion parameter_version = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $parameter_version = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\ParameterManager\V1\ParameterVersion $parameterVersion Required. The ParameterVersion resource being updated + * @param \Google\Protobuf\FieldMask $updateMask Optional. Field mask is used to specify the fields to be overwritten in the + * ParameterVersion resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A mutable field will be overwritten if it is in the + * mask. If the user does not provide a mask then all mutable fields present + * in the request will be overwritten. + * + * @return \Google\Cloud\ParameterManager\V1\UpdateParameterVersionRequest + * + * @experimental + */ + public static function build(\Google\Cloud\ParameterManager\V1\ParameterVersion $parameterVersion, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setParameterVersion($parameterVersion) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Field mask is used to specify the fields to be overwritten in the + * ParameterVersion resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A mutable field will be overwritten if it is in the + * mask. If the user does not provide a mask then all mutable fields present + * in the request will be overwritten. + * @type \Google\Cloud\ParameterManager\V1\ParameterVersion $parameter_version + * Required. The ParameterVersion resource being updated + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Parametermanager\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * ParameterVersion resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A mutable field will be overwritten if it is in the + * mask. If the user does not provide a mask then all mutable fields present + * in the request will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * ParameterVersion resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A mutable field will be overwritten if it is in the + * mask. If the user does not provide a mask then all mutable fields present + * in the request will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The ParameterVersion resource being updated + * + * Generated from protobuf field .google.cloud.parametermanager.v1.ParameterVersion parameter_version = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\ParameterManager\V1\ParameterVersion|null + */ + public function getParameterVersion() + { + return $this->parameter_version; + } + + public function hasParameterVersion() + { + return isset($this->parameter_version); + } + + public function clearParameterVersion() + { + unset($this->parameter_version); + } + + /** + * Required. The ParameterVersion resource being updated + * + * Generated from protobuf field .google.cloud.parametermanager.v1.ParameterVersion parameter_version = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\ParameterManager\V1\ParameterVersion $var + * @return $this + */ + public function setParameterVersion($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ParameterManager\V1\ParameterVersion::class); + $this->parameter_version = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/ParameterManager/src/V1/View.php b/ParameterManager/src/V1/View.php new file mode 100644 index 000000000000..f604f17283eb --- /dev/null +++ b/ParameterManager/src/V1/View.php @@ -0,0 +1,64 @@ +google.cloud.parametermanager.v1.View + */ +class View +{ + /** + * The default / unset value. + * The API will default to the FULL view.. + * + * Generated from protobuf enum VIEW_UNSPECIFIED = 0; + */ + const VIEW_UNSPECIFIED = 0; + /** + * Include only the metadata for the resource. + * + * Generated from protobuf enum BASIC = 1; + */ + const BASIC = 1; + /** + * Include metadata & other relevant payload data as well. + * This is the default view. + * + * Generated from protobuf enum FULL = 2; + */ + const FULL = 2; + + private static $valueToName = [ + self::VIEW_UNSPECIFIED => 'VIEW_UNSPECIFIED', + self::BASIC => 'BASIC', + self::FULL => 'FULL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/ParameterManager/src/V1/gapic_metadata.json b/ParameterManager/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..f551306bfa21 --- /dev/null +++ b/ParameterManager/src/V1/gapic_metadata.json @@ -0,0 +1,83 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.parametermanager.v1", + "libraryPackage": "Google\\Cloud\\ParameterManager\\V1", + "services": { + "ParameterManager": { + "clients": { + "grpc": { + "libraryClient": "ParameterManagerGapicClient", + "rpcs": { + "CreateParameter": { + "methods": [ + "createParameter" + ] + }, + "CreateParameterVersion": { + "methods": [ + "createParameterVersion" + ] + }, + "DeleteParameter": { + "methods": [ + "deleteParameter" + ] + }, + "DeleteParameterVersion": { + "methods": [ + "deleteParameterVersion" + ] + }, + "GetParameter": { + "methods": [ + "getParameter" + ] + }, + "GetParameterVersion": { + "methods": [ + "getParameterVersion" + ] + }, + "ListParameterVersions": { + "methods": [ + "listParameterVersions" + ] + }, + "ListParameters": { + "methods": [ + "listParameters" + ] + }, + "RenderParameterVersion": { + "methods": [ + "renderParameterVersion" + ] + }, + "UpdateParameter": { + "methods": [ + "updateParameter" + ] + }, + "UpdateParameterVersion": { + "methods": [ + "updateParameterVersion" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/ParameterManager/src/V1/resources/parameter_manager_client_config.json b/ParameterManager/src/V1/resources/parameter_manager_client_config.json new file mode 100644 index 000000000000..0c51e8e378e8 --- /dev/null +++ b/ParameterManager/src/V1/resources/parameter_manager_client_config.json @@ -0,0 +1,109 @@ +{ + "interfaces": { + "google.cloud.parametermanager.v1.ParameterManager": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "no_retry_1_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "CreateParameter": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateParameterVersion": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteParameter": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteParameterVersion": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetParameter": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetParameterVersion": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListParameterVersions": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListParameters": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "RenderParameterVersion": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateParameter": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateParameterVersion": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/ParameterManager/src/V1/resources/parameter_manager_descriptor_config.php b/ParameterManager/src/V1/resources/parameter_manager_descriptor_config.php new file mode 100644 index 000000000000..024bb0886395 --- /dev/null +++ b/ParameterManager/src/V1/resources/parameter_manager_descriptor_config.php @@ -0,0 +1,217 @@ + [ + 'google.cloud.parametermanager.v1.ParameterManager' => [ + 'CreateParameter' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\ParameterManager\V1\Parameter', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateParameterVersion' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\ParameterManager\V1\ParameterVersion', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteParameter' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteParameterVersion' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetParameter' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\ParameterManager\V1\Parameter', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetParameterVersion' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\ParameterManager\V1\ParameterVersion', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListParameterVersions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getParameterVersions', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\ParameterManager\V1\ListParameterVersionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListParameters' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getParameters', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\ParameterManager\V1\ListParametersResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'RenderParameterVersion' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\ParameterManager\V1\RenderParameterVersionResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateParameter' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\ParameterManager\V1\Parameter', + 'headerParams' => [ + [ + 'keyName' => 'parameter.name', + 'fieldAccessors' => [ + 'getParameter', + 'getName', + ], + ], + ], + ], + 'UpdateParameterVersion' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\ParameterManager\V1\ParameterVersion', + 'headerParams' => [ + [ + 'keyName' => 'parameter_version.name', + 'fieldAccessors' => [ + 'getParameterVersion', + 'getName', + ], + ], + ], + ], + 'GetLocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Location\Location', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'templateMap' => [ + 'location' => 'projects/{project}/locations/{location}', + 'parameter' => 'projects/{project}/locations/{location}/parameters/{parameter}', + 'parameterVersion' => 'projects/{project}/locations/{location}/parameters/{parameter}/versions/{parameter_version}', + ], + ], + ], +]; diff --git a/ParameterManager/src/V1/resources/parameter_manager_rest_client_config.php b/ParameterManager/src/V1/resources/parameter_manager_rest_client_config.php new file mode 100644 index 000000000000..55ae431ad2f7 --- /dev/null +++ b/ParameterManager/src/V1/resources/parameter_manager_rest_client_config.php @@ -0,0 +1,186 @@ + [ + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.parametermanager.v1.ParameterManager' => [ + 'CreateParameter' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/parameters', + 'body' => 'parameter', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'parameter_id', + ], + ], + 'CreateParameterVersion' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/parameters/*}/versions', + 'body' => 'parameter_version', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'parameter_version_id', + ], + ], + 'DeleteParameter' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/parameters/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteParameterVersion' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/parameters/*/versions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetParameter' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/parameters/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetParameterVersion' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/parameters/*/versions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListParameterVersions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/parameters/*}/versions', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListParameters' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/parameters', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'RenderParameterVersion' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/parameters/*/versions/*}:render', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateParameter' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{parameter.name=projects/*/locations/*/parameters/*}', + 'body' => 'parameter', + 'placeholders' => [ + 'parameter.name' => [ + 'getters' => [ + 'getParameter', + 'getName', + ], + ], + ], + ], + 'UpdateParameterVersion' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{parameter_version.name=projects/*/locations/*/parameters/*/versions/*}', + 'body' => 'parameter_version', + 'placeholders' => [ + 'parameter_version.name' => [ + 'getters' => [ + 'getParameterVersion', + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/ParameterManager/tests/Unit/V1/Client/ParameterManagerClientTest.php b/ParameterManager/tests/Unit/V1/Client/ParameterManagerClientTest.php new file mode 100644 index 000000000000..cef6417d1c68 --- /dev/null +++ b/ParameterManager/tests/Unit/V1/Client/ParameterManagerClientTest.php @@ -0,0 +1,1052 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return ParameterManagerClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ParameterManagerClient($options); + } + + /** @test */ + public function createParameterTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new Parameter(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $parameterId = 'parameterId-1536249487'; + $parameter = new Parameter(); + $request = (new CreateParameterRequest()) + ->setParent($formattedParent) + ->setParameterId($parameterId) + ->setParameter($parameter); + $response = $gapicClient->createParameter($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.parametermanager.v1.ParameterManager/CreateParameter', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getParameterId(); + $this->assertProtobufEquals($parameterId, $actualValue); + $actualValue = $actualRequestObject->getParameter(); + $this->assertProtobufEquals($parameter, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createParameterExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $parameterId = 'parameterId-1536249487'; + $parameter = new Parameter(); + $request = (new CreateParameterRequest()) + ->setParent($formattedParent) + ->setParameterId($parameterId) + ->setParameter($parameter); + try { + $gapicClient->createParameter($request); + // If the $gapicClient 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 createParameterVersionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $disabled = true; + $expectedResponse = new ParameterVersion(); + $expectedResponse->setName($name); + $expectedResponse->setDisabled($disabled); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->parameterName('[PROJECT]', '[LOCATION]', '[PARAMETER]'); + $parameterVersionId = 'parameterVersionId-728697800'; + $parameterVersion = new ParameterVersion(); + $parameterVersionPayload = new ParameterVersionPayload(); + $payloadData = '88'; + $parameterVersionPayload->setData($payloadData); + $parameterVersion->setPayload($parameterVersionPayload); + $request = (new CreateParameterVersionRequest()) + ->setParent($formattedParent) + ->setParameterVersionId($parameterVersionId) + ->setParameterVersion($parameterVersion); + $response = $gapicClient->createParameterVersion($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.parametermanager.v1.ParameterManager/CreateParameterVersion', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getParameterVersionId(); + $this->assertProtobufEquals($parameterVersionId, $actualValue); + $actualValue = $actualRequestObject->getParameterVersion(); + $this->assertProtobufEquals($parameterVersion, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createParameterVersionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->parameterName('[PROJECT]', '[LOCATION]', '[PARAMETER]'); + $parameterVersionId = 'parameterVersionId-728697800'; + $parameterVersion = new ParameterVersion(); + $parameterVersionPayload = new ParameterVersionPayload(); + $payloadData = '88'; + $parameterVersionPayload->setData($payloadData); + $parameterVersion->setPayload($parameterVersionPayload); + $request = (new CreateParameterVersionRequest()) + ->setParent($formattedParent) + ->setParameterVersionId($parameterVersionId) + ->setParameterVersion($parameterVersion); + try { + $gapicClient->createParameterVersion($request); + // If the $gapicClient 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 deleteParameterTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->parameterName('[PROJECT]', '[LOCATION]', '[PARAMETER]'); + $request = (new DeleteParameterRequest())->setName($formattedName); + $gapicClient->deleteParameter($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.parametermanager.v1.ParameterManager/DeleteParameter', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteParameterExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $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 = $gapicClient->parameterName('[PROJECT]', '[LOCATION]', '[PARAMETER]'); + $request = (new DeleteParameterRequest())->setName($formattedName); + try { + $gapicClient->deleteParameter($request); + // If the $gapicClient 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 deleteParameterVersionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->parameterVersionName( + '[PROJECT]', + '[LOCATION]', + '[PARAMETER]', + '[PARAMETER_VERSION]' + ); + $request = (new DeleteParameterVersionRequest())->setName($formattedName); + $gapicClient->deleteParameterVersion($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.parametermanager.v1.ParameterManager/DeleteParameterVersion', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteParameterVersionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $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 = $gapicClient->parameterVersionName( + '[PROJECT]', + '[LOCATION]', + '[PARAMETER]', + '[PARAMETER_VERSION]' + ); + $request = (new DeleteParameterVersionRequest())->setName($formattedName); + try { + $gapicClient->deleteParameterVersion($request); + // If the $gapicClient 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 getParameterTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new Parameter(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->parameterName('[PROJECT]', '[LOCATION]', '[PARAMETER]'); + $request = (new GetParameterRequest())->setName($formattedName); + $response = $gapicClient->getParameter($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.parametermanager.v1.ParameterManager/GetParameter', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getParameterExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $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 = $gapicClient->parameterName('[PROJECT]', '[LOCATION]', '[PARAMETER]'); + $request = (new GetParameterRequest())->setName($formattedName); + try { + $gapicClient->getParameter($request); + // If the $gapicClient 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 getParameterVersionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $disabled = true; + $expectedResponse = new ParameterVersion(); + $expectedResponse->setName($name2); + $expectedResponse->setDisabled($disabled); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->parameterVersionName( + '[PROJECT]', + '[LOCATION]', + '[PARAMETER]', + '[PARAMETER_VERSION]' + ); + $request = (new GetParameterVersionRequest())->setName($formattedName); + $response = $gapicClient->getParameterVersion($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.parametermanager.v1.ParameterManager/GetParameterVersion', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getParameterVersionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $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 = $gapicClient->parameterVersionName( + '[PROJECT]', + '[LOCATION]', + '[PARAMETER]', + '[PARAMETER_VERSION]' + ); + $request = (new GetParameterVersionRequest())->setName($formattedName); + try { + $gapicClient->getParameterVersion($request); + // If the $gapicClient 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 listParameterVersionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $parameterVersionsElement = new ParameterVersion(); + $parameterVersions = [$parameterVersionsElement]; + $expectedResponse = new ListParameterVersionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setParameterVersions($parameterVersions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->parameterName('[PROJECT]', '[LOCATION]', '[PARAMETER]'); + $request = (new ListParameterVersionsRequest())->setParent($formattedParent); + $response = $gapicClient->listParameterVersions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getParameterVersions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.parametermanager.v1.ParameterManager/ListParameterVersions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listParameterVersionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->parameterName('[PROJECT]', '[LOCATION]', '[PARAMETER]'); + $request = (new ListParameterVersionsRequest())->setParent($formattedParent); + try { + $gapicClient->listParameterVersions($request); + // If the $gapicClient 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 listParametersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $parametersElement = new Parameter(); + $parameters = [$parametersElement]; + $expectedResponse = new ListParametersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setParameters($parameters); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListParametersRequest())->setParent($formattedParent); + $response = $gapicClient->listParameters($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getParameters()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.parametermanager.v1.ParameterManager/ListParameters', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listParametersExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListParametersRequest())->setParent($formattedParent); + try { + $gapicClient->listParameters($request); + // If the $gapicClient 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 renderParameterVersionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $parameterVersion = 'parameterVersion1926086210'; + $renderedPayload = '4'; + $expectedResponse = new RenderParameterVersionResponse(); + $expectedResponse->setParameterVersion($parameterVersion); + $expectedResponse->setRenderedPayload($renderedPayload); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->parameterVersionName( + '[PROJECT]', + '[LOCATION]', + '[PARAMETER]', + '[PARAMETER_VERSION]' + ); + $request = (new RenderParameterVersionRequest())->setName($formattedName); + $response = $gapicClient->renderParameterVersion($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.parametermanager.v1.ParameterManager/RenderParameterVersion', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function renderParameterVersionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $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 = $gapicClient->parameterVersionName( + '[PROJECT]', + '[LOCATION]', + '[PARAMETER]', + '[PARAMETER_VERSION]' + ); + $request = (new RenderParameterVersionRequest())->setName($formattedName); + try { + $gapicClient->renderParameterVersion($request); + // If the $gapicClient 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 updateParameterTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new Parameter(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $parameter = new Parameter(); + $request = (new UpdateParameterRequest())->setParameter($parameter); + $response = $gapicClient->updateParameter($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.parametermanager.v1.ParameterManager/UpdateParameter', $actualFuncCall); + $actualValue = $actualRequestObject->getParameter(); + $this->assertProtobufEquals($parameter, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateParameterExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $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 + $parameter = new Parameter(); + $request = (new UpdateParameterRequest())->setParameter($parameter); + try { + $gapicClient->updateParameter($request); + // If the $gapicClient 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 updateParameterVersionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $disabled = true; + $expectedResponse = new ParameterVersion(); + $expectedResponse->setName($name); + $expectedResponse->setDisabled($disabled); + $transport->addResponse($expectedResponse); + // Mock request + $parameterVersion = new ParameterVersion(); + $parameterVersionPayload = new ParameterVersionPayload(); + $payloadData = '88'; + $parameterVersionPayload->setData($payloadData); + $parameterVersion->setPayload($parameterVersionPayload); + $request = (new UpdateParameterVersionRequest())->setParameterVersion($parameterVersion); + $response = $gapicClient->updateParameterVersion($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.parametermanager.v1.ParameterManager/UpdateParameterVersion', $actualFuncCall); + $actualValue = $actualRequestObject->getParameterVersion(); + $this->assertProtobufEquals($parameterVersion, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateParameterVersionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $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 + $parameterVersion = new ParameterVersion(); + $parameterVersionPayload = new ParameterVersionPayload(); + $payloadData = '88'; + $parameterVersionPayload->setData($payloadData); + $parameterVersion->setPayload($parameterVersionPayload); + $request = (new UpdateParameterVersionRequest())->setParameterVersion($parameterVersion); + try { + $gapicClient->updateParameterVersion($request); + // If the $gapicClient 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $request = new GetLocationRequest(); + $response = $gapicClient->getLocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $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); + $request = new GetLocationRequest(); + try { + $gapicClient->getLocation($request); + // If the $gapicClient 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 listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [$locationsElement]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $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); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($request); + // If the $gapicClient 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 createParameterAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new Parameter(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $parameterId = 'parameterId-1536249487'; + $parameter = new Parameter(); + $request = (new CreateParameterRequest()) + ->setParent($formattedParent) + ->setParameterId($parameterId) + ->setParameter($parameter); + $response = $gapicClient->createParameterAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.parametermanager.v1.ParameterManager/CreateParameter', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getParameterId(); + $this->assertProtobufEquals($parameterId, $actualValue); + $actualValue = $actualRequestObject->getParameter(); + $this->assertProtobufEquals($parameter, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/composer.json b/composer.json index 3c7f792d23a5..4adaf369d32f 100644 --- a/composer.json +++ b/composer.json @@ -186,6 +186,7 @@ "google/cloud-osconfig": "2.0.2", "google/cloud-oslogin": "2.0.3", "google/cloud-parallelstore": "0.8.1", + "google/cloud-parametermanager": "0.0.0", "google/cloud-policy-troubleshooter": "2.0.3", "google/cloud-policysimulator": "1.0.2", "google/cloud-policytroubleshooter-iam": "0.2.8", @@ -386,6 +387,7 @@ "GPBMetadata\\Google\\Cloud\\Osconfig\\": "OsConfig/metadata", "GPBMetadata\\Google\\Cloud\\Oslogin\\": "OsLogin/metadata", "GPBMetadata\\Google\\Cloud\\Parallelstore\\": "Parallelstore/metadata", + "GPBMetadata\\Google\\Cloud\\Parametermanager\\": "ParameterManager/metadata", "GPBMetadata\\Google\\Cloud\\Policysimulator\\": "PolicySimulator/metadata", "GPBMetadata\\Google\\Cloud\\Policytroubleshooter\\": "PolicyTroubleshooter/metadata", "GPBMetadata\\Google\\Cloud\\Policytroubleshooter\\Iam\\": "PolicyTroubleshooterIam/metadata", @@ -619,6 +621,7 @@ "Google\\Cloud\\OsConfig\\": "OsConfig/src", "Google\\Cloud\\OsLogin\\": "OsLogin/src", "Google\\Cloud\\Parallelstore\\": "Parallelstore/src", + "Google\\Cloud\\ParameterManager\\": "ParameterManager/src", "Google\\Cloud\\PolicySimulator\\": "PolicySimulator/src", "Google\\Cloud\\PolicyTroubleshooter\\": "PolicyTroubleshooter/src", "Google\\Cloud\\PolicyTroubleshooter\\Iam\\": "PolicyTroubleshooterIam/src", From 62e3f20e0e1eb82f2069ff147e5c6d938f8e1d93 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 19 Dec 2024 23:31:21 +0000 Subject: [PATCH 2/8] feat: update common protos, fix owlbot --- CloudCommonProtos/.OwlBot.yaml | 8 +- CloudCommonProtos/owlbot.py | 6 +- CommonProtos/.OwlBot.yaml | 18 +++ CommonProtos/metadata/Api/Client.php | Bin 3578 -> 4004 bytes CommonProtos/metadata/Api/ErrorReason.php | Bin 1600 -> 1648 bytes CommonProtos/metadata/Api/Httpbody.php | 6 +- CommonProtos/metadata/Api/Metric.php | Bin 1808 -> 2077 bytes .../metadata/Google/Iam/V1/IamPolicy.php | 53 +++++++ .../Google/Iam/V1/Logging/AuditData.php | 30 ++++ .../metadata/Google/Iam/V1/Options.php | 29 ++++ .../metadata/Google/Iam/V1/Policy.php | Bin 0 -> 1757 bytes .../Google/Iam/V1/ResourcePolicyMember.php | 31 ++++ .../Google/Logging/Type/HttpRequest.php | 46 ++++++ .../Google/Logging/Type/LogSeverity.php | Bin 0 -> 948 bytes CommonProtos/metadata/Iam/V1/IamPolicy.php | 6 +- .../metadata/Iam/V1/ResourcePolicyMember.php | 31 ++++ .../metadata/Rpc/Context/AuditContext.php | 6 +- CommonProtos/metadata/Rpc/ErrorDetails.php | 10 +- CommonProtos/owlbot.py | 10 +- .../src/Api/CommonLanguageSettings.php | 44 ++++++ CommonProtos/src/Api/ErrorReason.php | 37 +++++ CommonProtos/src/Api/GoSettings.php | 58 +++++++ .../MetricDescriptorMetadata.php | 34 +++++ .../TimeSeriesResourceHierarchyLevel.php | 69 +++++++++ CommonProtos/src/Api/PythonSettings.php | 44 ++++++ .../PythonSettings/ExperimentalFeatures.php | 128 ++++++++++++++++ CommonProtos/src/Api/QuotaLimit.php | 16 +- .../src/Api/SelectiveGapicGeneration.php | 72 +++++++++ .../src/Cloud/Iam/V1/ResourcePolicyMember.php | 142 ++++++++++++++++++ .../src/Rpc/BadRequest/FieldViolation.php | 102 +++++++++++++ .../Rpc/Context/AttributeContext/Resource.php | 12 +- CommonProtos/src/Rpc/ErrorInfo.php | 28 ++-- 32 files changed, 1027 insertions(+), 49 deletions(-) create mode 100644 CommonProtos/.OwlBot.yaml create mode 100644 CommonProtos/metadata/Google/Iam/V1/IamPolicy.php create mode 100644 CommonProtos/metadata/Google/Iam/V1/Logging/AuditData.php create mode 100644 CommonProtos/metadata/Google/Iam/V1/Options.php create mode 100644 CommonProtos/metadata/Google/Iam/V1/Policy.php create mode 100644 CommonProtos/metadata/Google/Iam/V1/ResourcePolicyMember.php create mode 100644 CommonProtos/metadata/Google/Logging/Type/HttpRequest.php create mode 100644 CommonProtos/metadata/Google/Logging/Type/LogSeverity.php create mode 100644 CommonProtos/metadata/Iam/V1/ResourcePolicyMember.php create mode 100644 CommonProtos/src/Api/MetricDescriptor/MetricDescriptorMetadata/TimeSeriesResourceHierarchyLevel.php create mode 100644 CommonProtos/src/Api/PythonSettings/ExperimentalFeatures.php create mode 100644 CommonProtos/src/Api/SelectiveGapicGeneration.php create mode 100644 CommonProtos/src/Cloud/Iam/V1/ResourcePolicyMember.php diff --git a/CloudCommonProtos/.OwlBot.yaml b/CloudCommonProtos/.OwlBot.yaml index 00681357cc4f..148c73a813e4 100644 --- a/CloudCommonProtos/.OwlBot.yaml +++ b/CloudCommonProtos/.OwlBot.yaml @@ -1,8 +1,8 @@ deep-copy-regex: - source: /google/cloud/audit/.*-php/(.*) - dest: /owl-bot-staging/CommonProtos/audit-protos/$1 + dest: /owl-bot-staging/CloudCommonProtos/audit-protos/$1 - source: /google/devtools/source/v1/.*-php/(.*) - dest: /owl-bot-staging/CommonProtos/devtools-protos/$1 + dest: /owl-bot-staging/CloudCommonProtos/devtools-protos/$1 - source: /google/cloud/common/.*-php/(.*) - dest: /owl-bot-staging/CommonProtos/common-protos/$1 -api-name: CommonProtos + dest: /owl-bot-staging/CloudCommonProtos/common-protos/$1 +api-name: CloudCommonProtos diff --git a/CloudCommonProtos/owlbot.py b/CloudCommonProtos/owlbot.py index b0a984978ffb..a918d8a318bd 100644 --- a/CloudCommonProtos/owlbot.py +++ b/CloudCommonProtos/owlbot.py @@ -25,9 +25,9 @@ logging.basicConfig(level=logging.DEBUG) -audit_src = Path(f"../{php.STAGING_DIR}/CommonProtos/audit-protos").resolve() -devtools_src = Path(f"../{php.STAGING_DIR}/CommonProtos/devtools-protos").resolve() -common_src = Path(f"../{php.STAGING_DIR}/CommonProtos/common-protos").resolve() +audit_src = Path(f"../{php.STAGING_DIR}/CloudCommonProtos/audit-protos").resolve() +devtools_src = Path(f"../{php.STAGING_DIR}/CloudCommonProtos/devtools-protos").resolve() +common_src = Path(f"../{php.STAGING_DIR}/CloudCommonProtos/common-protos").resolve() dest = Path().resolve() # Added so that we can pass copy_excludes in the owlbot_main() call diff --git a/CommonProtos/.OwlBot.yaml b/CommonProtos/.OwlBot.yaml new file mode 100644 index 000000000000..6f27837b47c8 --- /dev/null +++ b/CommonProtos/.OwlBot.yaml @@ -0,0 +1,18 @@ +deep-copy-regex: +- source: /google/api/google-api-php/(.*) + dest: /owl-bot-staging/CommonProtos/api/$1 +- source: /google/cloud/extended-operations-php/(.*) + dest: /owl-bot-staging/CommonProtos/extendedoperations/$1 +- source: /google/cloud/location/.*-php/(.*) + dest: /owl-bot-staging/CommonProtos/location/$1 +- source: /google/iam/v1/.*-php/(.*) + dest: /owl-bot-staging/CommonProtos/iam/$1 +- source: /google/iam/v1/logging/.*-php/(.*) + dest: /owl-bot-staging/CommonProtos/iamlogging/$1 +- source: /google/logging/type/.*-php/(.*) + dest: /owl-bot-staging/CommonProtos/logging/$1 +- source: /google/rpc/.*-php/(.*) + dest: /owl-bot-staging/CommonProtos/rpc/$1 +- source: /google/type/.*-php/(.*) + dest: /owl-bot-staging/CommonProtos/type/$1 +api-name: CommonProtos diff --git a/CommonProtos/metadata/Api/Client.php b/CommonProtos/metadata/Api/Client.php index 8ff39b070e33c055c936c2c8184adba0882c3a88..1fdb799b541f6fcd25657c8f851293ab5d9566d6 100644 GIT binary patch delta 436 zcmZvYu}Z^G6oyGsHN6&$O{O% z2o6GaeG_qYcXIMJR_W07oR9zf=liZaR$rQ;_^hP|V!!YzptbZ}UQaXe(ooKj7DE6I z^GAR^JMtauK?u}lJ_%K6OQ{s2N|2e=0|8&Zf>F%NB~dO^F>jVa`GLTJ}$b=F+jL}ebpupK9%gMES_ zw7UVgs=y;<;rX#R;_{58M<<{$}(CQ Z0Jr7FyuDN}?mY--BQ4Eq*+uC|_yLGujw1j7 delta 71 zcmV-N0J#68ANm`xF9HIC7n3mpXajT#7L%U{7n8ICTeDdM76k!BlW_<{2qHoX3{G!k dWs~m*J+rF`@c{uqlb#Devt0~Q0khl<$N>tf7KZ=; diff --git a/CommonProtos/metadata/Api/ErrorReason.php b/CommonProtos/metadata/Api/ErrorReason.php index 22bd2d622dd00cd4f3ef0782aeeba92025359246..49f233ae3ca1264ba1b77b969a11d8c0d6defe32 100644 GIT binary patch delta 79 zcmX@W^MPl>F-De099*&!y=5mqXXItvwfQS!53_-g5Eq}XXK=8mpL@K2kf*z+pMau} j6qlHPm}`)azoUz*OT2TCtBb2&h^M1Zuz=F!M%MiR+z%IT delta 30 mcmeysbAV^VF-De699*&!y=5mqXXIt<+WeKVhk5cw*8KplI16zA diff --git a/CommonProtos/metadata/Api/Httpbody.php b/CommonProtos/metadata/Api/Httpbody.php index 382fd83a67ad..88417c291d61 100644 --- a/CommonProtos/metadata/Api/Httpbody.php +++ b/CommonProtos/metadata/Api/Httpbody.php @@ -17,15 +17,15 @@ public static function initOnce() { \GPBMetadata\Google\Protobuf\Any::initOnce(); $pool->internalAddGeneratedFile( ' - + google/api/httpbody.proto google.api"X HttpBody content_type (  data ( ( -extensions ( 2.google.protobuf.AnyBh -com.google.apiB HttpBodyProtoPZ;google.golang.org/genproto/googleapis/api/httpbody;httpbodyGAPIbproto3' +extensions ( 2.google.protobuf.AnyBe +com.google.apiB HttpBodyProtoPZ;google.golang.org/genproto/googleapis/api/httpbody;httpbodyGAPIbproto3' , true); static::$is_initialized = true; diff --git a/CommonProtos/metadata/Api/Metric.php b/CommonProtos/metadata/Api/Metric.php index 7a348b03f163229785d3f9abe8d7ffc1b33920af..93c38242c59cb1ad775770f371e44b9df1c94bbb 100644 GIT binary patch delta 263 zcmbQhH& z_kbz)0jXAMX5>;Jq)5nw%OJ$l*EK%aHOSL7I6lZV*grJL*)`t7(>2I3$k`(@-p4h} z)h9mGFF3%}+0)I_)kT0oh?`4;Js`;6%hfqVfKf<*i^o66-OMHO R&ELnxHAsMYvpVZbMgVbcQUL$} delta 40 ycmV+@0N4MW5ReYAVgdr@2$N(2WdffDv&#ai0R*rC3K)|M1R0Z(1eLQi2I&C^RSc&9 diff --git a/CommonProtos/metadata/Google/Iam/V1/IamPolicy.php b/CommonProtos/metadata/Google/Iam/V1/IamPolicy.php new file mode 100644 index 000000000000..05b9b12748ab --- /dev/null +++ b/CommonProtos/metadata/Google/Iam/V1/IamPolicy.php @@ -0,0 +1,53 @@ +internalAddGeneratedFile( + ' + +google/iam/v1/iam_policy.proto google.iam.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.protogoogle/iam/v1/options.protogoogle/iam/v1/policy.proto google/protobuf/field_mask.proto" +SetIamPolicyRequest +resource ( B AA +** +policy ( 2.google.iam.v1.PolicyBA/ + update_mask ( 2.google.protobuf.FieldMask"d +GetIamPolicyRequest +resource ( B AA +*0 +options ( 2.google.iam.v1.GetPolicyOptions"R +TestIamPermissionsRequest +resource ( B AA +* + permissions ( BA"1 +TestIamPermissionsResponse + permissions ( 2 + IAMPolicyt + SetIamPolicy".google.iam.v1.SetIamPolicyRequest.google.iam.v1.Policy")#"/v1/{resource=**}:setIamPolicy:*t + GetIamPolicy".google.iam.v1.GetIamPolicyRequest.google.iam.v1.Policy")#"/v1/{resource=**}:getIamPolicy:* +TestIamPermissions(.google.iam.v1.TestIamPermissionsRequest).google.iam.v1.TestIamPermissionsResponse"/)"$/v1/{resource=**}:testIamPermissions:*Aiam-meta-api.googleapis.comB| +com.google.iam.v1BIamPolicyProtoPZ)cloud.google.com/go/iam/apiv1/iampb;iampbGoogle.Cloud.Iam.V1Google\\Cloud\\Iam\\V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/CommonProtos/metadata/Google/Iam/V1/Logging/AuditData.php b/CommonProtos/metadata/Google/Iam/V1/Logging/AuditData.php new file mode 100644 index 000000000000..3dcb651dbc4b --- /dev/null +++ b/CommonProtos/metadata/Google/Iam/V1/Logging/AuditData.php @@ -0,0 +1,30 @@ +internalAddGeneratedFile( + ' + +&google/iam/v1/logging/audit_data.protogoogle.iam.v1.logging"= + AuditData0 + policy_delta ( 2.google.iam.v1.PolicyDeltaB +com.google.iam.v1.loggingBAuditDataProtoPZ9cloud.google.com/go/iam/apiv1/logging/loggingpb;loggingpbGoogle.Cloud.Iam.V1.Loggingbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/CommonProtos/metadata/Google/Iam/V1/Options.php b/CommonProtos/metadata/Google/Iam/V1/Options.php new file mode 100644 index 000000000000..630ae5b65ee4 --- /dev/null +++ b/CommonProtos/metadata/Google/Iam/V1/Options.php @@ -0,0 +1,29 @@ +internalAddGeneratedFile( + ' + +google/iam/v1/options.proto google.iam.v1"4 +GetPolicyOptions +requested_policy_version (B} +com.google.iam.v1B OptionsProtoPZ)cloud.google.com/go/iam/apiv1/iampb;iampbGoogle.Cloud.Iam.V1Google\\Cloud\\Iam\\V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/CommonProtos/metadata/Google/Iam/V1/Policy.php b/CommonProtos/metadata/Google/Iam/V1/Policy.php new file mode 100644 index 0000000000000000000000000000000000000000..ed5ae8178e3ce96fe8fda137efadc1b714c283ad GIT binary patch literal 1757 zcmbVNU2o$=6va(RH#coJ^`a$OgcwX=QwdxpD?XHNL2jL`ENzphWV?VYMUFGcj^ubO zds1zIN<8pCc;^rB#2?@n@yMN-I8D5i2l9}_<8#kF=ickz|xc5sU*7_-87@_kx*!**pRWqae#jUq!-CK=6~yN614m z5eWR*XW5X&Ot2tgKcd!SG6|xLV(6RL$vh4P<1vu|y*Q+e1EM)4c0b|h?U>{m`qD01 z^}SfoG!7!)rCFG=MDVna&~|%D#j;59q;arFE9uyTG_=Nc`wfxDM5J@Nnw^l8ig_9z zDczFbX8F(mmkJH86Y6(fCuzHV>*h9CnfdH%wvg_O$4jNpuxE`Wx6JeyeyhNvyPIY1 z=zBIc(!Oe1zZy{1Eiv!I))h@NENa~#M&oU>0ry5M9VXAGb3tKrC-bi^wm4=EGHKVf;>Z)%b zXT{uy3MN4wsZ$15TYGsLfrYeXA+7JAx|$4GGMZkoFsJ9c&hSO|+kWTNd**fA+FRx>fa9Kf-Qh*YachRWcAbGUe0kvwI<*aR2P*1X-7Zw`k1s*|ppinjhV zV0(?O1?50J$BV*Q1%_3y?I@(295o;t*!&8bF6+{%VJOVU=3VpgIg}S{55aU!2VSpR zDDD=N99LEqpnTCe?_FX=rT$vcl=(%$!zTp~#em$$%1~-6@524UI4nHXRt8L3s#yO| z|H;p=hns#~-^pSq)Q;>MKOBS+pO144!Vjlht^FWjxcTv^NJdBM`)|YeedB>%^Y*EV v@^GtMHvh^`eP12>>Lq}0fl*n#F`hhL?yOJs_FP%EcP?6m)NAnuZUFuP&9ek- literal 0 HcmV?d00001 diff --git a/CommonProtos/metadata/Google/Iam/V1/ResourcePolicyMember.php b/CommonProtos/metadata/Google/Iam/V1/ResourcePolicyMember.php new file mode 100644 index 000000000000..aa0d5616de62 --- /dev/null +++ b/CommonProtos/metadata/Google/Iam/V1/ResourcePolicyMember.php @@ -0,0 +1,31 @@ +internalAddGeneratedFile( + ' + +*google/iam/v1/resource_policy_member.proto google.iam.v1"e +ResourcePolicyMember& +iam_policy_name_principal ( BA% +iam_policy_uid_principal ( BAB +com.google.iam.v1BResourcePolicyMemberProtoPZ)cloud.google.com/go/iam/apiv1/iampb;iampbGoogle.Cloud.Iam.V1Google\\Cloud\\Iam\\V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/CommonProtos/metadata/Google/Logging/Type/HttpRequest.php b/CommonProtos/metadata/Google/Logging/Type/HttpRequest.php new file mode 100644 index 000000000000..3c51368ee2a3 --- /dev/null +++ b/CommonProtos/metadata/Google/Logging/Type/HttpRequest.php @@ -0,0 +1,46 @@ +internalAddGeneratedFile( + ' + +&google/logging/type/http_request.protogoogle.logging.type" + HttpRequest +request_method (  + request_url (  + request_size ( +status ( + response_size ( + +user_agent (  + remote_ip (  + server_ip (  +referer ( * +latency ( 2.google.protobuf.Duration + cache_lookup ( + cache_hit (* +"cache_validated_with_origin_server + ( +cache_fill_bytes ( +protocol ( B +com.google.logging.typeBHttpRequestProtoPZ8google.golang.org/genproto/googleapis/logging/type;ltypeGoogle.Cloud.Logging.TypeGoogle\\Cloud\\Logging\\TypeGoogle::Cloud::Logging::Typebproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/CommonProtos/metadata/Google/Logging/Type/LogSeverity.php b/CommonProtos/metadata/Google/Logging/Type/LogSeverity.php new file mode 100644 index 0000000000000000000000000000000000000000..6acaa6953afd9c7c064b5952b940a1f6b109bc51 GIT binary patch literal 948 zcma)4-HOvd7`4Ca&Z>lXA%YhpE^b#ez3@g-tMn%gfo@Y`7f}MsG?``xvY9ZM2vvIH z6NpbBUW$+4tsp*u&)~HW;LIc&Dyv{_lFWC`_nrC9dHggzO~D;#;{-FraR`@d$WJj$ z8RayfFGawwhaON(cHFg%a1vR5N3$O_zN~0KeV;V&yiMo89s-Ke# zzru|0wV_%9kf1Z1r6|DAo)3>OMIi*@Gvf)G-LdYV1V#(y4%wb^zWtz}^2dM896(jM6wm8h7t)4eV{LUEc#c zV{0-vo-VXY`YvdVt>Lk)h2pd6%qFh(ttKFC5esKzX`k!*6|nPs;LV(wt-WjL0JJR6 zb3N@>L%#|xk32`<22<@vQinternalAddGeneratedFile( ' - + google/iam/v1/iam_policy.proto google.iam.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.protogoogle/iam/v1/options.protogoogle/iam/v1/policy.proto google/protobuf/field_mask.proto" SetIamPolicyRequest resource ( B AA @@ -43,8 +43,8 @@ public static function initOnce() { IAMPolicyt SetIamPolicy".google.iam.v1.SetIamPolicyRequest.google.iam.v1.Policy")#"/v1/{resource=**}:setIamPolicy:*t GetIamPolicy".google.iam.v1.GetIamPolicyRequest.google.iam.v1.Policy")#"/v1/{resource=**}:getIamPolicy:* -TestIamPermissions(.google.iam.v1.TestIamPermissionsRequest).google.iam.v1.TestIamPermissionsResponse"/)"$/v1/{resource=**}:testIamPermissions:*Aiam-meta-api.googleapis.comB -com.google.iam.v1BIamPolicyProtoPZ)cloud.google.com/go/iam/apiv1/iampb;iampbGoogle.Cloud.Iam.V1Google\\Cloud\\Iam\\V1bproto3' +TestIamPermissions(.google.iam.v1.TestIamPermissionsRequest).google.iam.v1.TestIamPermissionsResponse"/)"$/v1/{resource=**}:testIamPermissions:*Aiam-meta-api.googleapis.comB| +com.google.iam.v1BIamPolicyProtoPZ)cloud.google.com/go/iam/apiv1/iampb;iampbGoogle.Cloud.Iam.V1Google\\Cloud\\Iam\\V1bproto3' , true); static::$is_initialized = true; diff --git a/CommonProtos/metadata/Iam/V1/ResourcePolicyMember.php b/CommonProtos/metadata/Iam/V1/ResourcePolicyMember.php new file mode 100644 index 000000000000..aa0d5616de62 --- /dev/null +++ b/CommonProtos/metadata/Iam/V1/ResourcePolicyMember.php @@ -0,0 +1,31 @@ +internalAddGeneratedFile( + ' + +*google/iam/v1/resource_policy_member.proto google.iam.v1"e +ResourcePolicyMember& +iam_policy_name_principal ( BA% +iam_policy_uid_principal ( BAB +com.google.iam.v1BResourcePolicyMemberProtoPZ)cloud.google.com/go/iam/apiv1/iampb;iampbGoogle.Cloud.Iam.V1Google\\Cloud\\Iam\\V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/CommonProtos/metadata/Rpc/Context/AuditContext.php b/CommonProtos/metadata/Rpc/Context/AuditContext.php index 40b9c064232c..085e04b2fe33 100644 --- a/CommonProtos/metadata/Rpc/Context/AuditContext.php +++ b/CommonProtos/metadata/Rpc/Context/AuditContext.php @@ -17,15 +17,15 @@ public static function initOnce() { \GPBMetadata\Google\Protobuf\Struct::initOnce(); $pool->internalAddGeneratedFile( ' - + &google/rpc/context/audit_context.protogoogle.rpc.context" AuditContext audit_log ( 1 scrubbed_request ( 2.google.protobuf.Struct2 scrubbed_response ( 2.google.protobuf.Struct$ scrubbed_response_item_count ( -target_resource ( Bk -com.google.rpc.contextBAuditContextProtoPZ9google.golang.org/genproto/googleapis/rpc/context;contextbproto3' +target_resource ( Bh +com.google.rpc.contextBAuditContextProtoPZ9google.golang.org/genproto/googleapis/rpc/context;contextbproto3' , true); static::$is_initialized = true; diff --git a/CommonProtos/metadata/Rpc/ErrorDetails.php b/CommonProtos/metadata/Rpc/ErrorDetails.php index 37c002f1841a..5e54e44152b9 100644 --- a/CommonProtos/metadata/Rpc/ErrorDetails.php +++ b/CommonProtos/metadata/Rpc/ErrorDetails.php @@ -17,7 +17,7 @@ public static function initOnce() { \GPBMetadata\Google\Protobuf\Duration::initOnce(); $pool->internalAddGeneratedFile( ' - + google/rpc/error_details.proto google.rpc" ErrorInfo @@ -44,13 +44,15 @@ public static function initOnce() { Violation type (  subject (  - description ( " + description ( " BadRequest? -field_violations ( 2%.google.rpc.BadRequest.FieldViolation4 +field_violations ( 2%.google.rpc.BadRequest.FieldViolation} FieldViolation field (  - description ( "7 + description (  +reason ( 7 +localized_message ( 2.google.rpc.LocalizedMessage"7 RequestInfo request_id (  diff --git a/CommonProtos/owlbot.py b/CommonProtos/owlbot.py index 67cd532b6a28..d8547d27562c 100644 --- a/CommonProtos/owlbot.py +++ b/CommonProtos/owlbot.py @@ -42,7 +42,7 @@ dest = Path().resolve() for proto in protos: - src = Path(f"{php.STAGING_DIR}/{proto[0]}").resolve() + src = Path(f"../{php.STAGING_DIR}/CommonProtos/{proto[0]}").resolve() # Added so that we can pass copy_excludes in the owlbot_main() call _tracked_paths.add(src) @@ -63,12 +63,12 @@ s.move("metadata/Google/Logging/Type", "metadata/Logging/Type") # remove owl-bot-staging dir -if os.path.exists(php.STAGING_DIR): - shutil.rmtree(Path(php.STAGING_DIR)) +#if os.path.exists(php.STAGING_DIR): +# shutil.rmtree(Path(php.STAGING_DIR)) # remove the metadata/Google files that we copied -if os.path.exists("metadata/Google"): - shutil.rmtree(Path("metadata/Google")) +#if os.path.exists("metadata/Google"): +# shutil.rmtree(Path("metadata/Google")) s.replace( "src/**/*.php", diff --git a/CommonProtos/src/Api/CommonLanguageSettings.php b/CommonProtos/src/Api/CommonLanguageSettings.php index f5b09853b7b7..0315433394c5 100644 --- a/CommonProtos/src/Api/CommonLanguageSettings.php +++ b/CommonProtos/src/Api/CommonLanguageSettings.php @@ -29,6 +29,12 @@ class CommonLanguageSettings extends \Google\Protobuf\Internal\Message * Generated from protobuf field repeated .google.api.ClientLibraryDestination destinations = 2; */ private $destinations; + /** + * Configuration for which RPCs should be generated in the GAPIC client. + * + * Generated from protobuf field .google.api.SelectiveGapicGeneration selective_gapic_generation = 3; + */ + protected $selective_gapic_generation = null; /** * Constructor. @@ -41,6 +47,8 @@ class CommonLanguageSettings extends \Google\Protobuf\Internal\Message * https://cloud.google.com/nodejs/docs/reference/asset/latest * @type array|\Google\Protobuf\Internal\RepeatedField $destinations * The destination where API teams want this client library to be published. + * @type \Google\Api\SelectiveGapicGeneration $selective_gapic_generation + * Configuration for which RPCs should be generated in the GAPIC client. * } */ public function __construct($data = NULL) { @@ -106,5 +114,41 @@ public function setDestinations($var) return $this; } + /** + * Configuration for which RPCs should be generated in the GAPIC client. + * + * Generated from protobuf field .google.api.SelectiveGapicGeneration selective_gapic_generation = 3; + * @return \Google\Api\SelectiveGapicGeneration|null + */ + public function getSelectiveGapicGeneration() + { + return $this->selective_gapic_generation; + } + + public function hasSelectiveGapicGeneration() + { + return isset($this->selective_gapic_generation); + } + + public function clearSelectiveGapicGeneration() + { + unset($this->selective_gapic_generation); + } + + /** + * Configuration for which RPCs should be generated in the GAPIC client. + * + * Generated from protobuf field .google.api.SelectiveGapicGeneration selective_gapic_generation = 3; + * @param \Google\Api\SelectiveGapicGeneration $var + * @return $this + */ + public function setSelectiveGapicGeneration($var) + { + GPBUtil::checkMessage($var, \Google\Api\SelectiveGapicGeneration::class); + $this->selective_gapic_generation = $var; + + return $this; + } + } diff --git a/CommonProtos/src/Api/ErrorReason.php b/CommonProtos/src/Api/ErrorReason.php index b582e3633146..04641c2202f9 100644 --- a/CommonProtos/src/Api/ErrorReason.php +++ b/CommonProtos/src/Api/ErrorReason.php @@ -595,6 +595,41 @@ class ErrorReason * Generated from protobuf enum LOCATION_POLICY_VIOLATED = 31; */ const LOCATION_POLICY_VIOLATED = 31; + /** + * The request is denied because origin request header is missing. + * Example of an ErrorInfo when + * accessing "pubsub.googleapis.com" service with an empty "Origin" request + * header. + * { + * reason: "MISSING_ORIGIN" + * domain: "googleapis.com" + * metadata { + * "consumer":"projects/123456" + * "service": "pubsub.googleapis.com" + * } + * } + * + * Generated from protobuf enum MISSING_ORIGIN = 33; + */ + const MISSING_ORIGIN = 33; + /** + * The request is denied because the request contains more than one credential + * type that are individually acceptable, but not together. The customer + * should retry their request with only one set of credentials. + * Example of an ErrorInfo when + * accessing "pubsub.googleapis.com" service with overloaded credentials. + * { + * reason: "OVERLOADED_CREDENTIALS" + * domain: "googleapis.com" + * metadata { + * "consumer":"projects/123456" + * "service": "pubsub.googleapis.com" + * } + * } + * + * Generated from protobuf enum OVERLOADED_CREDENTIALS = 34; + */ + const OVERLOADED_CREDENTIALS = 34; private static $valueToName = [ self::ERROR_REASON_UNSPECIFIED => 'ERROR_REASON_UNSPECIFIED', @@ -628,6 +663,8 @@ class ErrorReason self::SERVICE_NOT_VISIBLE => 'SERVICE_NOT_VISIBLE', self::GCP_SUSPENDED => 'GCP_SUSPENDED', self::LOCATION_POLICY_VIOLATED => 'LOCATION_POLICY_VIOLATED', + self::MISSING_ORIGIN => 'MISSING_ORIGIN', + self::OVERLOADED_CREDENTIALS => 'OVERLOADED_CREDENTIALS', ]; public static function name($value) diff --git a/CommonProtos/src/Api/GoSettings.php b/CommonProtos/src/Api/GoSettings.php index 10817e88515f..f70db3cdc852 100644 --- a/CommonProtos/src/Api/GoSettings.php +++ b/CommonProtos/src/Api/GoSettings.php @@ -21,6 +21,18 @@ class GoSettings extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.api.CommonLanguageSettings common = 1; */ protected $common = null; + /** + * Map of service names to renamed services. Keys are the package relative + * service names and values are the name to be used for the service client + * and call options. + * publishing: + * go_settings: + * renamed_services: + * Publisher: TopicAdmin + * + * Generated from protobuf field map renamed_services = 2; + */ + private $renamed_services; /** * Constructor. @@ -30,6 +42,14 @@ class GoSettings extends \Google\Protobuf\Internal\Message * * @type \Google\Api\CommonLanguageSettings $common * Some settings. + * @type array|\Google\Protobuf\Internal\MapField $renamed_services + * Map of service names to renamed services. Keys are the package relative + * service names and values are the name to be used for the service client + * and call options. + * publishing: + * go_settings: + * renamed_services: + * Publisher: TopicAdmin * } */ public function __construct($data = NULL) { @@ -73,5 +93,43 @@ public function setCommon($var) return $this; } + /** + * Map of service names to renamed services. Keys are the package relative + * service names and values are the name to be used for the service client + * and call options. + * publishing: + * go_settings: + * renamed_services: + * Publisher: TopicAdmin + * + * Generated from protobuf field map renamed_services = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getRenamedServices() + { + return $this->renamed_services; + } + + /** + * Map of service names to renamed services. Keys are the package relative + * service names and values are the name to be used for the service client + * and call options. + * publishing: + * go_settings: + * renamed_services: + * Publisher: TopicAdmin + * + * Generated from protobuf field map renamed_services = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setRenamedServices($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->renamed_services = $arr; + + return $this; + } + } diff --git a/CommonProtos/src/Api/MetricDescriptor/MetricDescriptorMetadata.php b/CommonProtos/src/Api/MetricDescriptor/MetricDescriptorMetadata.php index e1fe49d02f9e..059452b95e8a 100644 --- a/CommonProtos/src/Api/MetricDescriptor/MetricDescriptorMetadata.php +++ b/CommonProtos/src/Api/MetricDescriptor/MetricDescriptorMetadata.php @@ -41,6 +41,12 @@ class MetricDescriptorMetadata extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.protobuf.Duration ingest_delay = 3; */ protected $ingest_delay = null; + /** + * The scope of the timeseries data of the metric. + * + * Generated from protobuf field repeated .google.api.MetricDescriptor.MetricDescriptorMetadata.TimeSeriesResourceHierarchyLevel time_series_resource_hierarchy_level = 4; + */ + private $time_series_resource_hierarchy_level; /** * Constructor. @@ -61,6 +67,8 @@ class MetricDescriptorMetadata extends \Google\Protobuf\Internal\Message * The delay of data points caused by ingestion. Data points older than this * age are guaranteed to be ingested and available to be read, excluding * data loss due to errors. + * @type array|\Google\Protobuf\Internal\RepeatedField $time_series_resource_hierarchy_level + * The scope of the timeseries data of the metric. * } */ public function __construct($data = NULL) { @@ -184,6 +192,32 @@ public function setIngestDelay($var) return $this; } + /** + * The scope of the timeseries data of the metric. + * + * Generated from protobuf field repeated .google.api.MetricDescriptor.MetricDescriptorMetadata.TimeSeriesResourceHierarchyLevel time_series_resource_hierarchy_level = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTimeSeriesResourceHierarchyLevel() + { + return $this->time_series_resource_hierarchy_level; + } + + /** + * The scope of the timeseries data of the metric. + * + * Generated from protobuf field repeated .google.api.MetricDescriptor.MetricDescriptorMetadata.TimeSeriesResourceHierarchyLevel time_series_resource_hierarchy_level = 4; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTimeSeriesResourceHierarchyLevel($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Api\MetricDescriptor\MetricDescriptorMetadata\TimeSeriesResourceHierarchyLevel::class); + $this->time_series_resource_hierarchy_level = $arr; + + return $this; + } + } diff --git a/CommonProtos/src/Api/MetricDescriptor/MetricDescriptorMetadata/TimeSeriesResourceHierarchyLevel.php b/CommonProtos/src/Api/MetricDescriptor/MetricDescriptorMetadata/TimeSeriesResourceHierarchyLevel.php new file mode 100644 index 000000000000..c621598dd63f --- /dev/null +++ b/CommonProtos/src/Api/MetricDescriptor/MetricDescriptorMetadata/TimeSeriesResourceHierarchyLevel.php @@ -0,0 +1,69 @@ +google.api.MetricDescriptor.MetricDescriptorMetadata.TimeSeriesResourceHierarchyLevel + */ +class TimeSeriesResourceHierarchyLevel +{ + /** + * Do not use this default value. + * + * Generated from protobuf enum TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED = 0; + */ + const TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED = 0; + /** + * Scopes a metric to a project. + * + * Generated from protobuf enum PROJECT = 1; + */ + const PROJECT = 1; + /** + * Scopes a metric to an organization. + * + * Generated from protobuf enum ORGANIZATION = 2; + */ + const ORGANIZATION = 2; + /** + * Scopes a metric to a folder. + * + * Generated from protobuf enum FOLDER = 3; + */ + const FOLDER = 3; + + private static $valueToName = [ + self::TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED => 'TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED', + self::PROJECT => 'PROJECT', + self::ORGANIZATION => 'ORGANIZATION', + self::FOLDER => 'FOLDER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/CommonProtos/src/Api/PythonSettings.php b/CommonProtos/src/Api/PythonSettings.php index a86a02261b25..e502c74503bd 100644 --- a/CommonProtos/src/Api/PythonSettings.php +++ b/CommonProtos/src/Api/PythonSettings.php @@ -21,6 +21,12 @@ class PythonSettings extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.api.CommonLanguageSettings common = 1; */ protected $common = null; + /** + * Experimental features to be included during client library generation. + * + * Generated from protobuf field .google.api.PythonSettings.ExperimentalFeatures experimental_features = 2; + */ + protected $experimental_features = null; /** * Constructor. @@ -30,6 +36,8 @@ class PythonSettings extends \Google\Protobuf\Internal\Message * * @type \Google\Api\CommonLanguageSettings $common * Some settings. + * @type \Google\Api\PythonSettings\ExperimentalFeatures $experimental_features + * Experimental features to be included during client library generation. * } */ public function __construct($data = NULL) { @@ -73,5 +81,41 @@ public function setCommon($var) return $this; } + /** + * Experimental features to be included during client library generation. + * + * Generated from protobuf field .google.api.PythonSettings.ExperimentalFeatures experimental_features = 2; + * @return \Google\Api\PythonSettings\ExperimentalFeatures|null + */ + public function getExperimentalFeatures() + { + return $this->experimental_features; + } + + public function hasExperimentalFeatures() + { + return isset($this->experimental_features); + } + + public function clearExperimentalFeatures() + { + unset($this->experimental_features); + } + + /** + * Experimental features to be included during client library generation. + * + * Generated from protobuf field .google.api.PythonSettings.ExperimentalFeatures experimental_features = 2; + * @param \Google\Api\PythonSettings\ExperimentalFeatures $var + * @return $this + */ + public function setExperimentalFeatures($var) + { + GPBUtil::checkMessage($var, \Google\Api\PythonSettings\ExperimentalFeatures::class); + $this->experimental_features = $var; + + return $this; + } + } diff --git a/CommonProtos/src/Api/PythonSettings/ExperimentalFeatures.php b/CommonProtos/src/Api/PythonSettings/ExperimentalFeatures.php new file mode 100644 index 000000000000..2f271e756afb --- /dev/null +++ b/CommonProtos/src/Api/PythonSettings/ExperimentalFeatures.php @@ -0,0 +1,128 @@ +google.api.PythonSettings.ExperimentalFeatures + */ +class ExperimentalFeatures extends \Google\Protobuf\Internal\Message +{ + /** + * Enables generation of asynchronous REST clients if `rest` transport is + * enabled. By default, asynchronous REST clients will not be generated. + * This feature will be enabled by default 1 month after launching the + * feature in preview packages. + * + * Generated from protobuf field bool rest_async_io_enabled = 1; + */ + protected $rest_async_io_enabled = false; + /** + * Enables generation of protobuf code using new types that are more + * Pythonic which are included in `protobuf>=5.29.x`. This feature will be + * enabled by default 1 month after launching the feature in preview + * packages. + * + * Generated from protobuf field bool protobuf_pythonic_types_enabled = 2; + */ + protected $protobuf_pythonic_types_enabled = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $rest_async_io_enabled + * Enables generation of asynchronous REST clients if `rest` transport is + * enabled. By default, asynchronous REST clients will not be generated. + * This feature will be enabled by default 1 month after launching the + * feature in preview packages. + * @type bool $protobuf_pythonic_types_enabled + * Enables generation of protobuf code using new types that are more + * Pythonic which are included in `protobuf>=5.29.x`. This feature will be + * enabled by default 1 month after launching the feature in preview + * packages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Client::initOnce(); + parent::__construct($data); + } + + /** + * Enables generation of asynchronous REST clients if `rest` transport is + * enabled. By default, asynchronous REST clients will not be generated. + * This feature will be enabled by default 1 month after launching the + * feature in preview packages. + * + * Generated from protobuf field bool rest_async_io_enabled = 1; + * @return bool + */ + public function getRestAsyncIoEnabled() + { + return $this->rest_async_io_enabled; + } + + /** + * Enables generation of asynchronous REST clients if `rest` transport is + * enabled. By default, asynchronous REST clients will not be generated. + * This feature will be enabled by default 1 month after launching the + * feature in preview packages. + * + * Generated from protobuf field bool rest_async_io_enabled = 1; + * @param bool $var + * @return $this + */ + public function setRestAsyncIoEnabled($var) + { + GPBUtil::checkBool($var); + $this->rest_async_io_enabled = $var; + + return $this; + } + + /** + * Enables generation of protobuf code using new types that are more + * Pythonic which are included in `protobuf>=5.29.x`. This feature will be + * enabled by default 1 month after launching the feature in preview + * packages. + * + * Generated from protobuf field bool protobuf_pythonic_types_enabled = 2; + * @return bool + */ + public function getProtobufPythonicTypesEnabled() + { + return $this->protobuf_pythonic_types_enabled; + } + + /** + * Enables generation of protobuf code using new types that are more + * Pythonic which are included in `protobuf>=5.29.x`. This feature will be + * enabled by default 1 month after launching the feature in preview + * packages. + * + * Generated from protobuf field bool protobuf_pythonic_types_enabled = 2; + * @param bool $var + * @return $this + */ + public function setProtobufPythonicTypesEnabled($var) + { + GPBUtil::checkBool($var); + $this->protobuf_pythonic_types_enabled = $var; + + return $this; + } + +} + + diff --git a/CommonProtos/src/Api/QuotaLimit.php b/CommonProtos/src/Api/QuotaLimit.php index f34ffb4b0f1c..977cd0156439 100644 --- a/CommonProtos/src/Api/QuotaLimit.php +++ b/CommonProtos/src/Api/QuotaLimit.php @@ -88,8 +88,8 @@ class QuotaLimit extends \Google\Protobuf\Internal\Message protected $metric = ''; /** * Specify the unit of the quota limit. It uses the same syntax as - * [Metric.unit][]. The supported unit kinds are determined by the quota - * backend system. + * [MetricDescriptor.unit][google.api.MetricDescriptor.unit]. The supported + * unit kinds are determined by the quota backend system. * Here are some examples: * * "1/min/{project}" for quota per minute per project. * Note: the order of unit components is insignificant. @@ -165,8 +165,8 @@ class QuotaLimit extends \Google\Protobuf\Internal\Message * defined within the service config. * @type string $unit * Specify the unit of the quota limit. It uses the same syntax as - * [Metric.unit][]. The supported unit kinds are determined by the quota - * backend system. + * [MetricDescriptor.unit][google.api.MetricDescriptor.unit]. The supported + * unit kinds are determined by the quota backend system. * Here are some examples: * * "1/min/{project}" for quota per minute per project. * Note: the order of unit components is insignificant. @@ -425,8 +425,8 @@ public function setMetric($var) /** * Specify the unit of the quota limit. It uses the same syntax as - * [Metric.unit][]. The supported unit kinds are determined by the quota - * backend system. + * [MetricDescriptor.unit][google.api.MetricDescriptor.unit]. The supported + * unit kinds are determined by the quota backend system. * Here are some examples: * * "1/min/{project}" for quota per minute per project. * Note: the order of unit components is insignificant. @@ -442,8 +442,8 @@ public function getUnit() /** * Specify the unit of the quota limit. It uses the same syntax as - * [Metric.unit][]. The supported unit kinds are determined by the quota - * backend system. + * [MetricDescriptor.unit][google.api.MetricDescriptor.unit]. The supported + * unit kinds are determined by the quota backend system. * Here are some examples: * * "1/min/{project}" for quota per minute per project. * Note: the order of unit components is insignificant. diff --git a/CommonProtos/src/Api/SelectiveGapicGeneration.php b/CommonProtos/src/Api/SelectiveGapicGeneration.php new file mode 100644 index 000000000000..50411f7fe547 --- /dev/null +++ b/CommonProtos/src/Api/SelectiveGapicGeneration.php @@ -0,0 +1,72 @@ +google.api.SelectiveGapicGeneration + */ +class SelectiveGapicGeneration extends \Google\Protobuf\Internal\Message +{ + /** + * An allowlist of the fully qualified names of RPCs that should be included + * on public client surfaces. + * + * Generated from protobuf field repeated string methods = 1; + */ + private $methods; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $methods + * An allowlist of the fully qualified names of RPCs that should be included + * on public client surfaces. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Client::initOnce(); + parent::__construct($data); + } + + /** + * An allowlist of the fully qualified names of RPCs that should be included + * on public client surfaces. + * + * Generated from protobuf field repeated string methods = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMethods() + { + return $this->methods; + } + + /** + * An allowlist of the fully qualified names of RPCs that should be included + * on public client surfaces. + * + * Generated from protobuf field repeated string methods = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMethods($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->methods = $arr; + + return $this; + } + +} + diff --git a/CommonProtos/src/Cloud/Iam/V1/ResourcePolicyMember.php b/CommonProtos/src/Cloud/Iam/V1/ResourcePolicyMember.php new file mode 100644 index 000000000000..88fbd7b3ca4c --- /dev/null +++ b/CommonProtos/src/Cloud/Iam/V1/ResourcePolicyMember.php @@ -0,0 +1,142 @@ +google.iam.v1.ResourcePolicyMember + */ +class ResourcePolicyMember extends \Google\Protobuf\Internal\Message +{ + /** + * IAM policy binding member referring to a Google Cloud resource by + * user-assigned name (https://google.aip.dev/122). If a resource is deleted + * and recreated with the same name, the binding will be applicable to the new + * resource. + * Example: + * `principal://parametermanager.googleapis.com/projects/12345/name/locations/us-central1-a/parameters/my-parameter` + * + * Generated from protobuf field string iam_policy_name_principal = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $iam_policy_name_principal = ''; + /** + * IAM policy binding member referring to a Google Cloud resource by + * system-assigned unique identifier (https://google.aip.dev/148#uid). If a + * resource is deleted and recreated with the same name, the binding will not + * be applicable to the new resource + * Example: + * `principal://parametermanager.googleapis.com/projects/12345/uid/locations/us-central1-a/parameters/a918fed5` + * + * Generated from protobuf field string iam_policy_uid_principal = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $iam_policy_uid_principal = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $iam_policy_name_principal + * IAM policy binding member referring to a Google Cloud resource by + * user-assigned name (https://google.aip.dev/122). If a resource is deleted + * and recreated with the same name, the binding will be applicable to the new + * resource. + * Example: + * `principal://parametermanager.googleapis.com/projects/12345/name/locations/us-central1-a/parameters/my-parameter` + * @type string $iam_policy_uid_principal + * IAM policy binding member referring to a Google Cloud resource by + * system-assigned unique identifier (https://google.aip.dev/148#uid). If a + * resource is deleted and recreated with the same name, the binding will not + * be applicable to the new resource + * Example: + * `principal://parametermanager.googleapis.com/projects/12345/uid/locations/us-central1-a/parameters/a918fed5` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Iam\V1\ResourcePolicyMember::initOnce(); + parent::__construct($data); + } + + /** + * IAM policy binding member referring to a Google Cloud resource by + * user-assigned name (https://google.aip.dev/122). If a resource is deleted + * and recreated with the same name, the binding will be applicable to the new + * resource. + * Example: + * `principal://parametermanager.googleapis.com/projects/12345/name/locations/us-central1-a/parameters/my-parameter` + * + * Generated from protobuf field string iam_policy_name_principal = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getIamPolicyNamePrincipal() + { + return $this->iam_policy_name_principal; + } + + /** + * IAM policy binding member referring to a Google Cloud resource by + * user-assigned name (https://google.aip.dev/122). If a resource is deleted + * and recreated with the same name, the binding will be applicable to the new + * resource. + * Example: + * `principal://parametermanager.googleapis.com/projects/12345/name/locations/us-central1-a/parameters/my-parameter` + * + * Generated from protobuf field string iam_policy_name_principal = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setIamPolicyNamePrincipal($var) + { + GPBUtil::checkString($var, True); + $this->iam_policy_name_principal = $var; + + return $this; + } + + /** + * IAM policy binding member referring to a Google Cloud resource by + * system-assigned unique identifier (https://google.aip.dev/148#uid). If a + * resource is deleted and recreated with the same name, the binding will not + * be applicable to the new resource + * Example: + * `principal://parametermanager.googleapis.com/projects/12345/uid/locations/us-central1-a/parameters/a918fed5` + * + * Generated from protobuf field string iam_policy_uid_principal = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getIamPolicyUidPrincipal() + { + return $this->iam_policy_uid_principal; + } + + /** + * IAM policy binding member referring to a Google Cloud resource by + * system-assigned unique identifier (https://google.aip.dev/148#uid). If a + * resource is deleted and recreated with the same name, the binding will not + * be applicable to the new resource + * Example: + * `principal://parametermanager.googleapis.com/projects/12345/uid/locations/us-central1-a/parameters/a918fed5` + * + * Generated from protobuf field string iam_policy_uid_principal = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setIamPolicyUidPrincipal($var) + { + GPBUtil::checkString($var, True); + $this->iam_policy_uid_principal = $var; + + return $this; + } + +} + diff --git a/CommonProtos/src/Rpc/BadRequest/FieldViolation.php b/CommonProtos/src/Rpc/BadRequest/FieldViolation.php index fd245f68b162..51d5843e9fad 100644 --- a/CommonProtos/src/Rpc/BadRequest/FieldViolation.php +++ b/CommonProtos/src/Rpc/BadRequest/FieldViolation.php @@ -55,6 +55,24 @@ class FieldViolation extends \Google\Protobuf\Internal\Message * Generated from protobuf field string description = 2; */ protected $description = ''; + /** + * The reason of the field-level error. This is a constant value that + * identifies the proximate cause of the field-level error. It should + * uniquely identify the type of the FieldViolation within the scope of the + * google.rpc.ErrorInfo.domain. This should be at most 63 + * characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, + * which represents UPPER_SNAKE_CASE. + * + * Generated from protobuf field string reason = 3; + */ + protected $reason = ''; + /** + * Provides a localized error message for field-level errors that is safe to + * return to the API consumer. + * + * Generated from protobuf field .google.rpc.LocalizedMessage localized_message = 4; + */ + protected $localized_message = null; /** * Constructor. @@ -94,6 +112,16 @@ class FieldViolation extends \Google\Protobuf\Internal\Message * value in the third `emailAddresses` message. * @type string $description * A description of why the request element is bad. + * @type string $reason + * The reason of the field-level error. This is a constant value that + * identifies the proximate cause of the field-level error. It should + * uniquely identify the type of the FieldViolation within the scope of the + * google.rpc.ErrorInfo.domain. This should be at most 63 + * characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, + * which represents UPPER_SNAKE_CASE. + * @type \Google\Rpc\LocalizedMessage $localized_message + * Provides a localized error message for field-level errors that is safe to + * return to the API consumer. * } */ public function __construct($data = NULL) { @@ -209,6 +237,80 @@ public function setDescription($var) return $this; } + /** + * The reason of the field-level error. This is a constant value that + * identifies the proximate cause of the field-level error. It should + * uniquely identify the type of the FieldViolation within the scope of the + * google.rpc.ErrorInfo.domain. This should be at most 63 + * characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, + * which represents UPPER_SNAKE_CASE. + * + * Generated from protobuf field string reason = 3; + * @return string + */ + public function getReason() + { + return $this->reason; + } + + /** + * The reason of the field-level error. This is a constant value that + * identifies the proximate cause of the field-level error. It should + * uniquely identify the type of the FieldViolation within the scope of the + * google.rpc.ErrorInfo.domain. This should be at most 63 + * characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, + * which represents UPPER_SNAKE_CASE. + * + * Generated from protobuf field string reason = 3; + * @param string $var + * @return $this + */ + public function setReason($var) + { + GPBUtil::checkString($var, True); + $this->reason = $var; + + return $this; + } + + /** + * Provides a localized error message for field-level errors that is safe to + * return to the API consumer. + * + * Generated from protobuf field .google.rpc.LocalizedMessage localized_message = 4; + * @return \Google\Rpc\LocalizedMessage|null + */ + public function getLocalizedMessage() + { + return $this->localized_message; + } + + public function hasLocalizedMessage() + { + return isset($this->localized_message); + } + + public function clearLocalizedMessage() + { + unset($this->localized_message); + } + + /** + * Provides a localized error message for field-level errors that is safe to + * return to the API consumer. + * + * Generated from protobuf field .google.rpc.LocalizedMessage localized_message = 4; + * @param \Google\Rpc\LocalizedMessage $var + * @return $this + */ + public function setLocalizedMessage($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\LocalizedMessage::class); + $this->localized_message = $var; + + return $this; + } + } diff --git a/CommonProtos/src/Rpc/Context/AttributeContext/Resource.php b/CommonProtos/src/Rpc/Context/AttributeContext/Resource.php index 6cf4b69e5b1a..4c1042436c31 100644 --- a/CommonProtos/src/Rpc/Context/AttributeContext/Resource.php +++ b/CommonProtos/src/Rpc/Context/AttributeContext/Resource.php @@ -70,7 +70,8 @@ class Resource extends \Google\Protobuf\Internal\Message * Annotations is an unstructured key-value map stored with a resource that * may be set by external tools to store and retrieve arbitrary metadata. * They are not queryable and should be preserved when modifying objects. - * More info: https://kubernetes.io/docs/user-guide/annotations + * More info: + * https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ * * Generated from protobuf field map annotations = 6; */ @@ -163,7 +164,8 @@ class Resource extends \Google\Protobuf\Internal\Message * Annotations is an unstructured key-value map stored with a resource that * may be set by external tools to store and retrieve arbitrary metadata. * They are not queryable and should be preserved when modifying objects. - * More info: https://kubernetes.io/docs/user-guide/annotations + * More info: + * https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ * @type string $display_name * Mutable. The display name set by clients. Must be <= 63 characters. * @type \Google\Protobuf\Timestamp $create_time @@ -367,7 +369,8 @@ public function setUid($var) * Annotations is an unstructured key-value map stored with a resource that * may be set by external tools to store and retrieve arbitrary metadata. * They are not queryable and should be preserved when modifying objects. - * More info: https://kubernetes.io/docs/user-guide/annotations + * More info: + * https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ * * Generated from protobuf field map annotations = 6; * @return \Google\Protobuf\Internal\MapField @@ -381,7 +384,8 @@ public function getAnnotations() * Annotations is an unstructured key-value map stored with a resource that * may be set by external tools to store and retrieve arbitrary metadata. * They are not queryable and should be preserved when modifying objects. - * More info: https://kubernetes.io/docs/user-guide/annotations + * More info: + * https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ * * Generated from protobuf field map annotations = 6; * @param array|\Google\Protobuf\Internal\MapField $var diff --git a/CommonProtos/src/Rpc/ErrorInfo.php b/CommonProtos/src/Rpc/ErrorInfo.php index 8c2e0ec0be25..83c969ca88b5 100644 --- a/CommonProtos/src/Rpc/ErrorInfo.php +++ b/CommonProtos/src/Rpc/ErrorInfo.php @@ -56,11 +56,12 @@ class ErrorInfo extends \Google\Protobuf\Internal\Message protected $domain = ''; /** * Additional structured details about this error. - * Keys should match /[a-zA-Z0-9-_]/ and be limited to 64 characters in + * Keys must match a regular expression of `[a-z][a-zA-Z0-9-_]+` but should + * ideally be lowerCamelCase. Also, they must be limited to 64 characters in * length. When identifying the current value of an exceeded limit, the units * should be contained in the key, not the value. For example, rather than - * {"instanceLimit": "100/request"}, should be returned as, - * {"instanceLimitPerRequest": "100"}, if the client exceeds the number of + * `{"instanceLimit": "100/request"}`, should be returned as, + * `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of * instances that can be created in a single (batch) request. * * Generated from protobuf field map metadata = 3; @@ -88,11 +89,12 @@ class ErrorInfo extends \Google\Protobuf\Internal\Message * infrastructure, the error domain is "googleapis.com". * @type array|\Google\Protobuf\Internal\MapField $metadata * Additional structured details about this error. - * Keys should match /[a-zA-Z0-9-_]/ and be limited to 64 characters in + * Keys must match a regular expression of `[a-z][a-zA-Z0-9-_]+` but should + * ideally be lowerCamelCase. Also, they must be limited to 64 characters in * length. When identifying the current value of an exceeded limit, the units * should be contained in the key, not the value. For example, rather than - * {"instanceLimit": "100/request"}, should be returned as, - * {"instanceLimitPerRequest": "100"}, if the client exceeds the number of + * `{"instanceLimit": "100/request"}`, should be returned as, + * `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of * instances that can be created in a single (batch) request. * } */ @@ -173,11 +175,12 @@ public function setDomain($var) /** * Additional structured details about this error. - * Keys should match /[a-zA-Z0-9-_]/ and be limited to 64 characters in + * Keys must match a regular expression of `[a-z][a-zA-Z0-9-_]+` but should + * ideally be lowerCamelCase. Also, they must be limited to 64 characters in * length. When identifying the current value of an exceeded limit, the units * should be contained in the key, not the value. For example, rather than - * {"instanceLimit": "100/request"}, should be returned as, - * {"instanceLimitPerRequest": "100"}, if the client exceeds the number of + * `{"instanceLimit": "100/request"}`, should be returned as, + * `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of * instances that can be created in a single (batch) request. * * Generated from protobuf field map metadata = 3; @@ -190,11 +193,12 @@ public function getMetadata() /** * Additional structured details about this error. - * Keys should match /[a-zA-Z0-9-_]/ and be limited to 64 characters in + * Keys must match a regular expression of `[a-z][a-zA-Z0-9-_]+` but should + * ideally be lowerCamelCase. Also, they must be limited to 64 characters in * length. When identifying the current value of an exceeded limit, the units * should be contained in the key, not the value. For example, rather than - * {"instanceLimit": "100/request"}, should be returned as, - * {"instanceLimitPerRequest": "100"}, if the client exceeds the number of + * `{"instanceLimit": "100/request"}`, should be returned as, + * `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of * instances that can be created in a single (batch) request. * * Generated from protobuf field map metadata = 3; From d7bb40a7ef509d27ef10c59078e977ae60f238fd Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 19 Dec 2024 23:41:11 +0000 Subject: [PATCH 3/8] tighten common-protos dependency --- ParameterManager/composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ParameterManager/composer.json b/ParameterManager/composer.json index aa289b6e3e11..9a743892344d 100644 --- a/ParameterManager/composer.json +++ b/ParameterManager/composer.json @@ -18,7 +18,8 @@ }, "require": { "php": "^8.0", - "google/gax": "^1.36.0" + "google/gax": "^1.36.0", + "google/common-protos": "^4.9" }, "require-dev": { "phpunit/phpunit": "^9.0" From 5a1583bc356a635c284ff2ed58ed4033f378e81a Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 20 Dec 2024 00:06:06 +0000 Subject: [PATCH 4/8] fix tests --- Core/tests/Unit/GrpcRequestWrapperTest.php | 3 ++- Core/tests/Unit/RequestHandlerTest.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Core/tests/Unit/GrpcRequestWrapperTest.php b/Core/tests/Unit/GrpcRequestWrapperTest.php index 62f359399205..591d902e3197 100644 --- a/Core/tests/Unit/GrpcRequestWrapperTest.php +++ b/Core/tests/Unit/GrpcRequestWrapperTest.php @@ -296,7 +296,8 @@ public function testExceptionMetadata() 'field_violations' => [ new FieldViolation([ 'field' => 'foo', - 'description' => 'bar' + 'description' => 'bar', + 'reason' => 'REASON' ]) ] ]); diff --git a/Core/tests/Unit/RequestHandlerTest.php b/Core/tests/Unit/RequestHandlerTest.php index 2677e5e9d6bb..17dd2d167afe 100644 --- a/Core/tests/Unit/RequestHandlerTest.php +++ b/Core/tests/Unit/RequestHandlerTest.php @@ -291,7 +291,8 @@ public function testExceptionMetadata() 'field_violations' => [ new FieldViolation([ 'field' => 'foo', - 'description' => 'bar' + 'description' => 'bar', + 'reason' => 'REASON', ]) ] ]); From 672167c562190b72ea07189ef6240b0b7d96ca09 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 20 Dec 2024 01:17:54 +0000 Subject: [PATCH 5/8] maybe fix package tests --- .github/run-package-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/run-package-tests.sh b/.github/run-package-tests.sh index e62b7a44fb4f..997a783770fd 100644 --- a/.github/run-package-tests.sh +++ b/.github/run-package-tests.sh @@ -45,7 +45,7 @@ FAILED_FILE=$(mktemp -d)/failed for DIR in ${DIRS}; do { cp ${DIR}/composer.json ${DIR}/composer-local.json # Update composer to use local packages - for i in CommonProtos,common-protos,4.0 BigQuery,cloud-bigquery Core,cloud-core Logging,cloud-logging PubSub,cloud-pubsub Storage,cloud-storage ShoppingCommonProtos,shopping-common-protos GeoCommonProtos,geo-common-protos,0.1; do + for i in CommonProtos,common-protos,4.100 BigQuery,cloud-bigquery Core,cloud-core Logging,cloud-logging PubSub,cloud-pubsub Storage,cloud-storage ShoppingCommonProtos,shopping-common-protos GeoCommonProtos,geo-common-protos,0.1; do IFS=","; set -- $i; if grep -q "\"google/$2\":" ${DIR}/composer.json; then # determine local package version From 632b74809266addbe800053134fb7bd191f63eb8 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 20 Dec 2024 09:10:03 -0800 Subject: [PATCH 6/8] Revert "maybe fix package tests" This reverts commit 672167c562190b72ea07189ef6240b0b7d96ca09. --- .github/run-package-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/run-package-tests.sh b/.github/run-package-tests.sh index 997a783770fd..e62b7a44fb4f 100644 --- a/.github/run-package-tests.sh +++ b/.github/run-package-tests.sh @@ -45,7 +45,7 @@ FAILED_FILE=$(mktemp -d)/failed for DIR in ${DIRS}; do { cp ${DIR}/composer.json ${DIR}/composer-local.json # Update composer to use local packages - for i in CommonProtos,common-protos,4.100 BigQuery,cloud-bigquery Core,cloud-core Logging,cloud-logging PubSub,cloud-pubsub Storage,cloud-storage ShoppingCommonProtos,shopping-common-protos GeoCommonProtos,geo-common-protos,0.1; do + for i in CommonProtos,common-protos,4.0 BigQuery,cloud-bigquery Core,cloud-core Logging,cloud-logging PubSub,cloud-pubsub Storage,cloud-storage ShoppingCommonProtos,shopping-common-protos GeoCommonProtos,geo-common-protos,0.1; do IFS=","; set -- $i; if grep -q "\"google/$2\":" ${DIR}/composer.json; then # determine local package version From 8597744b4ce602296529c7f14c8cb1a509e35f5b Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 20 Dec 2024 09:17:44 -0800 Subject: [PATCH 7/8] fix tests --- Core/tests/Unit/GrpcRequestWrapperTest.php | 15 ++++++++------- Core/tests/Unit/RequestHandlerTest.php | 17 +++++++++-------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Core/tests/Unit/GrpcRequestWrapperTest.php b/Core/tests/Unit/GrpcRequestWrapperTest.php index 591d902e3197..6b080e1718a0 100644 --- a/Core/tests/Unit/GrpcRequestWrapperTest.php +++ b/Core/tests/Unit/GrpcRequestWrapperTest.php @@ -297,7 +297,6 @@ public function testExceptionMetadata() new FieldViolation([ 'field' => 'foo', 'description' => 'bar', - 'reason' => 'REASON' ]) ] ]); @@ -325,13 +324,15 @@ public function testExceptionMetadata() $this->assertFalse(true, 'Exception not thrown!'); } catch (ServiceException $ex) { - $this->assertEquals( - json_decode($metadata->serializeToJsonString(), true), - $ex->getMetadata()[0] - ); - + $metadata = $ex->getMetadata(); // Assert only whitelisted types are included. - $this->assertCount(1, $ex->getMetadata()); + $this->assertCount(1, $metadata); + + $this->assertArrayHasKey('fieldViolations', $metadata[0]); + $this->assertCount(1, $metadata[0]['fieldViolations']); + $fieldViolation = $metadata[0]['fieldViolations'][0]; + $this->assertEquals('foo', $fieldViolation['field']); + $this->assertEquals('bar', $fieldViolation['description']); } } } diff --git a/Core/tests/Unit/RequestHandlerTest.php b/Core/tests/Unit/RequestHandlerTest.php index 17dd2d167afe..46462d82a72e 100644 --- a/Core/tests/Unit/RequestHandlerTest.php +++ b/Core/tests/Unit/RequestHandlerTest.php @@ -120,7 +120,7 @@ public function responseProvider() { $expectedMessage = ['successful' => 'request']; $message = new Http(); - + $pagedMessage = $this->prophesize(PagedListResponse::class); $page = $this->prophesize(Page::class); $page->getResponseObject()->willReturn($message); @@ -292,7 +292,6 @@ public function testExceptionMetadata() new FieldViolation([ 'field' => 'foo', 'description' => 'bar', - 'reason' => 'REASON', ]) ] ]); @@ -332,13 +331,15 @@ public function testExceptionMetadata() $this->assertFalse(true, 'Exception not thrown!'); } catch (ServiceException $ex) { - $this->assertEquals( - json_decode($metadata->serializeToJsonString(), true), - $ex->getMetadata()[0] - ); - + $metadata = $ex->getMetadata(); // Assert only whitelisted types are included. - $this->assertCount(1, $ex->getMetadata()); + $this->assertCount(1, $metadata); + + $this->assertArrayHasKey('fieldViolations', $metadata[0]); + $this->assertCount(1, $metadata[0]['fieldViolations']); + $fieldViolation = $metadata[0]['fieldViolations'][0]; + $this->assertEquals('foo', $fieldViolation['field']); + $this->assertEquals('bar', $fieldViolation['description']); } } } From a72d82c0da7340f01a042b920c67f54b089374ea Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 20 Dec 2024 09:51:04 -0800 Subject: [PATCH 8/8] fix individual package script --- .github/run-package-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/run-package-tests.sh b/.github/run-package-tests.sh index e62b7a44fb4f..997a783770fd 100644 --- a/.github/run-package-tests.sh +++ b/.github/run-package-tests.sh @@ -45,7 +45,7 @@ FAILED_FILE=$(mktemp -d)/failed for DIR in ${DIRS}; do { cp ${DIR}/composer.json ${DIR}/composer-local.json # Update composer to use local packages - for i in CommonProtos,common-protos,4.0 BigQuery,cloud-bigquery Core,cloud-core Logging,cloud-logging PubSub,cloud-pubsub Storage,cloud-storage ShoppingCommonProtos,shopping-common-protos GeoCommonProtos,geo-common-protos,0.1; do + for i in CommonProtos,common-protos,4.100 BigQuery,cloud-bigquery Core,cloud-core Logging,cloud-logging PubSub,cloud-pubsub Storage,cloud-storage ShoppingCommonProtos,shopping-common-protos GeoCommonProtos,geo-common-protos,0.1; do IFS=","; set -- $i; if grep -q "\"google/$2\":" ${DIR}/composer.json; then # determine local package version