From 93808cea63ebe634b9577cf3664d53ba083cc13d Mon Sep 17 00:00:00 2001 From: David Supplee Date: Thu, 15 Sep 2022 17:19:08 -0700 Subject: [PATCH] feat: introduce beyondcorp appconnections (#5497) * feat: introduce beyondcorp appconnections * chore: add beyondcorp* library global files * Update BeyondCorpAppConnections/composer.json Co-authored-by: Brent Shaffer * Update composer.json Co-authored-by: Brent Shaffer * Update BeyondCorpAppConnections/.repo-metadata.json Co-authored-by: Brent Shaffer Co-authored-by: dwsupplee@gmail.com Co-authored-by: Brent Shaffer --- BeyondCorpAppConnections/.OwlBot.yaml | 4 + BeyondCorpAppConnections/.gitattributes | 7 + .../.github/pull_request_template.md | 24 + BeyondCorpAppConnections/.repo-metadata.json | 8 + BeyondCorpAppConnections/CODE_OF_CONDUCT.md | 43 + BeyondCorpAppConnections/CONTRIBUTING.md | 10 + BeyondCorpAppConnections/LICENSE | 202 +++ BeyondCorpAppConnections/README.md | 37 + BeyondCorpAppConnections/SECURITY.md | 7 + BeyondCorpAppConnections/VERSION | 1 + BeyondCorpAppConnections/composer.json | 35 + .../metadata/V1/AppConnectionsService.php | Bin 0 -> 6755 bytes BeyondCorpAppConnections/owlbot.py | 112 ++ BeyondCorpAppConnections/phpunit.xml.dist | 16 + .../src/V1/AppConnection.php | 470 ++++++ .../V1/AppConnection/ApplicationEndpoint.php | 102 ++ .../src/V1/AppConnection/Gateway.php | 179 +++ .../src/V1/AppConnection/Gateway/Type.php | 55 + .../src/V1/AppConnection/State.php | 84 ++ .../src/V1/AppConnection/Type.php | 57 + .../src/V1/AppConnectionOperationMetadata.php | 307 ++++ .../src/V1/AppConnectionsServiceClient.php | 34 + .../V1/AppConnectionsServiceGrpcClient.php | 140 ++ .../src/V1/CreateAppConnectionRequest.php | 273 ++++ .../src/V1/DeleteAppConnectionRequest.php | 183 +++ .../AppConnectionsServiceGapicClient.php | 1335 +++++++++++++++++ .../src/V1/GetAppConnectionRequest.php | 71 + .../src/V1/ListAppConnectionsRequest.php | 243 +++ .../src/V1/ListAppConnectionsResponse.php | 139 ++ .../src/V1/ResolveAppConnectionsRequest.php | 205 +++ .../src/V1/ResolveAppConnectionsResponse.php | 139 ++ .../AppConnectionDetails.php | 116 ++ .../src/V1/UpdateAppConnectionRequest.php | 295 ++++ .../src/V1/gapic_metadata.json | 73 + ...app_connections_service_client_config.json | 77 + ..._connections_service_descriptor_config.php | 68 + ...connections_service_rest_client_config.php | 250 +++ .../V1/AppConnectionsServiceClientTest.php | 1054 +++++++++++++ .../cloud-beyondcorp-appconnections.json | 11 + 39 files changed, 6466 insertions(+) create mode 100644 BeyondCorpAppConnections/.OwlBot.yaml create mode 100644 BeyondCorpAppConnections/.gitattributes create mode 100644 BeyondCorpAppConnections/.github/pull_request_template.md create mode 100644 BeyondCorpAppConnections/.repo-metadata.json create mode 100644 BeyondCorpAppConnections/CODE_OF_CONDUCT.md create mode 100644 BeyondCorpAppConnections/CONTRIBUTING.md create mode 100644 BeyondCorpAppConnections/LICENSE create mode 100644 BeyondCorpAppConnections/README.md create mode 100644 BeyondCorpAppConnections/SECURITY.md create mode 100644 BeyondCorpAppConnections/VERSION create mode 100644 BeyondCorpAppConnections/composer.json create mode 100644 BeyondCorpAppConnections/metadata/V1/AppConnectionsService.php create mode 100644 BeyondCorpAppConnections/owlbot.py create mode 100644 BeyondCorpAppConnections/phpunit.xml.dist create mode 100644 BeyondCorpAppConnections/src/V1/AppConnection.php create mode 100644 BeyondCorpAppConnections/src/V1/AppConnection/ApplicationEndpoint.php create mode 100644 BeyondCorpAppConnections/src/V1/AppConnection/Gateway.php create mode 100644 BeyondCorpAppConnections/src/V1/AppConnection/Gateway/Type.php create mode 100644 BeyondCorpAppConnections/src/V1/AppConnection/State.php create mode 100644 BeyondCorpAppConnections/src/V1/AppConnection/Type.php create mode 100644 BeyondCorpAppConnections/src/V1/AppConnectionOperationMetadata.php create mode 100644 BeyondCorpAppConnections/src/V1/AppConnectionsServiceClient.php create mode 100644 BeyondCorpAppConnections/src/V1/AppConnectionsServiceGrpcClient.php create mode 100644 BeyondCorpAppConnections/src/V1/CreateAppConnectionRequest.php create mode 100644 BeyondCorpAppConnections/src/V1/DeleteAppConnectionRequest.php create mode 100644 BeyondCorpAppConnections/src/V1/Gapic/AppConnectionsServiceGapicClient.php create mode 100644 BeyondCorpAppConnections/src/V1/GetAppConnectionRequest.php create mode 100644 BeyondCorpAppConnections/src/V1/ListAppConnectionsRequest.php create mode 100644 BeyondCorpAppConnections/src/V1/ListAppConnectionsResponse.php create mode 100644 BeyondCorpAppConnections/src/V1/ResolveAppConnectionsRequest.php create mode 100644 BeyondCorpAppConnections/src/V1/ResolveAppConnectionsResponse.php create mode 100644 BeyondCorpAppConnections/src/V1/ResolveAppConnectionsResponse/AppConnectionDetails.php create mode 100644 BeyondCorpAppConnections/src/V1/UpdateAppConnectionRequest.php create mode 100644 BeyondCorpAppConnections/src/V1/gapic_metadata.json create mode 100644 BeyondCorpAppConnections/src/V1/resources/app_connections_service_client_config.json create mode 100644 BeyondCorpAppConnections/src/V1/resources/app_connections_service_descriptor_config.php create mode 100644 BeyondCorpAppConnections/src/V1/resources/app_connections_service_rest_client_config.php create mode 100644 BeyondCorpAppConnections/tests/Unit/V1/AppConnectionsServiceClientTest.php create mode 100644 docs/contents/cloud-beyondcorp-appconnections.json diff --git a/BeyondCorpAppConnections/.OwlBot.yaml b/BeyondCorpAppConnections/.OwlBot.yaml new file mode 100644 index 000000000000..b2e4c82ac848 --- /dev/null +++ b/BeyondCorpAppConnections/.OwlBot.yaml @@ -0,0 +1,4 @@ +deep-copy-regex: + - source: /google/cloud/beyondcorp/appconnections/v1/.*-php/(.*) + dest: /owl-bot-staging/BeyondCorpAppConnections/v1/$1 +api-name: BeyondCorpAppConnections diff --git a/BeyondCorpAppConnections/.gitattributes b/BeyondCorpAppConnections/.gitattributes new file mode 100644 index 000000000000..986ee5f5fe7c --- /dev/null +++ b/BeyondCorpAppConnections/.gitattributes @@ -0,0 +1,7 @@ +/*.xml.dist export-ignore +/tests export-ignore +/.github export-ignore +/.repo-metadata.json export-ignore +/.OwlBot.yaml export-ignore +/owlbot.py export-ignore +/src/**/gapic_metadata.json export-ignore diff --git a/BeyondCorpAppConnections/.github/pull_request_template.md b/BeyondCorpAppConnections/.github/pull_request_template.md new file mode 100644 index 000000000000..ac7858ffe06b --- /dev/null +++ b/BeyondCorpAppConnections/.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 `BeyondCorpAppConnections/src`, and tests in `BeyondCorpAppConnections/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/BeyondCorpAppConnections/.repo-metadata.json b/BeyondCorpAppConnections/.repo-metadata.json new file mode 100644 index 000000000000..e8fd3b44adab --- /dev/null +++ b/BeyondCorpAppConnections/.repo-metadata.json @@ -0,0 +1,8 @@ +{ + "distribution_name": "google/cloud-beyondcorp-appconnections", + "release_level": "beta", + "client_documentation": "http://googleapis.github.io/google-cloud-php/#/docs/cloud-beyondcorp-appconnections/latest", + "library_type": "GAPIC_AUTO", + "product_documentation": "https://cloud.google.com/beyondcorp-enterprise/docs", + "issue_tracker": "https://github.com/googleapis/google-cloud-php/issues" +} diff --git a/BeyondCorpAppConnections/CODE_OF_CONDUCT.md b/BeyondCorpAppConnections/CODE_OF_CONDUCT.md new file mode 100644 index 000000000000..c3727800341a --- /dev/null +++ b/BeyondCorpAppConnections/CODE_OF_CONDUCT.md @@ -0,0 +1,43 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, +and in the interest of fostering an open and welcoming community, +we pledge to respect all people who contribute through reporting issues, +posting feature requests, updating documentation, +submitting pull requests or patches, and other activities. + +We are committed to making participation in this project +a harassment-free experience for everyone, +regardless of level of experience, gender, gender identity and expression, +sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, +such as physical or electronic +addresses, without explicit permission +* Other unethical or unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct. +By adopting this Code of Conduct, +project maintainers commit themselves to fairly and consistently +applying these principles to every aspect of managing this project. +Project maintainers who do not follow or enforce the Code of Conduct +may be permanently removed from the project team. + +This code of conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior +may be reported by opening an issue +or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, +available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) \ No newline at end of file diff --git a/BeyondCorpAppConnections/CONTRIBUTING.md b/BeyondCorpAppConnections/CONTRIBUTING.md new file mode 100644 index 000000000000..76ea811cacdb --- /dev/null +++ b/BeyondCorpAppConnections/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/BeyondCorpAppConnections/LICENSE b/BeyondCorpAppConnections/LICENSE new file mode 100644 index 000000000000..8f71f43fee3f --- /dev/null +++ b/BeyondCorpAppConnections/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/BeyondCorpAppConnections/README.md b/BeyondCorpAppConnections/README.md new file mode 100644 index 000000000000..7491aa688e8c --- /dev/null +++ b/BeyondCorpAppConnections/README.md @@ -0,0 +1,37 @@ +# Google Cloud BeyondCorp AppConnections for PHP for PHP + +> Idiomatic PHP client for [Google Cloud BeyondCorp AppConnections for PHP](https://cloud.google.com/beyondcorp-enterprise). + +[![Latest Stable Version](https://poser.pugx.org/google/cloud-beyondcorp-appconnections/v/stable)](https://packagist.org/packages/google/cloud-beyondcorp-appconnections) [![Packagist](https://img.shields.io/packagist/dm/google/cloud-beyondcorp-appconnections.svg)](https://packagist.org/packages/google/cloud-beyondcorp-appconnections) + +* [API documentation](http://googleapis.github.io/google-cloud-php/#/docs/cloud-beyondcorp-appconnections/latest/beyondcorpappconnections/readme) + +**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 to install just this component: + +```sh +$ composer require google/cloud-beyondcorp-appconnections +``` + +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. + +### Version + +This component is considered beta. As such, it should be expected to be mostly stable and we're working towards a release candidate. We will address issues and requests with a higher priority. + +### Next Steps + +1. Understand the [official documentation](https://cloud.google.com/beyondcorp-enterprise/docs). diff --git a/BeyondCorpAppConnections/SECURITY.md b/BeyondCorpAppConnections/SECURITY.md new file mode 100644 index 000000000000..8b58ae9c01ae --- /dev/null +++ b/BeyondCorpAppConnections/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). + +The Google Security Team will respond within 5 working days of your report on g.co/vulnz. + +We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. diff --git a/BeyondCorpAppConnections/VERSION b/BeyondCorpAppConnections/VERSION new file mode 100644 index 000000000000..77d6f4ca2371 --- /dev/null +++ b/BeyondCorpAppConnections/VERSION @@ -0,0 +1 @@ +0.0.0 diff --git a/BeyondCorpAppConnections/composer.json b/BeyondCorpAppConnections/composer.json new file mode 100644 index 000000000000..bdeec01a6cd1 --- /dev/null +++ b/BeyondCorpAppConnections/composer.json @@ -0,0 +1,35 @@ +{ + "name": "google/cloud-beyondcorp-appconnections", + "description": "Google Cloud BeyondCorp AppConnections for PHP Client for PHP", + "license": "Apache-2.0", + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "Google\\Cloud\\BeyondCorp\\AppConnections\\": "src", + "GPBMetadata\\Google\\Cloud\\Beyondcorp\\Appconnections\\": "metadata" + } + }, + "autoload-dev": { + "psr-4": { + "Google\\Cloud\\BeyondCorp\\AppConnections\\Tests\\": "tests" + } + }, + "extra": { + "component": { + "id": "cloud-beyondcorp-appconnections", + "path": "BeyondCorpAppConnections", + "entry": null, + "target": "googleapis/google-cloud-php-beyondcorp-appconnections.git" + } + }, + "require": { + "google/gax": "^1.17.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.0|^8.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/BeyondCorpAppConnections/metadata/V1/AppConnectionsService.php b/BeyondCorpAppConnections/metadata/V1/AppConnectionsService.php new file mode 100644 index 0000000000000000000000000000000000000000..39e87ccb14d1b334b7d1b593385cf4fa5f917153 GIT binary patch literal 6755 zcmb_h&2JmW6)#CimPWQBk1U&Jn{-PXvE)iiNDa_n9VK0Um=P*VtVBC@!D6voj;O6y zyW8ERR8}BR^imXPfdW1C&|47%{SW#t_);Lb`4j|25B>*QVjtP)j!-8iaa50Vgmz!>j)-78mS<^}A+&pkhr|&y>)6%};)sG!-4k~A znnJC*-TVP8b*-MG5lQG;R@WdU&9Hi%Qk(QGv!hv#T~cjZvrLm{o^F|L>12a`QDUDI zmpCW7MntwJLZ*65TwB$MP;ZnU5l`)?p4zH2@vRCK-ztaVTXI5t>&eCggfv5ST>(Za z(Z&aS6Lf|I_-FUphOP;&r+V<;UENi5Q}=Y$(0>Cy*b)v^!zCbTbnao#WR?hY!Jes+ zl~sYuq;v1u7WiyS2-Iy*H-ZaW+onexQ#D#u;%bg=dzRCHsgl$sUg&)KWo6ahmWtC4 zg%z%&B#kJ!C3sGc#CI12hj=~5e8BXk0tVqu)_ruyolXdbhmdY7Vfbh;@1bwjQ2j0C8D8arM3%5(l(1qlVa1b; z!YzMK)z%@uY1nzL7QP=FIHa*v+J12T3AbYt96y5o&>ersh{9B|!Z7)h0#;$v0C`m6 zyBtF>hExb=c!9_HgyKIl==P58dPzFiC%@`JVDKks##SA$D4!8BD|6-2*K+n-c@?+r z#XQ0_1?ycAc(9a^gm0obTkR6X1?tFWLCADD_qCkCw-93AJ?l9!^EoD+4J@IVL)`#6 z$WKKdm(i@{bcmz0`}yhcbMbE(R7g|awIN>#{uz1)q7^4oFeA4zzxkoabsi(SV$z&j z=pB>%+EZe>Q={ha5}NOs4pFruwQUeED7P|Ke2Q+>Nz%1}XSdK4W%8t7(b#@1{vnGB z71+-s2?Yc3mk-=~=z7w5ir!%XoZ|s}j24pPEQpuzEft%kxNtc5=zcK>6wtL3IDp`^ zBZ_4j90#*Zm*Tg8gU2=ipWiG57zk2B42g_uGHM`=^jkJC2K*5N zsqx%E3}dQcSf|Rd?z+I(ED3z${|v@gi9yaW{*pi&3J3!`2f&EF)D~Z-ml^audL$Vq z$%wdb51*f+#Tfo9CxWNQNNNSWKMqG(PLiUi5vddvL9zI+EPD4G>wM-Jpqnw};9ylc zP^syL>l4r~0`R^0coAQ_Q<9#ld=rS-1T0nfZ3f*)HI7)uDipF=0RnO3j zp|%MGY>J&2)d>QYFhty8Vrr)6^m*RgMprw!Ya41`VJARzp5aB5>jCS{fR2o1bGU(~ zyuMBHSK!ma=GKL^Xo3(r+`Dy4E5kOpT3 z6qc^SRH78dxGjfeG!H0H0$*_qt})_#AKiT|ar%}NH_;T`9N$2T&1a38@_6^4QLAh} z+^$s@zeB&)D-C78R^Q&+m3Nd!+x5jvVI9rK@&V7I+;h_BH4wgrrs06^@x-2!vL9xO zKYZ;L*U(%OwrK3{J$<&ADJp210RbjzD_IjqrDG+WuP$<6Iu&;+)=!hV6WSqwvu z8&y7(qra-Pof?}sg=f)Jb?>v?#c8ScN_NJt&~P0Ji(f)t@0QN|zXm14;%Nupfc z0p6r{J!ibT+6tj^KL(Ne!_ass``sA+Dg)^?)LG#21Y|P2I56_Uol#Lv*hNpabF3Q1 z`~AU7ne{^W?^(2z($nBcJfE^Yu8LZF5%)QsCUT6Q5ijH)qh_YN)RxctW{v<}x=j{qWj1Q5&Y5ugHZ49OnR6`yRp2>K^nY_M{Rsd7 literal 0 HcmV?d00001 diff --git a/BeyondCorpAppConnections/owlbot.py b/BeyondCorpAppConnections/owlbot.py new file mode 100644 index 000000000000..c3d6cf3e10f3 --- /dev/null +++ b/BeyondCorpAppConnections/owlbot.py @@ -0,0 +1,112 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.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}/BeyondCorpAppConnections").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, + copy_excludes=[ + src / "**/[A-Z]*_*.php" + ] +) + +# document and utilize apiEndpoint instead of serviceAddress +s.replace( + "**/Gapic/*GapicClient.php", + r"'serviceAddress' =>", + r"'apiEndpoint' =>") +s.replace( + "**/Gapic/*GapicClient.php", + r"@type string \$serviceAddress\n\s+\*\s+The address", + r"""@type string $serviceAddress + * **Deprecated**. This option will be removed in a future major release. Please + * utilize the `$apiEndpoint` option instead. + * @type string $apiEndpoint + * The address""") +s.replace( + "**/Gapic/*GapicClient.php", + r"\$transportConfig, and any \$serviceAddress", + r"$transportConfig, and any `$apiEndpoint`") + +# 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", + '') + +### [START] protoc backwards compatibility fixes + +# roll back to private properties. +s.replace( + "src/**/V*/**/*.php", + r"Generated from protobuf field ([^\n]{0,})\n\s{5}\*/\n\s{4}protected \$", + r"""Generated from protobuf field \1 + */ + private $""") + +# prevent proto messages from being marked final +s.replace( + "src/**/V*/**/*.php", + r"final class", + r"class") + +# Replace "Unwrapped" with "Value" for method names. +s.replace( + "src/**/V*/**/*.php", + r"public function ([s|g]\w{3,})Unwrapped", + r"public function \1Value" +) + +### [END] protoc backwards compatibility fixes + +# fix relative cloud.google.com links +s.replace( + "src/**/V*/**/*.php", + r"(.{0,})\]\((/.{0,})\)", + r"\1](https://cloud.google.com\2)" +) + +# format generated clients +subprocess.run([ + 'npm', + 'exec', + '--yes', + '--package=@prettier/plugin-php@^0.16', + '--', + 'prettier', + '**/Gapic/*', + '--write', + '--parser=php', + '--single-quote', + '--print-width=80']) diff --git a/BeyondCorpAppConnections/phpunit.xml.dist b/BeyondCorpAppConnections/phpunit.xml.dist new file mode 100644 index 000000000000..f5244e503857 --- /dev/null +++ b/BeyondCorpAppConnections/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/BeyondCorpAppConnections/src/V1/AppConnection.php b/BeyondCorpAppConnections/src/V1/AppConnection.php new file mode 100644 index 000000000000..309d080948a4 --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/AppConnection.php @@ -0,0 +1,470 @@ +google.cloud.beyondcorp.appconnections.v1.AppConnection + */ +class AppConnection extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Unique resource name of the AppConnection. + * The name is ignored when creating a AppConnection. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $name = ''; + /** + * Output only. Timestamp when the resource was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $create_time = null; + /** + * Output only. Timestamp when the resource was last modified. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $update_time = null; + /** + * Optional. Resource labels to represent user provided metadata. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + /** + * Optional. An arbitrary user-provided name for the AppConnection. Cannot + * exceed 64 characters. + * + * Generated from protobuf field string display_name = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $display_name = ''; + /** + * Output only. A unique identifier for the instance generated by the + * system. + * + * Generated from protobuf field string uid = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $uid = ''; + /** + * Required. The type of network connectivity used by the AppConnection. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection.Type type = 7 [(.google.api.field_behavior) = REQUIRED]; + */ + private $type = 0; + /** + * Required. Address of the remote application endpoint for the BeyondCorp + * AppConnection. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection.ApplicationEndpoint application_endpoint = 8 [(.google.api.field_behavior) = REQUIRED]; + */ + private $application_endpoint = null; + /** + * Optional. List of [google.cloud.beyondcorp.v1main.Connector.name] that are + * authorised to be associated with this AppConnection. + * + * Generated from protobuf field repeated string connectors = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $connectors; + /** + * Output only. The current state of the AppConnection. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $state = 0; + /** + * Optional. Gateway used by the AppConnection. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection.Gateway gateway = 11 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $gateway = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Unique resource name of the AppConnection. + * The name is ignored when creating a AppConnection. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Timestamp when the resource was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Timestamp when the resource was last modified. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. Resource labels to represent user provided metadata. + * @type string $display_name + * Optional. An arbitrary user-provided name for the AppConnection. Cannot + * exceed 64 characters. + * @type string $uid + * Output only. A unique identifier for the instance generated by the + * system. + * @type int $type + * Required. The type of network connectivity used by the AppConnection. + * @type \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection\ApplicationEndpoint $application_endpoint + * Required. Address of the remote application endpoint for the BeyondCorp + * AppConnection. + * @type array|\Google\Protobuf\Internal\RepeatedField $connectors + * Optional. List of [google.cloud.beyondcorp.v1main.Connector.name] that are + * authorised to be associated with this AppConnection. + * @type int $state + * Output only. The current state of the AppConnection. + * @type \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection\Gateway $gateway + * Optional. Gateway used by the AppConnection. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Beyondcorp\Appconnections\V1\AppConnectionsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Unique resource name of the AppConnection. + * The name is ignored when creating a AppConnection. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Unique resource name of the AppConnection. + * The name is ignored when creating a AppConnection. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Timestamp when the resource was created. + * + * 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. Timestamp when the resource was created. + * + * 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. Timestamp when the resource was last modified. + * + * 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. Timestamp when the resource was last modified. + * + * 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. Resource labels to represent user provided metadata. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. Resource labels to represent user provided metadata. + * + * 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. An arbitrary user-provided name for the AppConnection. Cannot + * exceed 64 characters. + * + * Generated from protobuf field string display_name = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Optional. An arbitrary user-provided name for the AppConnection. Cannot + * exceed 64 characters. + * + * Generated from protobuf field string display_name = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Output only. A unique identifier for the instance generated by the + * system. + * + * Generated from protobuf field string uid = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. A unique identifier for the instance generated by the + * system. + * + * Generated from protobuf field string uid = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Required. The type of network connectivity used by the AppConnection. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection.Type type = 7 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Required. The type of network connectivity used by the AppConnection. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection.Type type = 7 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Required. Address of the remote application endpoint for the BeyondCorp + * AppConnection. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection.ApplicationEndpoint application_endpoint = 8 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection\ApplicationEndpoint|null + */ + public function getApplicationEndpoint() + { + return $this->application_endpoint; + } + + public function hasApplicationEndpoint() + { + return isset($this->application_endpoint); + } + + public function clearApplicationEndpoint() + { + unset($this->application_endpoint); + } + + /** + * Required. Address of the remote application endpoint for the BeyondCorp + * AppConnection. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection.ApplicationEndpoint application_endpoint = 8 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection\ApplicationEndpoint $var + * @return $this + */ + public function setApplicationEndpoint($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection\ApplicationEndpoint::class); + $this->application_endpoint = $var; + + return $this; + } + + /** + * Optional. List of [google.cloud.beyondcorp.v1main.Connector.name] that are + * authorised to be associated with this AppConnection. + * + * Generated from protobuf field repeated string connectors = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConnectors() + { + return $this->connectors; + } + + /** + * Optional. List of [google.cloud.beyondcorp.v1main.Connector.name] that are + * authorised to be associated with this AppConnection. + * + * Generated from protobuf field repeated string connectors = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConnectors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->connectors = $arr; + + return $this; + } + + /** + * Output only. The current state of the AppConnection. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the AppConnection. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection\State::class); + $this->state = $var; + + return $this; + } + + /** + * Optional. Gateway used by the AppConnection. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection.Gateway gateway = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection\Gateway|null + */ + public function getGateway() + { + return $this->gateway; + } + + public function hasGateway() + { + return isset($this->gateway); + } + + public function clearGateway() + { + unset($this->gateway); + } + + /** + * Optional. Gateway used by the AppConnection. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection.Gateway gateway = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection\Gateway $var + * @return $this + */ + public function setGateway($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection\Gateway::class); + $this->gateway = $var; + + return $this; + } + +} + diff --git a/BeyondCorpAppConnections/src/V1/AppConnection/ApplicationEndpoint.php b/BeyondCorpAppConnections/src/V1/AppConnection/ApplicationEndpoint.php new file mode 100644 index 000000000000..b4b65e403711 --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/AppConnection/ApplicationEndpoint.php @@ -0,0 +1,102 @@ +google.cloud.beyondcorp.appconnections.v1.AppConnection.ApplicationEndpoint + */ +class ApplicationEndpoint extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Hostname or IP address of the remote application endpoint. + * + * Generated from protobuf field string host = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $host = ''; + /** + * Required. Port of the remote application endpoint. + * + * Generated from protobuf field int32 port = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $port = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $host + * Required. Hostname or IP address of the remote application endpoint. + * @type int $port + * Required. Port of the remote application endpoint. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Beyondcorp\Appconnections\V1\AppConnectionsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Hostname or IP address of the remote application endpoint. + * + * Generated from protobuf field string host = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getHost() + { + return $this->host; + } + + /** + * Required. Hostname or IP address of the remote application endpoint. + * + * Generated from protobuf field string host = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setHost($var) + { + GPBUtil::checkString($var, True); + $this->host = $var; + + return $this; + } + + /** + * Required. Port of the remote application endpoint. + * + * Generated from protobuf field int32 port = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getPort() + { + return $this->port; + } + + /** + * Required. Port of the remote application endpoint. + * + * Generated from protobuf field int32 port = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setPort($var) + { + GPBUtil::checkInt32($var); + $this->port = $var; + + return $this; + } + +} + + diff --git a/BeyondCorpAppConnections/src/V1/AppConnection/Gateway.php b/BeyondCorpAppConnections/src/V1/AppConnection/Gateway.php new file mode 100644 index 000000000000..ae3580730248 --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/AppConnection/Gateway.php @@ -0,0 +1,179 @@ +google.cloud.beyondcorp.appconnections.v1.AppConnection.Gateway + */ +class Gateway extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The type of hosting used by the gateway. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection.Gateway.Type type = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $type = 0; + /** + * Output only. Server-defined URI for this resource. + * + * Generated from protobuf field string uri = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $uri = ''; + /** + * Output only. Ingress port reserved on the gateways for this + * AppConnection, if not specified or zero, the default port is 19443. + * + * Generated from protobuf field int32 ingress_port = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $ingress_port = 0; + /** + * Required. AppGateway name in following format: + * `projects/{project_id}/locations/{location_id}/appgateways/{gateway_id}` + * + * Generated from protobuf field string app_gateway = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $app_gateway = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Required. The type of hosting used by the gateway. + * @type string $uri + * Output only. Server-defined URI for this resource. + * @type int $ingress_port + * Output only. Ingress port reserved on the gateways for this + * AppConnection, if not specified or zero, the default port is 19443. + * @type string $app_gateway + * Required. AppGateway name in following format: + * `projects/{project_id}/locations/{location_id}/appgateways/{gateway_id}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Beyondcorp\Appconnections\V1\AppConnectionsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The type of hosting used by the gateway. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection.Gateway.Type type = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Required. The type of hosting used by the gateway. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection.Gateway.Type type = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection\Gateway\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Output only. Server-defined URI for this resource. + * + * Generated from protobuf field string uri = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Output only. Server-defined URI for this resource. + * + * Generated from protobuf field string uri = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Output only. Ingress port reserved on the gateways for this + * AppConnection, if not specified or zero, the default port is 19443. + * + * Generated from protobuf field int32 ingress_port = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getIngressPort() + { + return $this->ingress_port; + } + + /** + * Output only. Ingress port reserved on the gateways for this + * AppConnection, if not specified or zero, the default port is 19443. + * + * Generated from protobuf field int32 ingress_port = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setIngressPort($var) + { + GPBUtil::checkInt32($var); + $this->ingress_port = $var; + + return $this; + } + + /** + * Required. AppGateway name in following format: + * `projects/{project_id}/locations/{location_id}/appgateways/{gateway_id}` + * + * Generated from protobuf field string app_gateway = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getAppGateway() + { + return $this->app_gateway; + } + + /** + * Required. AppGateway name in following format: + * `projects/{project_id}/locations/{location_id}/appgateways/{gateway_id}` + * + * Generated from protobuf field string app_gateway = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAppGateway($var) + { + GPBUtil::checkString($var, True); + $this->app_gateway = $var; + + return $this; + } + +} + + diff --git a/BeyondCorpAppConnections/src/V1/AppConnection/Gateway/Type.php b/BeyondCorpAppConnections/src/V1/AppConnection/Gateway/Type.php new file mode 100644 index 000000000000..10d472ce7779 --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/AppConnection/Gateway/Type.php @@ -0,0 +1,55 @@ +google.cloud.beyondcorp.appconnections.v1.AppConnection.Gateway.Type + */ +class Type +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Gateway hosted in a GCP regional managed instance group. + * + * Generated from protobuf enum GCP_REGIONAL_MIG = 1; + */ + const GCP_REGIONAL_MIG = 1; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::GCP_REGIONAL_MIG => 'GCP_REGIONAL_MIG', + ]; + + 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/BeyondCorpAppConnections/src/V1/AppConnection/State.php b/BeyondCorpAppConnections/src/V1/AppConnection/State.php new file mode 100644 index 000000000000..f03c1fb4f639 --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/AppConnection/State.php @@ -0,0 +1,84 @@ +google.cloud.beyondcorp.appconnections.v1.AppConnection.State + */ +class State +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * AppConnection is being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * AppConnection has been created. + * + * Generated from protobuf enum CREATED = 2; + */ + const CREATED = 2; + /** + * AppConnection's configuration is being updated. + * + * Generated from protobuf enum UPDATING = 3; + */ + const UPDATING = 3; + /** + * AppConnection is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + /** + * AppConnection is down and may be restored in the future. + * This happens when CCFE sends ProjectState = OFF. + * + * Generated from protobuf enum DOWN = 5; + */ + const DOWN = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::CREATED => 'CREATED', + self::UPDATING => 'UPDATING', + self::DELETING => 'DELETING', + self::DOWN => 'DOWN', + ]; + + 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/BeyondCorpAppConnections/src/V1/AppConnection/Type.php b/BeyondCorpAppConnections/src/V1/AppConnection/Type.php new file mode 100644 index 000000000000..351737cbbf66 --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/AppConnection/Type.php @@ -0,0 +1,57 @@ +google.cloud.beyondcorp.appconnections.v1.AppConnection.Type + */ +class Type +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * TCP Proxy based BeyondCorp AppConnection. API will default to this if + * unset. + * + * Generated from protobuf enum TCP_PROXY = 1; + */ + const TCP_PROXY = 1; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::TCP_PROXY => 'TCP_PROXY', + ]; + + 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/BeyondCorpAppConnections/src/V1/AppConnectionOperationMetadata.php b/BeyondCorpAppConnections/src/V1/AppConnectionOperationMetadata.php new file mode 100644 index 000000000000..028c626c6659 --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/AppConnectionOperationMetadata.php @@ -0,0 +1,307 @@ +google.cloud.beyondcorp.appconnections.v1.AppConnectionOperationMetadata + */ +class AppConnectionOperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $create_time = null; + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $end_time = null; + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $target = ''; + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $verb = ''; + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $status_message = ''; + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $requested_cancellation = false; + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $api_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time the operation finished running. + * @type string $target + * Output only. Server-defined resource path for the target of the operation. + * @type string $verb + * Output only. Name of the verb executed by the operation. + * @type string $status_message + * Output only. Human-readable status of the operation, if any. + * @type bool $requested_cancellation + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * @type string $api_version + * Output only. API version used to start the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Beyondcorp\Appconnections\V1\AppConnectionsService::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.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. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.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. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStatusMessage() + { + return $this->status_message; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStatusMessage($var) + { + GPBUtil::checkString($var, True); + $this->status_message = $var; + + return $this; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getRequestedCancellation() + { + return $this->requested_cancellation; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setRequestedCancellation($var) + { + GPBUtil::checkBool($var); + $this->requested_cancellation = $var; + + return $this; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + +} + diff --git a/BeyondCorpAppConnections/src/V1/AppConnectionsServiceClient.php b/BeyondCorpAppConnections/src/V1/AppConnectionsServiceClient.php new file mode 100644 index 000000000000..1a81bc72d90c --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/AppConnectionsServiceClient.php @@ -0,0 +1,34 @@ +_simpleRequest('/google.cloud.beyondcorp.appconnections.v1.AppConnectionsService/ListAppConnections', + $argument, + ['\Google\Cloud\BeyondCorp\AppConnections\V1\ListAppConnectionsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets details of a single AppConnection. + * @param \Google\Cloud\BeyondCorp\AppConnections\V1\GetAppConnectionRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetAppConnection(\Google\Cloud\BeyondCorp\AppConnections\V1\GetAppConnectionRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.beyondcorp.appconnections.v1.AppConnectionsService/GetAppConnection', + $argument, + ['\Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection', 'decode'], + $metadata, $options); + } + + /** + * Creates a new AppConnection in a given project and location. + * @param \Google\Cloud\BeyondCorp\AppConnections\V1\CreateAppConnectionRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateAppConnection(\Google\Cloud\BeyondCorp\AppConnections\V1\CreateAppConnectionRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.beyondcorp.appconnections.v1.AppConnectionsService/CreateAppConnection', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Updates the parameters of a single AppConnection. + * @param \Google\Cloud\BeyondCorp\AppConnections\V1\UpdateAppConnectionRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function UpdateAppConnection(\Google\Cloud\BeyondCorp\AppConnections\V1\UpdateAppConnectionRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.beyondcorp.appconnections.v1.AppConnectionsService/UpdateAppConnection', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Deletes a single AppConnection. + * @param \Google\Cloud\BeyondCorp\AppConnections\V1\DeleteAppConnectionRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteAppConnection(\Google\Cloud\BeyondCorp\AppConnections\V1\DeleteAppConnectionRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.beyondcorp.appconnections.v1.AppConnectionsService/DeleteAppConnection', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Resolves AppConnections details for a given AppConnector. + * An internal method called by a connector to find AppConnections to connect + * to. + * @param \Google\Cloud\BeyondCorp\AppConnections\V1\ResolveAppConnectionsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ResolveAppConnections(\Google\Cloud\BeyondCorp\AppConnections\V1\ResolveAppConnectionsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.beyondcorp.appconnections.v1.AppConnectionsService/ResolveAppConnections', + $argument, + ['\Google\Cloud\BeyondCorp\AppConnections\V1\ResolveAppConnectionsResponse', 'decode'], + $metadata, $options); + } + +} diff --git a/BeyondCorpAppConnections/src/V1/CreateAppConnectionRequest.php b/BeyondCorpAppConnections/src/V1/CreateAppConnectionRequest.php new file mode 100644 index 000000000000..324ed4a9dde1 --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/CreateAppConnectionRequest.php @@ -0,0 +1,273 @@ +google.cloud.beyondcorp.appconnections.v1.CreateAppConnectionRequest + */ +class CreateAppConnectionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource project name of the AppConnection location using the + * form: `projects/{project_id}/locations/{location_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * Optional. User-settable AppConnection resource ID. + * * Must start with a letter. + * * Must contain between 4-63 characters from `/[a-z][0-9]-/`. + * * Must end with a number or a letter. + * + * Generated from protobuf field string app_connection_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $app_connection_id = ''; + /** + * Required. A BeyondCorp AppConnection resource. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection app_connection = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $app_connection = 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 t + * he 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]; + */ + private $request_id = ''; + /** + * Optional. If set, validates request by executing a dry-run which would not + * alter the resource in any way. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource project name of the AppConnection location using the + * form: `projects/{project_id}/locations/{location_id}` + * @type string $app_connection_id + * Optional. User-settable AppConnection resource ID. + * * Must start with a letter. + * * Must contain between 4-63 characters from `/[a-z][0-9]-/`. + * * Must end with a number or a letter. + * @type \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection $app_connection + * Required. A BeyondCorp AppConnection resource. + * @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 t + * he 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). + * @type bool $validate_only + * Optional. If set, validates request by executing a dry-run which would not + * alter the resource in any way. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Beyondcorp\Appconnections\V1\AppConnectionsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource project name of the AppConnection location using the + * form: `projects/{project_id}/locations/{location_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource project name of the AppConnection location using the + * form: `projects/{project_id}/locations/{location_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. User-settable AppConnection resource ID. + * * Must start with a letter. + * * Must contain between 4-63 characters from `/[a-z][0-9]-/`. + * * Must end with a number or a letter. + * + * Generated from protobuf field string app_connection_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getAppConnectionId() + { + return $this->app_connection_id; + } + + /** + * Optional. User-settable AppConnection resource ID. + * * Must start with a letter. + * * Must contain between 4-63 characters from `/[a-z][0-9]-/`. + * * Must end with a number or a letter. + * + * Generated from protobuf field string app_connection_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setAppConnectionId($var) + { + GPBUtil::checkString($var, True); + $this->app_connection_id = $var; + + return $this; + } + + /** + * Required. A BeyondCorp AppConnection resource. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection app_connection = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection|null + */ + public function getAppConnection() + { + return $this->app_connection; + } + + public function hasAppConnection() + { + return isset($this->app_connection); + } + + public function clearAppConnection() + { + unset($this->app_connection); + } + + /** + * Required. A BeyondCorp AppConnection resource. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection app_connection = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection $var + * @return $this + */ + public function setAppConnection($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection::class); + $this->app_connection = $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 t + * he 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]; + * @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 t + * he 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]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, validates request by executing a dry-run which would not + * alter the resource in any way. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, validates request by executing a dry-run which would not + * alter the resource in any way. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/BeyondCorpAppConnections/src/V1/DeleteAppConnectionRequest.php b/BeyondCorpAppConnections/src/V1/DeleteAppConnectionRequest.php new file mode 100644 index 000000000000..53968baa6866 --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/DeleteAppConnectionRequest.php @@ -0,0 +1,183 @@ +google.cloud.beyondcorp.appconnections.v1.DeleteAppConnectionRequest + */ +class DeleteAppConnectionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. BeyondCorp Connector name using the form: + * `projects/{project_id}/locations/{location_id}/appConnections/{app_connection_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $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 t + * he 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]; + */ + private $request_id = ''; + /** + * Optional. If set, validates request by executing a dry-run which would not + * alter the resource in any way. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. BeyondCorp Connector name using the form: + * `projects/{project_id}/locations/{location_id}/appConnections/{app_connection_id}` + * @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 t + * he 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). + * @type bool $validate_only + * Optional. If set, validates request by executing a dry-run which would not + * alter the resource in any way. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Beyondcorp\Appconnections\V1\AppConnectionsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. BeyondCorp Connector name using the form: + * `projects/{project_id}/locations/{location_id}/appConnections/{app_connection_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. BeyondCorp Connector name using the form: + * `projects/{project_id}/locations/{location_id}/appConnections/{app_connection_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * 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 t + * he 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]; + * @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 t + * he 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]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, validates request by executing a dry-run which would not + * alter the resource in any way. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, validates request by executing a dry-run which would not + * alter the resource in any way. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/BeyondCorpAppConnections/src/V1/Gapic/AppConnectionsServiceGapicClient.php b/BeyondCorpAppConnections/src/V1/Gapic/AppConnectionsServiceGapicClient.php new file mode 100644 index 000000000000..4d32c6aef811 --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/Gapic/AppConnectionsServiceGapicClient.php @@ -0,0 +1,1335 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $appConnection = new AppConnection(); + * $operationResponse = $appConnectionsServiceClient->createAppConnection($formattedParent, $appConnection); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $appConnectionsServiceClient->createAppConnection($formattedParent, $appConnection); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $appConnectionsServiceClient->resumeOperation($operationName, 'createAppConnection'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $appConnectionsServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class AppConnectionsServiceGapicClient +{ + use GapicClientTrait; + + /** + * The name of the service. + */ + const SERVICE_NAME = 'google.cloud.beyondcorp.appconnections.v1.AppConnectionsService'; + + /** + * The default address of the service. + */ + const SERVICE_ADDRESS = 'beyondcorp.googleapis.com'; + + /** + * The default port of the service. + */ + const DEFAULT_SERVICE_PORT = 443; + + /** + * The name of the code generator, to be included in the agent header. + */ + const CODEGEN_NAME = 'gapic'; + + /** + * The default scopes required by the service. + */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $appConnectionNameTemplate; + + private static $appConnectorNameTemplate; + + private static $locationNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => + self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => + __DIR__ . + '/../resources/app_connections_service_client_config.json', + 'descriptorsConfigPath' => + __DIR__ . + '/../resources/app_connections_service_descriptor_config.php', + 'gcpApiConfigPath' => + __DIR__ . + '/../resources/app_connections_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => + __DIR__ . + '/../resources/app_connections_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getAppConnectionNameTemplate() + { + if (self::$appConnectionNameTemplate == null) { + self::$appConnectionNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}/appConnections/{app_connection}' + ); + } + + return self::$appConnectionNameTemplate; + } + + private static function getAppConnectorNameTemplate() + { + if (self::$appConnectorNameTemplate == null) { + self::$appConnectorNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}/appConnectors/{app_connector}' + ); + } + + return self::$appConnectorNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}' + ); + } + + return self::$locationNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'appConnection' => self::getAppConnectionNameTemplate(), + 'appConnector' => self::getAppConnectorNameTemplate(), + 'location' => self::getLocationNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * app_connection resource. + * + * @param string $project + * @param string $location + * @param string $appConnection + * + * @return string The formatted app_connection resource. + */ + public static function appConnectionName( + $project, + $location, + $appConnection + ) { + return self::getAppConnectionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'app_connection' => $appConnection, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * app_connector resource. + * + * @param string $project + * @param string $location + * @param string $appConnector + * + * @return string The formatted app_connector resource. + */ + public static function appConnectorName($project, $location, $appConnector) + { + return self::getAppConnectorNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'app_connector' => $appConnector, + ]); + } + + /** + * 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($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - appConnection: projects/{project}/locations/{location}/appConnections/{app_connection} + * - appConnector: projects/{project}/locations/{location}/appConnectors/{app_connector} + * - location: projects/{project}/locations/{location} + * + * 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($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException( + "Template name $template does not exist" + ); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException( + "Input did not match any known format. Input: $formattedName" + ); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; + $operation = new OperationResponse( + $operationName, + $this->getOperationsClient(), + $options + ); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $serviceAddress + * **Deprecated**. This option will be removed in a future major release. Please + * utilize the `$apiEndpoint` option instead. + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'beyondcorp.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 + * $serviceAddress 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. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Creates a new AppConnection in a given project and location. + * + * Sample code: + * ``` + * $appConnectionsServiceClient = new AppConnectionsServiceClient(); + * try { + * $formattedParent = $appConnectionsServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $appConnection = new AppConnection(); + * $operationResponse = $appConnectionsServiceClient->createAppConnection($formattedParent, $appConnection); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $appConnectionsServiceClient->createAppConnection($formattedParent, $appConnection); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $appConnectionsServiceClient->resumeOperation($operationName, 'createAppConnection'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $appConnectionsServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource project name of the AppConnection location using the + * form: `projects/{project_id}/locations/{location_id}` + * @param AppConnection $appConnection Required. A BeyondCorp AppConnection resource. + * @param array $optionalArgs { + * Optional. + * + * @type string $appConnectionId + * Optional. User-settable AppConnection resource ID. + * * Must start with a letter. + * * Must contain between 4-63 characters from `/[a-z][0-9]-/`. + * * Must end with a number or a letter. + * @type string $requestId + * 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 t + * he 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). + * @type bool $validateOnly + * Optional. If set, validates request by executing a dry-run which would not + * alter the resource in any way. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createAppConnection( + $parent, + $appConnection, + array $optionalArgs = [] + ) { + $request = new CreateAppConnectionRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setAppConnection($appConnection); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['appConnectionId'])) { + $request->setAppConnectionId($optionalArgs['appConnectionId']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'CreateAppConnection', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Deletes a single AppConnection. + * + * Sample code: + * ``` + * $appConnectionsServiceClient = new AppConnectionsServiceClient(); + * try { + * $formattedName = $appConnectionsServiceClient->appConnectionName('[PROJECT]', '[LOCATION]', '[APP_CONNECTION]'); + * $operationResponse = $appConnectionsServiceClient->deleteAppConnection($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $appConnectionsServiceClient->deleteAppConnection($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $appConnectionsServiceClient->resumeOperation($operationName, 'deleteAppConnection'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $appConnectionsServiceClient->close(); + * } + * ``` + * + * @param string $name Required. BeyondCorp Connector name using the form: + * `projects/{project_id}/locations/{location_id}/appConnections/{app_connection_id}` + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * 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 t + * he 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). + * @type bool $validateOnly + * Optional. If set, validates request by executing a dry-run which would not + * alter the resource in any way. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteAppConnection($name, array $optionalArgs = []) + { + $request = new DeleteAppConnectionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'DeleteAppConnection', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Gets details of a single AppConnection. + * + * Sample code: + * ``` + * $appConnectionsServiceClient = new AppConnectionsServiceClient(); + * try { + * $formattedName = $appConnectionsServiceClient->appConnectionName('[PROJECT]', '[LOCATION]', '[APP_CONNECTION]'); + * $response = $appConnectionsServiceClient->getAppConnection($formattedName); + * } finally { + * $appConnectionsServiceClient->close(); + * } + * ``` + * + * @param string $name Required. BeyondCorp AppConnection name using the form: + * `projects/{project_id}/locations/{location_id}/appConnections/{app_connection_id}` + * @param array $optionalArgs { + * 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 \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection + * + * @throws ApiException if the remote call fails + */ + public function getAppConnection($name, array $optionalArgs = []) + { + $request = new GetAppConnectionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'GetAppConnection', + AppConnection::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Lists AppConnections in a given project and location. + * + * Sample code: + * ``` + * $appConnectionsServiceClient = new AppConnectionsServiceClient(); + * try { + * $formattedParent = $appConnectionsServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $appConnectionsServiceClient->listAppConnections($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $appConnectionsServiceClient->listAppConnections($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $appConnectionsServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the AppConnection location using the form: + * `projects/{project_id}/locations/{location_id}` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. A filter specifying constraints of a list operation. + * @type string $orderBy + * Optional. Specifies the ordering of results. See + * [Sorting + * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listAppConnections($parent, array $optionalArgs = []) + { + $request = new ListAppConnectionsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( + 'ListAppConnections', + $optionalArgs, + ListAppConnectionsResponse::class, + $request + ); + } + + /** + * Resolves AppConnections details for a given AppConnector. + * An internal method called by a connector to find AppConnections to connect + * to. + * + * Sample code: + * ``` + * $appConnectionsServiceClient = new AppConnectionsServiceClient(); + * try { + * $formattedParent = $appConnectionsServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $formattedAppConnectorId = $appConnectionsServiceClient->appConnectorName('[PROJECT]', '[LOCATION]', '[APP_CONNECTOR]'); + * // Iterate over pages of elements + * $pagedResponse = $appConnectionsServiceClient->resolveAppConnections($formattedParent, $formattedAppConnectorId); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $appConnectionsServiceClient->resolveAppConnections($formattedParent, $formattedAppConnectorId); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $appConnectionsServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the AppConnection location using the form: + * `projects/{project_id}/locations/{location_id}` + * @param string $appConnectorId Required. BeyondCorp Connector name of the connector associated with those + * AppConnections using the form: + * `projects/{project_id}/locations/{location_id}/appConnectors/{app_connector_id}` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type 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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function resolveAppConnections( + $parent, + $appConnectorId, + array $optionalArgs = [] + ) { + $request = new ResolveAppConnectionsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setAppConnectorId($appConnectorId); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( + 'ResolveAppConnections', + $optionalArgs, + ResolveAppConnectionsResponse::class, + $request + ); + } + + /** + * Updates the parameters of a single AppConnection. + * + * Sample code: + * ``` + * $appConnectionsServiceClient = new AppConnectionsServiceClient(); + * try { + * $updateMask = new FieldMask(); + * $appConnection = new AppConnection(); + * $operationResponse = $appConnectionsServiceClient->updateAppConnection($updateMask, $appConnection); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $appConnectionsServiceClient->updateAppConnection($updateMask, $appConnection); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $appConnectionsServiceClient->resumeOperation($operationName, 'updateAppConnection'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $appConnectionsServiceClient->close(); + * } + * ``` + * + * @param FieldMask $updateMask Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field may only include these + * fields from [BeyondCorp.AppConnection]: + * * `labels` + * * `display_name` + * * `application_endpoint` + * * `connectors` + * @param AppConnection $appConnection Required. AppConnection message with updated fields. Only supported fields + * specified in update_mask are updated. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * 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 t + * he 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). + * @type bool $validateOnly + * Optional. If set, validates request by executing a dry-run which would not + * alter the resource in any way. + * @type bool $allowMissing + * Optional. If set as true, will create the resource if it is not found. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateAppConnection( + $updateMask, + $appConnection, + array $optionalArgs = [] + ) { + $request = new UpdateAppConnectionRequest(); + $requestParamHeaders = []; + $request->setUpdateMask($updateMask); + $request->setAppConnection($appConnection); + $requestParamHeaders['app_connection.name'] = $appConnection->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'UpdateAppConnection', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $appConnectionsServiceClient = new AppConnectionsServiceClient(); + * try { + * $response = $appConnectionsServiceClient->getLocation(); + * } finally { + * $appConnectionsServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @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 \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'GetLocation', + Location::class, + $optionalArgs, + $request, + Call::UNARY_CALL, + 'google.cloud.location.Locations' + )->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $appConnectionsServiceClient = new AppConnectionsServiceClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $appConnectionsServiceClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $appConnectionsServiceClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $appConnectionsServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type 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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( + 'ListLocations', + $optionalArgs, + ListLocationsResponse::class, + $request, + 'google.cloud.location.Locations' + ); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * Sample code: + * ``` + * $appConnectionsServiceClient = new AppConnectionsServiceClient(); + * try { + * $resource = 'resource'; + * $response = $appConnectionsServiceClient->getIamPolicy($resource); + * } finally { + * $appConnectionsServiceClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @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 \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'GetIamPolicy', + Policy::class, + $optionalArgs, + $request, + Call::UNARY_CALL, + 'google.iam.v1.IAMPolicy' + )->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * Sample code: + * ``` + * $appConnectionsServiceClient = new AppConnectionsServiceClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $appConnectionsServiceClient->setIamPolicy($resource, $policy); + * } finally { + * $appConnectionsServiceClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @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 \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'SetIamPolicy', + Policy::class, + $optionalArgs, + $request, + Call::UNARY_CALL, + 'google.iam.v1.IAMPolicy' + )->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * Sample code: + * ``` + * $appConnectionsServiceClient = new AppConnectionsServiceClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $appConnectionsServiceClient->testIamPermissions($resource, $permissions); + * } finally { + * $appConnectionsServiceClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + */ + public function testIamPermissions( + $resource, + $permissions, + array $optionalArgs = [] + ) { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'TestIamPermissions', + TestIamPermissionsResponse::class, + $optionalArgs, + $request, + Call::UNARY_CALL, + 'google.iam.v1.IAMPolicy' + )->wait(); + } +} diff --git a/BeyondCorpAppConnections/src/V1/GetAppConnectionRequest.php b/BeyondCorpAppConnections/src/V1/GetAppConnectionRequest.php new file mode 100644 index 000000000000..9cddaa58b7a5 --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/GetAppConnectionRequest.php @@ -0,0 +1,71 @@ +google.cloud.beyondcorp.appconnections.v1.GetAppConnectionRequest + */ +class GetAppConnectionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. BeyondCorp AppConnection name using the form: + * `projects/{project_id}/locations/{location_id}/appConnections/{app_connection_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. BeyondCorp AppConnection name using the form: + * `projects/{project_id}/locations/{location_id}/appConnections/{app_connection_id}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Beyondcorp\Appconnections\V1\AppConnectionsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. BeyondCorp AppConnection name using the form: + * `projects/{project_id}/locations/{location_id}/appConnections/{app_connection_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. BeyondCorp AppConnection name using the form: + * `projects/{project_id}/locations/{location_id}/appConnections/{app_connection_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/BeyondCorpAppConnections/src/V1/ListAppConnectionsRequest.php b/BeyondCorpAppConnections/src/V1/ListAppConnectionsRequest.php new file mode 100644 index 000000000000..0a8b6c8afd4d --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/ListAppConnectionsRequest.php @@ -0,0 +1,243 @@ +google.cloud.beyondcorp.appconnections.v1.ListAppConnectionsRequest + */ +class ListAppConnectionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the AppConnection location using the form: + * `projects/{project_id}/locations/{location_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * Optional. The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the page_size value, the response may include a partial list + * and a caller should only rely on response's + * [next_page_token][BeyondCorp.ListAppConnectionsResponse.next_page_token] to + * determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $page_size = 0; + /** + * Optional. The next_page_token value returned from a previous + * ListAppConnectionsRequest, if any. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $page_token = ''; + /** + * Optional. A filter specifying constraints of a list operation. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $filter = ''; + /** + * Optional. Specifies the ordering of results. See + * [Sorting + * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the AppConnection location using the form: + * `projects/{project_id}/locations/{location_id}` + * @type int $page_size + * Optional. The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the page_size value, the response may include a partial list + * and a caller should only rely on response's + * [next_page_token][BeyondCorp.ListAppConnectionsResponse.next_page_token] to + * determine if there are more instances left to be queried. + * @type string $page_token + * Optional. The next_page_token value returned from a previous + * ListAppConnectionsRequest, if any. + * @type string $filter + * Optional. A filter specifying constraints of a list operation. + * @type string $order_by + * Optional. Specifies the ordering of results. See + * [Sorting + * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Beyondcorp\Appconnections\V1\AppConnectionsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the AppConnection location using the form: + * `projects/{project_id}/locations/{location_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the AppConnection location using the form: + * `projects/{project_id}/locations/{location_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the page_size value, the response may include a partial list + * and a caller should only rely on response's + * [next_page_token][BeyondCorp.ListAppConnectionsResponse.next_page_token] to + * determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the page_size value, the response may include a partial list + * and a caller should only rely on response's + * [next_page_token][BeyondCorp.ListAppConnectionsResponse.next_page_token] to + * determine if there are more instances left to be queried. + * + * 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. The next_page_token value returned from a previous + * ListAppConnectionsRequest, if any. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. The next_page_token value returned from a previous + * ListAppConnectionsRequest, if any. + * + * 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. A filter specifying constraints of a list operation. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. A filter specifying constraints of a list operation. + * + * 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. Specifies the ordering of results. See + * [Sorting + * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Specifies the ordering of results. See + * [Sorting + * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + * + * 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/BeyondCorpAppConnections/src/V1/ListAppConnectionsResponse.php b/BeyondCorpAppConnections/src/V1/ListAppConnectionsResponse.php new file mode 100644 index 000000000000..b8315ede459a --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/ListAppConnectionsResponse.php @@ -0,0 +1,139 @@ +google.cloud.beyondcorp.appconnections.v1.ListAppConnectionsResponse + */ +class ListAppConnectionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of BeyondCorp AppConnections in the project. + * + * Generated from protobuf field repeated .google.cloud.beyondcorp.appconnections.v1.AppConnection app_connections = 1; + */ + private $app_connections; + /** + * A token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + private $next_page_token = ''; + /** + * A list of locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection>|\Google\Protobuf\Internal\RepeatedField $app_connections + * A list of BeyondCorp AppConnections in the project. + * @type string $next_page_token + * A token to retrieve the next page of results, or empty if there are no more + * results in the list. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * A list of locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Beyondcorp\Appconnections\V1\AppConnectionsService::initOnce(); + parent::__construct($data); + } + + /** + * A list of BeyondCorp AppConnections in the project. + * + * Generated from protobuf field repeated .google.cloud.beyondcorp.appconnections.v1.AppConnection app_connections = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAppConnections() + { + return $this->app_connections; + } + + /** + * A list of BeyondCorp AppConnections in the project. + * + * Generated from protobuf field repeated .google.cloud.beyondcorp.appconnections.v1.AppConnection app_connections = 1; + * @param array<\Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAppConnections($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection::class); + $this->app_connections = $arr; + + return $this; + } + + /** + * A token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * 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; + } + + /** + * A list of locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * A list of locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @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/BeyondCorpAppConnections/src/V1/ResolveAppConnectionsRequest.php b/BeyondCorpAppConnections/src/V1/ResolveAppConnectionsRequest.php new file mode 100644 index 000000000000..41ad987df0c1 --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/ResolveAppConnectionsRequest.php @@ -0,0 +1,205 @@ +google.cloud.beyondcorp.appconnections.v1.ResolveAppConnectionsRequest + */ +class ResolveAppConnectionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the AppConnection location using the form: + * `projects/{project_id}/locations/{location_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * Required. BeyondCorp Connector name of the connector associated with those + * AppConnections using the form: + * `projects/{project_id}/locations/{location_id}/appConnectors/{app_connector_id}` + * + * Generated from protobuf field string app_connector_id = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $app_connector_id = ''; + /** + * Optional. The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the page_size value, the response may include a partial list + * and a caller should only rely on response's + * [next_page_token][BeyondCorp.ResolveAppConnectionsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $page_size = 0; + /** + * Optional. The next_page_token value returned from a previous + * ResolveAppConnectionsResponse, if any. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the AppConnection location using the form: + * `projects/{project_id}/locations/{location_id}` + * @type string $app_connector_id + * Required. BeyondCorp Connector name of the connector associated with those + * AppConnections using the form: + * `projects/{project_id}/locations/{location_id}/appConnectors/{app_connector_id}` + * @type int $page_size + * Optional. The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the page_size value, the response may include a partial list + * and a caller should only rely on response's + * [next_page_token][BeyondCorp.ResolveAppConnectionsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * @type string $page_token + * Optional. The next_page_token value returned from a previous + * ResolveAppConnectionsResponse, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Beyondcorp\Appconnections\V1\AppConnectionsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the AppConnection location using the form: + * `projects/{project_id}/locations/{location_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the AppConnection location using the form: + * `projects/{project_id}/locations/{location_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. BeyondCorp Connector name of the connector associated with those + * AppConnections using the form: + * `projects/{project_id}/locations/{location_id}/appConnectors/{app_connector_id}` + * + * Generated from protobuf field string app_connector_id = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getAppConnectorId() + { + return $this->app_connector_id; + } + + /** + * Required. BeyondCorp Connector name of the connector associated with those + * AppConnections using the form: + * `projects/{project_id}/locations/{location_id}/appConnectors/{app_connector_id}` + * + * Generated from protobuf field string app_connector_id = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAppConnectorId($var) + { + GPBUtil::checkString($var, True); + $this->app_connector_id = $var; + + return $this; + } + + /** + * Optional. The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the page_size value, the response may include a partial list + * and a caller should only rely on response's + * [next_page_token][BeyondCorp.ResolveAppConnectionsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of items to return. + * If not specified, a default value of 50 will be used by the service. + * Regardless of the page_size value, the response may include a partial list + * and a caller should only rely on response's + * [next_page_token][BeyondCorp.ResolveAppConnectionsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. The next_page_token value returned from a previous + * ResolveAppConnectionsResponse, if any. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. The next_page_token value returned from a previous + * ResolveAppConnectionsResponse, if any. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/BeyondCorpAppConnections/src/V1/ResolveAppConnectionsResponse.php b/BeyondCorpAppConnections/src/V1/ResolveAppConnectionsResponse.php new file mode 100644 index 000000000000..182173c98a94 --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/ResolveAppConnectionsResponse.php @@ -0,0 +1,139 @@ +google.cloud.beyondcorp.appconnections.v1.ResolveAppConnectionsResponse + */ +class ResolveAppConnectionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of BeyondCorp AppConnections with details in the project. + * + * Generated from protobuf field repeated .google.cloud.beyondcorp.appconnections.v1.ResolveAppConnectionsResponse.AppConnectionDetails app_connection_details = 1; + */ + private $app_connection_details; + /** + * A token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + private $next_page_token = ''; + /** + * A list of locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\BeyondCorp\AppConnections\V1\ResolveAppConnectionsResponse\AppConnectionDetails>|\Google\Protobuf\Internal\RepeatedField $app_connection_details + * A list of BeyondCorp AppConnections with details in the project. + * @type string $next_page_token + * A token to retrieve the next page of results, or empty if there are no more + * results in the list. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * A list of locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Beyondcorp\Appconnections\V1\AppConnectionsService::initOnce(); + parent::__construct($data); + } + + /** + * A list of BeyondCorp AppConnections with details in the project. + * + * Generated from protobuf field repeated .google.cloud.beyondcorp.appconnections.v1.ResolveAppConnectionsResponse.AppConnectionDetails app_connection_details = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAppConnectionDetails() + { + return $this->app_connection_details; + } + + /** + * A list of BeyondCorp AppConnections with details in the project. + * + * Generated from protobuf field repeated .google.cloud.beyondcorp.appconnections.v1.ResolveAppConnectionsResponse.AppConnectionDetails app_connection_details = 1; + * @param array<\Google\Cloud\BeyondCorp\AppConnections\V1\ResolveAppConnectionsResponse\AppConnectionDetails>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAppConnectionDetails($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\BeyondCorp\AppConnections\V1\ResolveAppConnectionsResponse\AppConnectionDetails::class); + $this->app_connection_details = $arr; + + return $this; + } + + /** + * A token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * 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; + } + + /** + * A list of locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * A list of locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @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/BeyondCorpAppConnections/src/V1/ResolveAppConnectionsResponse/AppConnectionDetails.php b/BeyondCorpAppConnections/src/V1/ResolveAppConnectionsResponse/AppConnectionDetails.php new file mode 100644 index 000000000000..245242540e17 --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/ResolveAppConnectionsResponse/AppConnectionDetails.php @@ -0,0 +1,116 @@ +google.cloud.beyondcorp.appconnections.v1.ResolveAppConnectionsResponse.AppConnectionDetails + */ +class AppConnectionDetails extends \Google\Protobuf\Internal\Message +{ + /** + * A BeyondCorp AppConnection in the project. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection app_connection = 1; + */ + private $app_connection = null; + /** + * If type=GCP_REGIONAL_MIG, contains most recent VM instances, like + * `https://www.googleapis.com/compute/v1/projects/{project_id}/zones/{zone_id}/instances/{instance_id}`. + * + * Generated from protobuf field repeated string recent_mig_vms = 2; + */ + private $recent_mig_vms; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection $app_connection + * A BeyondCorp AppConnection in the project. + * @type array|\Google\Protobuf\Internal\RepeatedField $recent_mig_vms + * If type=GCP_REGIONAL_MIG, contains most recent VM instances, like + * `https://www.googleapis.com/compute/v1/projects/{project_id}/zones/{zone_id}/instances/{instance_id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Beyondcorp\Appconnections\V1\AppConnectionsService::initOnce(); + parent::__construct($data); + } + + /** + * A BeyondCorp AppConnection in the project. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection app_connection = 1; + * @return \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection|null + */ + public function getAppConnection() + { + return $this->app_connection; + } + + public function hasAppConnection() + { + return isset($this->app_connection); + } + + public function clearAppConnection() + { + unset($this->app_connection); + } + + /** + * A BeyondCorp AppConnection in the project. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection app_connection = 1; + * @param \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection $var + * @return $this + */ + public function setAppConnection($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection::class); + $this->app_connection = $var; + + return $this; + } + + /** + * If type=GCP_REGIONAL_MIG, contains most recent VM instances, like + * `https://www.googleapis.com/compute/v1/projects/{project_id}/zones/{zone_id}/instances/{instance_id}`. + * + * Generated from protobuf field repeated string recent_mig_vms = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRecentMigVms() + { + return $this->recent_mig_vms; + } + + /** + * If type=GCP_REGIONAL_MIG, contains most recent VM instances, like + * `https://www.googleapis.com/compute/v1/projects/{project_id}/zones/{zone_id}/instances/{instance_id}`. + * + * Generated from protobuf field repeated string recent_mig_vms = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRecentMigVms($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->recent_mig_vms = $arr; + + return $this; + } + +} + + diff --git a/BeyondCorpAppConnections/src/V1/UpdateAppConnectionRequest.php b/BeyondCorpAppConnections/src/V1/UpdateAppConnectionRequest.php new file mode 100644 index 000000000000..eb410fb636d9 --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/UpdateAppConnectionRequest.php @@ -0,0 +1,295 @@ +google.cloud.beyondcorp.appconnections.v1.UpdateAppConnectionRequest + */ +class UpdateAppConnectionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field may only include these + * fields from [BeyondCorp.AppConnection]: + * * `labels` + * * `display_name` + * * `application_endpoint` + * * `connectors` + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $update_mask = null; + /** + * Required. AppConnection message with updated fields. Only supported fields + * specified in update_mask are updated. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection app_connection = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $app_connection = 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 t + * he 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]; + */ + private $request_id = ''; + /** + * Optional. If set, validates request by executing a dry-run which would not + * alter the resource in any way. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $validate_only = false; + /** + * Optional. If set as true, will create the resource if it is not found. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $allow_missing = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field may only include these + * fields from [BeyondCorp.AppConnection]: + * * `labels` + * * `display_name` + * * `application_endpoint` + * * `connectors` + * @type \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection $app_connection + * Required. AppConnection message with updated fields. Only supported fields + * specified in update_mask are 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 t + * he 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). + * @type bool $validate_only + * Optional. If set, validates request by executing a dry-run which would not + * alter the resource in any way. + * @type bool $allow_missing + * Optional. If set as true, will create the resource if it is not found. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Beyondcorp\Appconnections\V1\AppConnectionsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field may only include these + * fields from [BeyondCorp.AppConnection]: + * * `labels` + * * `display_name` + * * `application_endpoint` + * * `connectors` + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @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); + } + + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. The elements of the repeated paths field may only include these + * fields from [BeyondCorp.AppConnection]: + * * `labels` + * * `display_name` + * * `application_endpoint` + * * `connectors` + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. AppConnection message with updated fields. Only supported fields + * specified in update_mask are updated. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection app_connection = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection|null + */ + public function getAppConnection() + { + return $this->app_connection; + } + + public function hasAppConnection() + { + return isset($this->app_connection); + } + + public function clearAppConnection() + { + unset($this->app_connection); + } + + /** + * Required. AppConnection message with updated fields. Only supported fields + * specified in update_mask are updated. + * + * Generated from protobuf field .google.cloud.beyondcorp.appconnections.v1.AppConnection app_connection = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection $var + * @return $this + */ + public function setAppConnection($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection::class); + $this->app_connection = $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 t + * he 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]; + * @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 t + * he 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]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, validates request by executing a dry-run which would not + * alter the resource in any way. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, validates request by executing a dry-run which would not + * alter the resource in any way. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. If set as true, will create the resource if it is not found. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * Optional. If set as true, will create the resource if it is not found. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + +} + diff --git a/BeyondCorpAppConnections/src/V1/gapic_metadata.json b/BeyondCorpAppConnections/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..68ef8018f5ae --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/gapic_metadata.json @@ -0,0 +1,73 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.beyondcorp.appconnections.v1", + "libraryPackage": "Google\\Cloud\\BeyondCorp\\AppConnections\\V1", + "services": { + "AppConnectionsService": { + "clients": { + "grpc": { + "libraryClient": "AppConnectionsServiceGapicClient", + "rpcs": { + "CreateAppConnection": { + "methods": [ + "createAppConnection" + ] + }, + "DeleteAppConnection": { + "methods": [ + "deleteAppConnection" + ] + }, + "GetAppConnection": { + "methods": [ + "getAppConnection" + ] + }, + "ListAppConnections": { + "methods": [ + "listAppConnections" + ] + }, + "ResolveAppConnections": { + "methods": [ + "resolveAppConnections" + ] + }, + "UpdateAppConnection": { + "methods": [ + "updateAppConnection" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/BeyondCorpAppConnections/src/V1/resources/app_connections_service_client_config.json b/BeyondCorpAppConnections/src/V1/resources/app_connections_service_client_config.json new file mode 100644 index 000000000000..96222a9ebc4f --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/resources/app_connections_service_client_config.json @@ -0,0 +1,77 @@ +{ + "interfaces": { + "google.cloud.beyondcorp.appconnections.v1.AppConnectionsService": { + "retry_codes": { + "no_retry_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 + } + }, + "methods": { + "CreateAppConnection": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "DeleteAppConnection": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetAppConnection": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListAppConnections": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ResolveAppConnections": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "UpdateAppConnection": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_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" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/BeyondCorpAppConnections/src/V1/resources/app_connections_service_descriptor_config.php b/BeyondCorpAppConnections/src/V1/resources/app_connections_service_descriptor_config.php new file mode 100644 index 000000000000..826cb720847b --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/resources/app_connections_service_descriptor_config.php @@ -0,0 +1,68 @@ + [ + 'google.cloud.beyondcorp.appconnections.v1.AppConnectionsService' => [ + 'CreateAppConnection' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection', + 'metadataReturnType' => '\Google\Cloud\BeyondCorp\AppConnections\V1\AppConnectionOperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteAppConnection' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\BeyondCorp\AppConnections\V1\AppConnectionOperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateAppConnection' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\BeyondCorp\AppConnections\V1\AppConnection', + 'metadataReturnType' => '\Google\Cloud\BeyondCorp\AppConnections\V1\AppConnectionOperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ListAppConnections' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAppConnections', + ], + ], + 'ResolveAppConnections' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAppConnectionDetails', + ], + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + ], + ], + ], +]; diff --git a/BeyondCorpAppConnections/src/V1/resources/app_connections_service_rest_client_config.php b/BeyondCorpAppConnections/src/V1/resources/app_connections_service_rest_client_config.php new file mode 100644 index 000000000000..57f0439ac76d --- /dev/null +++ b/BeyondCorpAppConnections/src/V1/resources/app_connections_service_rest_client_config.php @@ -0,0 +1,250 @@ + [ + 'google.cloud.beyondcorp.appconnections.v1.AppConnectionsService' => [ + 'CreateAppConnection' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/appConnections', + 'body' => 'app_connection', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteAppConnection' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/appConnections/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetAppConnection' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/appConnections/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListAppConnections' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/appConnections', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ResolveAppConnections' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/appConnections:resolve', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateAppConnection' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{app_connection.name=projects/*/locations/*/appConnections/*}', + 'body' => 'app_connection', + 'placeholders' => [ + 'app_connection.name' => [ + 'getters' => [ + 'getAppConnection', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + ], + '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.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/appConnections/*}:getIamPolicy', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/appConnectors/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/appGateways/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/clientConnectorServices/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/clientGateways/*}:getIamPolicy', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/appConnections/*}:setIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/appConnectors/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/appGateways/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/clientConnectorServices/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/clientGateways/*}:setIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/appConnections/*}:testIamPermissions', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/appConnectors/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/appGateways/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/clientConnectorServices/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/clientGateways/*}:testIamPermissions', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], +]; diff --git a/BeyondCorpAppConnections/tests/Unit/V1/AppConnectionsServiceClientTest.php b/BeyondCorpAppConnections/tests/Unit/V1/AppConnectionsServiceClientTest.php new file mode 100644 index 000000000000..4b369c42106e --- /dev/null +++ b/BeyondCorpAppConnections/tests/Unit/V1/AppConnectionsServiceClientTest.php @@ -0,0 +1,1054 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** + * @return AppConnectionsServiceClient + */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new AppConnectionsServiceClient($options); + } + + /** + * @test + */ + public function createAppConnectionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'serviceAddress' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createAppConnectionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $expectedResponse = new AppConnection(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAppConnectionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $appConnection = new AppConnection(); + $appConnectionName = 'appConnectionName-1608104182'; + $appConnection->setName($appConnectionName); + $appConnectionType = Type::TYPE_UNSPECIFIED; + $appConnection->setType($appConnectionType); + $appConnectionApplicationEndpoint = new ApplicationEndpoint(); + $applicationEndpointHost = 'applicationEndpointHost1976079949'; + $appConnectionApplicationEndpoint->setHost($applicationEndpointHost); + $applicationEndpointPort = 1976318246; + $appConnectionApplicationEndpoint->setPort($applicationEndpointPort); + $appConnection->setApplicationEndpoint($appConnectionApplicationEndpoint); + $response = $gapicClient->createAppConnection($formattedParent, $appConnection); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.beyondcorp.appconnections.v1.AppConnectionsService/CreateAppConnection', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAppConnection(); + $this->assertProtobufEquals($appConnection, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAppConnectionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** + * @test + */ + public function createAppConnectionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'serviceAddress' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createAppConnectionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $appConnection = new AppConnection(); + $appConnectionName = 'appConnectionName-1608104182'; + $appConnection->setName($appConnectionName); + $appConnectionType = Type::TYPE_UNSPECIFIED; + $appConnection->setType($appConnectionType); + $appConnectionApplicationEndpoint = new ApplicationEndpoint(); + $applicationEndpointHost = 'applicationEndpointHost1976079949'; + $appConnectionApplicationEndpoint->setHost($applicationEndpointHost); + $applicationEndpointPort = 1976318246; + $appConnectionApplicationEndpoint->setPort($applicationEndpointPort); + $appConnection->setApplicationEndpoint($appConnectionApplicationEndpoint); + $response = $gapicClient->createAppConnection($formattedParent, $appConnection); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAppConnectionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** + * @test + */ + public function deleteAppConnectionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'serviceAddress' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteAppConnectionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteAppConnectionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->appConnectionName('[PROJECT]', '[LOCATION]', '[APP_CONNECTION]'); + $response = $gapicClient->deleteAppConnection($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.beyondcorp.appconnections.v1.AppConnectionsService/DeleteAppConnection', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAppConnectionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** + * @test + */ + public function deleteAppConnectionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'serviceAddress' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteAppConnectionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->appConnectionName('[PROJECT]', '[LOCATION]', '[APP_CONNECTION]'); + $response = $gapicClient->deleteAppConnection($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAppConnectionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** + * @test + */ + public function getAppConnectionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $expectedResponse = new AppConnection(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->appConnectionName('[PROJECT]', '[LOCATION]', '[APP_CONNECTION]'); + $response = $gapicClient->getAppConnection($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.beyondcorp.appconnections.v1.AppConnectionsService/GetAppConnection', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function getAppConnectionExceptionTest() + { + $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->appConnectionName('[PROJECT]', '[LOCATION]', '[APP_CONNECTION]'); + try { + $gapicClient->getAppConnection($formattedName); + // 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 listAppConnectionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $appConnectionsElement = new AppConnection(); + $appConnections = [ + $appConnectionsElement, + ]; + $expectedResponse = new ListAppConnectionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAppConnections($appConnections); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listAppConnections($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAppConnections()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.beyondcorp.appconnections.v1.AppConnectionsService/ListAppConnections', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function listAppConnectionsExceptionTest() + { + $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]'); + try { + $gapicClient->listAppConnections($formattedParent); + // 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 resolveAppConnectionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $appConnectionDetailsElement = new AppConnectionDetails(); + $appConnectionDetails = [ + $appConnectionDetailsElement, + ]; + $expectedResponse = new ResolveAppConnectionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAppConnectionDetails($appConnectionDetails); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $formattedAppConnectorId = $gapicClient->appConnectorName('[PROJECT]', '[LOCATION]', '[APP_CONNECTOR]'); + $response = $gapicClient->resolveAppConnections($formattedParent, $formattedAppConnectorId); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAppConnectionDetails()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.beyondcorp.appconnections.v1.AppConnectionsService/ResolveAppConnections', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getAppConnectorId(); + $this->assertProtobufEquals($formattedAppConnectorId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function resolveAppConnectionsExceptionTest() + { + $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]'); + $formattedAppConnectorId = $gapicClient->appConnectorName('[PROJECT]', '[LOCATION]', '[APP_CONNECTOR]'); + try { + $gapicClient->resolveAppConnections($formattedParent, $formattedAppConnectorId); + // 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 updateAppConnectionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'serviceAddress' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateAppConnectionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $expectedResponse = new AppConnection(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateAppConnectionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $appConnection = new AppConnection(); + $appConnectionName = 'appConnectionName-1608104182'; + $appConnection->setName($appConnectionName); + $appConnectionType = Type::TYPE_UNSPECIFIED; + $appConnection->setType($appConnectionType); + $appConnectionApplicationEndpoint = new ApplicationEndpoint(); + $applicationEndpointHost = 'applicationEndpointHost1976079949'; + $appConnectionApplicationEndpoint->setHost($applicationEndpointHost); + $applicationEndpointPort = 1976318246; + $appConnectionApplicationEndpoint->setPort($applicationEndpointPort); + $appConnection->setApplicationEndpoint($appConnectionApplicationEndpoint); + $response = $gapicClient->updateAppConnection($updateMask, $appConnection); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.beyondcorp.appconnections.v1.AppConnectionsService/UpdateAppConnection', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getAppConnection(); + $this->assertProtobufEquals($appConnection, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAppConnectionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** + * @test + */ + public function updateAppConnectionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'serviceAddress' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateAppConnectionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $updateMask = new FieldMask(); + $appConnection = new AppConnection(); + $appConnectionName = 'appConnectionName-1608104182'; + $appConnection->setName($appConnectionName); + $appConnectionType = Type::TYPE_UNSPECIFIED; + $appConnection->setType($appConnectionType); + $appConnectionApplicationEndpoint = new ApplicationEndpoint(); + $applicationEndpointHost = 'applicationEndpointHost1976079949'; + $appConnectionApplicationEndpoint->setHost($applicationEndpointHost); + $applicationEndpointPort = 1976318246; + $appConnectionApplicationEndpoint->setPort($applicationEndpointPort); + $appConnection->setApplicationEndpoint($appConnectionApplicationEndpoint); + $response = $gapicClient->updateAppConnection($updateMask, $appConnection); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAppConnectionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** + * @test + */ + public function 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); + $response = $gapicClient->getLocation(); + $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); + try { + $gapicClient->getLocation(); + // 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); + $response = $gapicClient->listLocations(); + $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); + try { + $gapicClient->listLocations(); + // 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 getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function getIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + try { + $gapicClient->getIamPolicy($resource); + // 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 setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $response = $gapicClient->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function setIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $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 + $resource = 'resource-341064690'; + $policy = new Policy(); + try { + $gapicClient->setIamPolicy($resource, $policy); + // 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 testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $response = $gapicClient->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function testIamPermissionsExceptionTest() + { + $transport = $this->createTransport(); + $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 + $resource = 'resource-341064690'; + $permissions = []; + try { + $gapicClient->testIamPermissions($resource, $permissions); + // 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()); + } +} diff --git a/docs/contents/cloud-beyondcorp-appconnections.json b/docs/contents/cloud-beyondcorp-appconnections.json new file mode 100644 index 000000000000..2d92a5b6687b --- /dev/null +++ b/docs/contents/cloud-beyondcorp-appconnections.json @@ -0,0 +1,11 @@ +{ + "title": "BeyondCorpAppConnections", + "defaultService": "beyondcorpappconnections\/readme", + "services": [ + { + "title": "Overview", + "type": "beyondcorpappconnections\/readme" + } + ], + "pattern": "beyondcorpappconnections\/\\w{1,}" +}