From 037846841d186199014aac43004aa395e9e6d3e2 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 6 Jun 2024 13:30:17 -0700 Subject: [PATCH] feat: introduce BackupDr (#7364) --- .repo-metadata-full.json | 8 + BackupDr/.OwlBot.yaml | 4 + BackupDr/.gitattributes | 7 + BackupDr/.github/pull_request_template.md | 24 + BackupDr/CONTRIBUTING.md | 10 + BackupDr/LICENSE | 202 ++++ BackupDr/README.md | 45 + BackupDr/VERSION | 1 + BackupDr/composer.json | 30 + BackupDr/metadata/V1/Backupdr.php | Bin 0 -> 5436 bytes BackupDr/owlbot.py | 62 ++ BackupDr/phpunit.xml.dist | 16 + .../create_management_server.php | 96 ++ .../delete_management_server.php | 84 ++ .../V1/BackupDRClient/get_iam_policy.php | 72 ++ .../V1/BackupDRClient/get_location.php | 57 ++ .../BackupDRClient/get_management_server.php | 76 ++ .../V1/BackupDRClient/list_locations.php | 62 ++ .../list_management_servers.php | 80 ++ .../V1/BackupDRClient/set_iam_policy.php | 77 ++ .../BackupDRClient/test_iam_permissions.php | 84 ++ BackupDr/src/V1/Client/BackupDRClient.php | 558 +++++++++++ .../src/V1/CreateManagementServerRequest.php | 257 +++++ .../src/V1/DeleteManagementServerRequest.php | 155 +++ .../src/V1/GetManagementServerRequest.php | 86 ++ .../src/V1/ListManagementServersRequest.php | 261 +++++ .../src/V1/ListManagementServersResponse.php | 159 +++ BackupDr/src/V1/ManagementServer.php | 611 ++++++++++++ .../src/V1/ManagementServer/InstanceState.php | 100 ++ .../src/V1/ManagementServer/InstanceType.php | 55 ++ BackupDr/src/V1/ManagementURI.php | 101 ++ BackupDr/src/V1/NetworkConfig.php | 109 +++ BackupDr/src/V1/NetworkConfig/PeeringMode.php | 57 ++ BackupDr/src/V1/OperationMetadata.php | 345 +++++++ .../WorkforceIdentityBasedManagementURI.php | 101 ++ .../WorkforceIdentityBasedOAuth2ClientID.php | 101 ++ BackupDr/src/V1/gapic_metadata.json | 63 ++ .../V1/resources/backup_dr_client_config.json | 89 ++ .../resources/backup_dr_descriptor_config.php | 175 ++++ .../backup_dr_rest_client_config.php | 192 ++++ .../Unit/V1/Client/BackupDRClientTest.php | 909 ++++++++++++++++++ composer.json | 3 + 42 files changed, 5584 insertions(+) create mode 100644 BackupDr/.OwlBot.yaml create mode 100644 BackupDr/.gitattributes create mode 100644 BackupDr/.github/pull_request_template.md create mode 100644 BackupDr/CONTRIBUTING.md create mode 100644 BackupDr/LICENSE create mode 100644 BackupDr/README.md create mode 100644 BackupDr/VERSION create mode 100644 BackupDr/composer.json create mode 100644 BackupDr/metadata/V1/Backupdr.php create mode 100644 BackupDr/owlbot.py create mode 100644 BackupDr/phpunit.xml.dist create mode 100644 BackupDr/samples/V1/BackupDRClient/create_management_server.php create mode 100644 BackupDr/samples/V1/BackupDRClient/delete_management_server.php create mode 100644 BackupDr/samples/V1/BackupDRClient/get_iam_policy.php create mode 100644 BackupDr/samples/V1/BackupDRClient/get_location.php create mode 100644 BackupDr/samples/V1/BackupDRClient/get_management_server.php create mode 100644 BackupDr/samples/V1/BackupDRClient/list_locations.php create mode 100644 BackupDr/samples/V1/BackupDRClient/list_management_servers.php create mode 100644 BackupDr/samples/V1/BackupDRClient/set_iam_policy.php create mode 100644 BackupDr/samples/V1/BackupDRClient/test_iam_permissions.php create mode 100644 BackupDr/src/V1/Client/BackupDRClient.php create mode 100644 BackupDr/src/V1/CreateManagementServerRequest.php create mode 100644 BackupDr/src/V1/DeleteManagementServerRequest.php create mode 100644 BackupDr/src/V1/GetManagementServerRequest.php create mode 100644 BackupDr/src/V1/ListManagementServersRequest.php create mode 100644 BackupDr/src/V1/ListManagementServersResponse.php create mode 100644 BackupDr/src/V1/ManagementServer.php create mode 100644 BackupDr/src/V1/ManagementServer/InstanceState.php create mode 100644 BackupDr/src/V1/ManagementServer/InstanceType.php create mode 100644 BackupDr/src/V1/ManagementURI.php create mode 100644 BackupDr/src/V1/NetworkConfig.php create mode 100644 BackupDr/src/V1/NetworkConfig/PeeringMode.php create mode 100644 BackupDr/src/V1/OperationMetadata.php create mode 100644 BackupDr/src/V1/WorkforceIdentityBasedManagementURI.php create mode 100644 BackupDr/src/V1/WorkforceIdentityBasedOAuth2ClientID.php create mode 100644 BackupDr/src/V1/gapic_metadata.json create mode 100644 BackupDr/src/V1/resources/backup_dr_client_config.json create mode 100644 BackupDr/src/V1/resources/backup_dr_descriptor_config.php create mode 100644 BackupDr/src/V1/resources/backup_dr_rest_client_config.php create mode 100644 BackupDr/tests/Unit/V1/Client/BackupDRClientTest.php diff --git a/.repo-metadata-full.json b/.repo-metadata-full.json index 1f614897ed59..7cf83b1a5e98 100644 --- a/.repo-metadata-full.json +++ b/.repo-metadata-full.json @@ -161,6 +161,14 @@ "library_type": "GAPIC_AUTO", "api_shortname": "automl" }, + "BackupDr": { + "language": "php", + "distribution_name": "google/cloud-backupdr", + "release_level": "preview", + "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-backupdr/latest", + "library_type": "GAPIC_AUTO", + "api_shortname": "backupdr" + }, "BareMetalSolution": { "language": "php", "distribution_name": "google/cloud-bare-metal-solution", diff --git a/BackupDr/.OwlBot.yaml b/BackupDr/.OwlBot.yaml new file mode 100644 index 000000000000..8f8bbba75403 --- /dev/null +++ b/BackupDr/.OwlBot.yaml @@ -0,0 +1,4 @@ +deep-copy-regex: + - source: /google/cloud/backupdr/(v1)/.*-php/(.*) + dest: /owl-bot-staging/BackupDr/$1/$2 +api-name: BackupDr diff --git a/BackupDr/.gitattributes b/BackupDr/.gitattributes new file mode 100644 index 000000000000..4bf0fe6f415b --- /dev/null +++ b/BackupDr/.gitattributes @@ -0,0 +1,7 @@ +/*.xml.dist export-ignore +/.OwlBot.yaml export-ignore +/.github export-ignore +/owlbot.py export-ignore +/src/**/gapic_metadata.json export-ignore +/samples export-ignore +/tests export-ignore diff --git a/BackupDr/.github/pull_request_template.md b/BackupDr/.github/pull_request_template.md new file mode 100644 index 000000000000..50668535d9ba --- /dev/null +++ b/BackupDr/.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 `BackupDr/src`, and tests in `BackupDr/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/BackupDr/CONTRIBUTING.md b/BackupDr/CONTRIBUTING.md new file mode 100644 index 000000000000..76ea811cacdb --- /dev/null +++ b/BackupDr/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/BackupDr/LICENSE b/BackupDr/LICENSE new file mode 100644 index 000000000000..8f71f43fee3f --- /dev/null +++ b/BackupDr/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/BackupDr/README.md b/BackupDr/README.md new file mode 100644 index 000000000000..c931baed414b --- /dev/null +++ b/BackupDr/README.md @@ -0,0 +1,45 @@ +# Google Cloud Backup Dr for PHP + +> Idiomatic PHP client for [Google Cloud Backup Dr](https://cloud.google.com/backup-disaster-recovery). + +[![Latest Stable Version](https://poser.pugx.org/google/cloud-backupdr/v/stable)](https://packagist.org/packages/google/cloud-backupdr) [![Packagist](https://img.shields.io/packagist/dm/google/cloud-backupdr.svg)](https://packagist.org/packages/google/cloud-backupdr) + +* [API documentation](https://cloud.google.com/php/docs/reference/cloud-backupdr/latest) + +**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any +support requests, bug reports, or development contributions should be directed to +that project. + +### Installation + +To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/). + +Now, install this component: + +```sh +$ composer require google/cloud-backupdr +``` + +> Browse the complete list of [Google Cloud APIs](https://cloud.google.com/php/docs/reference) +> for PHP + +This component supports both REST over HTTP/1.1 and gRPC. In order to take advantage of the benefits +offered by gRPC (such as streaming methods) please see our +[gRPC installation guide](https://cloud.google.com/php/grpc). + +### Authentication + +Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information +on authenticating your client. Once authenticated, you'll be ready to start making requests. + +### Sample + +See the [samples directory](https://github.com/googleapis/google-cloud-php-backupdr/tree/main/samples) for a canonical list of samples. + +### Version + +This component is considered alpha. As such, it is still a work-in-progress and is more likely to get backwards-incompatible updates. + +### Next Steps + +1. Understand the [official documentation](https://cloud.google.com/backup-disaster-recovery/docs/concepts/backup-dr). diff --git a/BackupDr/VERSION b/BackupDr/VERSION new file mode 100644 index 000000000000..77d6f4ca2371 --- /dev/null +++ b/BackupDr/VERSION @@ -0,0 +1 @@ +0.0.0 diff --git a/BackupDr/composer.json b/BackupDr/composer.json new file mode 100644 index 000000000000..76c277f77764 --- /dev/null +++ b/BackupDr/composer.json @@ -0,0 +1,30 @@ +{ + "name": "google/cloud-backupdr", + "description": "Google Cloud Backup Dr Client for PHP", + "license": "Apache-2.0", + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "Google\\Cloud\\BackupDR\\": "src", + "GPBMetadata\\Google\\Cloud\\Backupdr\\": "metadata" + } + }, + "extra": { + "component": { + "id": "cloud-backupdr", + "path": "BackupDr", + "target": "googleapis/google-cloud-php-backupdr" + } + }, + "require": { + "php": "^8.0", + "google/gax": "^1.34.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-grpc": "Enables use of gRPC, a universal high-performance RPC framework created by Google.", + "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions." + } +} diff --git a/BackupDr/metadata/V1/Backupdr.php b/BackupDr/metadata/V1/Backupdr.php new file mode 100644 index 0000000000000000000000000000000000000000..39dafc56b902b03f7555a483dbdb081f8758306a GIT binary patch literal 5436 zcmbtYPjB1U5no#VJBl6UW!F)ZxaBG->=+xW_Wlc$I$KJjy-I9ZkQEnOs30imNoGTn zT#~Y*roQylTMtEhDSGIw=yzy8Ku$$_%cTpnm+oOdK#K)-9v?}`7Ujy_Tq5($%$u3_ zo8QcPKlsExvf-Y%Lrv;v9&L-wzUUoM(RM7)YFUQZ>~%WS5nI-=tsB&lM6t9lR`%_mtwO;h>wv#*Ah<;1HO#o9nrmn5EsJK%t>`_l^ zYo6BF@zonerrsz7>W#yV#{exub6qj~2CqQGe|E2F=q=IpG!Or~ue+*l>YlC{`p+0*-p=FdAenaOkv+_(X|I6x5;Gh+ZIN>C58@FSt2kAjk4)c$JC5QiMlOE zw>`_LqG&$frCyXi_GRrsuq`vEcf>XBV?ICPZIp$;EZ)V^u`qhX@ zmu%||*)%Pd1a6}AfvOx%qhpV*PqV%a-(p*sTOG*k$N;=ud+zL!+wvGkIPLUT^=DR}+9d=Y|GdQb2;P#M!6C6me zbT3#k23gNpQPu;YJAsg2%UBjU%JO<)_h``zlg9PbctD*K>foVIvnCLjoc%(^L!T#UNVWrN#WGJX zgdqsz8O$15lNxS%T1>1ZH$NH=go}GgyS}1gdQP8X>jOx(9E!b8W$5$|DY=;mEr!sQ zqPk~V34&VK&mye^IyZsVQ<(PpHcc=2`29HCWTc>_5x2`Gk`DH!I;wNOOR#hS4oTmM z#_A+y5vx297YT^fpASVmSB^!s$-sCKZz+F+t?~Bbfi(yw+I1IZSQn(}IX@GR#+w`{ zbFfHZCJvZBkKqZ-2c+Sq=Y2$6mV|TMzzj^08!(M?M>oBQ-UO7h0;v%kUk{fP+{&z`i;S-Kx#8}@l*C60^Hrz zU2iWU^FX#nKkwmeL4F9cNcUKX0U>@LA^IPAolG9pGA!8GlvEdoU!T!t707@P1nhqEmeZz=+U%!i25SPY6&7Glw_;W9Q~A73XIQ-%RuH|a~(9x+-TmEUZz4<~yj(t7Ji zYZ??o#WKk@8j#tcBZ&|5{^VR63bH;qma_lGu#0{xx#(xO!?!=#cj4`k#IbH1wb&{0 z6oz0JT&)--cr%9%jO@}DLK=VpTKpk-NxIkh4)Xq=XR{1 z?R_%7bVgDp;oT%KQAP{VM3l&U2sdNa{#QfU{Av#7`K7#6BYzd(omdJWmkevM3PJ5; zE}53b=y9&eZoiQOKK;et|MlyskI9GZ72*}A*sX~F*N1q2J%;bep9Q!X!ye>=@kx&n z55u_v%VkS%WPd4{$BrZck7+B|lUljwHXRqa3V`ihj$bHS_sUHJ?A+XwLd+e}6T4 cmU)jq!419GF&5WbF|T#LB!5*qgEN3{02n#}T>t<8 literal 0 HcmV?d00001 diff --git a/BackupDr/owlbot.py b/BackupDr/owlbot.py new file mode 100644 index 000000000000..058fd7e0e1e4 --- /dev/null +++ b/BackupDr/owlbot.py @@ -0,0 +1,62 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""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}/BackupDr").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", + ] +) + +# remove class_alias code +s.replace( + "src/V*/**/*.php", + r"^// Adding a class alias for backwards compatibility with the previous class name.$" + + "\n" + + r"^class_alias\(.*\);$" + + "\n", + '') + +# format generated clients +subprocess.run([ + 'npm', + 'exec', + '--yes', + '--package=@prettier/plugin-php@^0.16', + '--', + 'prettier', + '**/Client/*', + '--write', + '--parser=php', + '--single-quote', + '--print-width=120']) diff --git a/BackupDr/phpunit.xml.dist b/BackupDr/phpunit.xml.dist new file mode 100644 index 000000000000..52ed8e7e232f --- /dev/null +++ b/BackupDr/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + src + + + src/V[!a-zA-Z]* + + + + + tests/Unit + + + diff --git a/BackupDr/samples/V1/BackupDRClient/create_management_server.php b/BackupDr/samples/V1/BackupDRClient/create_management_server.php new file mode 100644 index 000000000000..363df2a44dd8 --- /dev/null +++ b/BackupDr/samples/V1/BackupDRClient/create_management_server.php @@ -0,0 +1,96 @@ +setNetworks($managementServerNetworks); + $request = (new CreateManagementServerRequest()) + ->setParent($formattedParent) + ->setManagementServerId($managementServerId) + ->setManagementServer($managementServer); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $backupDRClient->createManagementServer($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ManagementServer $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = BackupDRClient::locationName('[PROJECT]', '[LOCATION]'); + $managementServerId = '[MANAGEMENT_SERVER_ID]'; + + create_management_server_sample($formattedParent, $managementServerId); +} +// [END backupdr_v1_generated_BackupDR_CreateManagementServer_sync] diff --git a/BackupDr/samples/V1/BackupDRClient/delete_management_server.php b/BackupDr/samples/V1/BackupDRClient/delete_management_server.php new file mode 100644 index 000000000000..600741c46b66 --- /dev/null +++ b/BackupDr/samples/V1/BackupDRClient/delete_management_server.php @@ -0,0 +1,84 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $backupDRClient->deleteManagementServer($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = BackupDRClient::managementServerName( + '[PROJECT]', + '[LOCATION]', + '[MANAGEMENTSERVER]' + ); + + delete_management_server_sample($formattedName); +} +// [END backupdr_v1_generated_BackupDR_DeleteManagementServer_sync] diff --git a/BackupDr/samples/V1/BackupDRClient/get_iam_policy.php b/BackupDr/samples/V1/BackupDRClient/get_iam_policy.php new file mode 100644 index 000000000000..051e2e471612 --- /dev/null +++ b/BackupDr/samples/V1/BackupDRClient/get_iam_policy.php @@ -0,0 +1,72 @@ +setResource($resource); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $backupDRClient->getIamPolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + + get_iam_policy_sample($resource); +} +// [END backupdr_v1_generated_BackupDR_GetIamPolicy_sync] diff --git a/BackupDr/samples/V1/BackupDRClient/get_location.php b/BackupDr/samples/V1/BackupDRClient/get_location.php new file mode 100644 index 000000000000..6e6c3ede82e1 --- /dev/null +++ b/BackupDr/samples/V1/BackupDRClient/get_location.php @@ -0,0 +1,57 @@ +getLocation($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END backupdr_v1_generated_BackupDR_GetLocation_sync] diff --git a/BackupDr/samples/V1/BackupDRClient/get_management_server.php b/BackupDr/samples/V1/BackupDRClient/get_management_server.php new file mode 100644 index 000000000000..c6ad450d29fa --- /dev/null +++ b/BackupDr/samples/V1/BackupDRClient/get_management_server.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var ManagementServer $response */ + $response = $backupDRClient->getManagementServer($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = BackupDRClient::managementServerName( + '[PROJECT]', + '[LOCATION]', + '[MANAGEMENTSERVER]' + ); + + get_management_server_sample($formattedName); +} +// [END backupdr_v1_generated_BackupDR_GetManagementServer_sync] diff --git a/BackupDr/samples/V1/BackupDRClient/list_locations.php b/BackupDr/samples/V1/BackupDRClient/list_locations.php new file mode 100644 index 000000000000..baacf567a7fa --- /dev/null +++ b/BackupDr/samples/V1/BackupDRClient/list_locations.php @@ -0,0 +1,62 @@ +listLocations($request); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END backupdr_v1_generated_BackupDR_ListLocations_sync] diff --git a/BackupDr/samples/V1/BackupDRClient/list_management_servers.php b/BackupDr/samples/V1/BackupDRClient/list_management_servers.php new file mode 100644 index 000000000000..5d3871049b33 --- /dev/null +++ b/BackupDr/samples/V1/BackupDRClient/list_management_servers.php @@ -0,0 +1,80 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $backupDRClient->listManagementServers($request); + + /** @var ManagementServer $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = BackupDRClient::locationName('[PROJECT]', '[LOCATION]'); + + list_management_servers_sample($formattedParent); +} +// [END backupdr_v1_generated_BackupDR_ListManagementServers_sync] diff --git a/BackupDr/samples/V1/BackupDRClient/set_iam_policy.php b/BackupDr/samples/V1/BackupDRClient/set_iam_policy.php new file mode 100644 index 000000000000..5de0fc44b7fb --- /dev/null +++ b/BackupDr/samples/V1/BackupDRClient/set_iam_policy.php @@ -0,0 +1,77 @@ +setResource($resource) + ->setPolicy($policy); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $backupDRClient->setIamPolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + + set_iam_policy_sample($resource); +} +// [END backupdr_v1_generated_BackupDR_SetIamPolicy_sync] diff --git a/BackupDr/samples/V1/BackupDRClient/test_iam_permissions.php b/BackupDr/samples/V1/BackupDRClient/test_iam_permissions.php new file mode 100644 index 000000000000..e9e41bb418a7 --- /dev/null +++ b/BackupDr/samples/V1/BackupDRClient/test_iam_permissions.php @@ -0,0 +1,84 @@ +setResource($resource) + ->setPermissions($permissions); + + // Call the API and handle any network failures. + try { + /** @var TestIamPermissionsResponse $response */ + $response = $backupDRClient->testIamPermissions($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + $permissionsElement = '[PERMISSIONS]'; + + test_iam_permissions_sample($resource, $permissionsElement); +} +// [END backupdr_v1_generated_BackupDR_TestIamPermissions_sync] diff --git a/BackupDr/src/V1/Client/BackupDRClient.php b/BackupDr/src/V1/Client/BackupDRClient.php new file mode 100644 index 000000000000..b3150d620337 --- /dev/null +++ b/BackupDr/src/V1/Client/BackupDRClient.php @@ -0,0 +1,558 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/backup_dr_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/backup_dr_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/backup_dr_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/backup_dr_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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; + } + + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * management_server resource. + * + * @param string $project + * @param string $location + * @param string $managementserver + * + * @return string The formatted management_server resource. + */ + public static function managementServerName(string $project, string $location, string $managementserver): string + { + return self::getPathTemplate('managementServer')->render([ + 'project' => $project, + 'location' => $location, + 'managementserver' => $managementserver, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - location: projects/{project}/locations/{location} + * - managementServer: projects/{project}/locations/{location}/managementServers/{managementserver} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'backupdr.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a new ManagementServer in a given project and location. + * + * The async variant is {@see BackupDRClient::createManagementServerAsync()} . + * + * @example samples/V1/BackupDRClient/create_management_server.php + * + * @param CreateManagementServerRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createManagementServer( + CreateManagementServerRequest $request, + array $callOptions = [] + ): OperationResponse { + return $this->startApiCall('CreateManagementServer', $request, $callOptions)->wait(); + } + + /** + * Deletes a single ManagementServer. + * + * The async variant is {@see BackupDRClient::deleteManagementServerAsync()} . + * + * @example samples/V1/BackupDRClient/delete_management_server.php + * + * @param DeleteManagementServerRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteManagementServer( + DeleteManagementServerRequest $request, + array $callOptions = [] + ): OperationResponse { + return $this->startApiCall('DeleteManagementServer', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single ManagementServer. + * + * The async variant is {@see BackupDRClient::getManagementServerAsync()} . + * + * @example samples/V1/BackupDRClient/get_management_server.php + * + * @param GetManagementServerRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ManagementServer + * + * @throws ApiException Thrown if the API call fails. + */ + public function getManagementServer(GetManagementServerRequest $request, array $callOptions = []): ManagementServer + { + return $this->startApiCall('GetManagementServer', $request, $callOptions)->wait(); + } + + /** + * Lists ManagementServers in a given project and location. + * + * The async variant is {@see BackupDRClient::listManagementServersAsync()} . + * + * @example samples/V1/BackupDRClient/list_management_servers.php + * + * @param ListManagementServersRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listManagementServers( + ListManagementServersRequest $request, + array $callOptions = [] + ): PagedListResponse { + return $this->startApiCall('ListManagementServers', $request, $callOptions); + } + + /** + * Gets information about a location. + * + * The async variant is {@see BackupDRClient::getLocationAsync()} . + * + * @example samples/V1/BackupDRClient/get_location.php + * + * @param GetLocationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see BackupDRClient::listLocationsAsync()} . + * + * @example samples/V1/BackupDRClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * The async variant is {@see BackupDRClient::getIamPolicyAsync()} . + * + * @example samples/V1/BackupDRClient/get_iam_policy.php + * + * @param GetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * The async variant is {@see BackupDRClient::setIamPolicyAsync()} . + * + * @example samples/V1/BackupDRClient/set_iam_policy.php + * + * @param SetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('SetIamPolicy', $request, $callOptions)->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. + * + * The async variant is {@see BackupDRClient::testIamPermissionsAsync()} . + * + * @example samples/V1/BackupDRClient/test_iam_permissions.php + * + * @param TestIamPermissionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { + return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); + } +} diff --git a/BackupDr/src/V1/CreateManagementServerRequest.php b/BackupDr/src/V1/CreateManagementServerRequest.php new file mode 100644 index 000000000000..4f329ab68f27 --- /dev/null +++ b/BackupDr/src/V1/CreateManagementServerRequest.php @@ -0,0 +1,257 @@ +google.cloud.backupdr.v1.CreateManagementServerRequest + */ +class CreateManagementServerRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The management server project and location in the format + * `projects/{project_id}/locations/{location}`. In Cloud Backup and DR + * locations map to GCP regions, for example **us-central1**. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The name of the management server to create. The name must be + * unique for the specified project and location. + * + * Generated from protobuf field string management_server_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $management_server_id = ''; + /** + * Required. A [management server + * resource][google.cloud.backupdr.v1.ManagementServer] + * + * Generated from protobuf field .google.cloud.backupdr.v1.ManagementServer management_server = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $management_server = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The management server project and location in the format + * `projects/{project_id}/locations/{location}`. In Cloud Backup and DR + * locations map to GCP regions, for example **us-central1**. Please see + * {@see BackupDRClient::locationName()} for help formatting this field. + * @param \Google\Cloud\BackupDR\V1\ManagementServer $managementServer Required. A [management server + * resource][google.cloud.backupdr.v1.ManagementServer] + * @param string $managementServerId Required. The name of the management server to create. The name must be + * unique for the specified project and location. + * + * @return \Google\Cloud\BackupDR\V1\CreateManagementServerRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\BackupDR\V1\ManagementServer $managementServer, string $managementServerId): self + { + return (new self()) + ->setParent($parent) + ->setManagementServer($managementServer) + ->setManagementServerId($managementServerId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The management server project and location in the format + * `projects/{project_id}/locations/{location}`. In Cloud Backup and DR + * locations map to GCP regions, for example **us-central1**. + * @type string $management_server_id + * Required. The name of the management server to create. The name must be + * unique for the specified project and location. + * @type \Google\Cloud\BackupDR\V1\ManagementServer $management_server + * Required. A [management server + * resource][google.cloud.backupdr.v1.ManagementServer] + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Backupdr\V1\Backupdr::initOnce(); + parent::__construct($data); + } + + /** + * Required. The management server project and location in the format + * `projects/{project_id}/locations/{location}`. In Cloud Backup and DR + * locations map to GCP regions, for example **us-central1**. + * + * 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 management server project and location in the format + * `projects/{project_id}/locations/{location}`. In Cloud Backup and DR + * locations map to GCP regions, for example **us-central1**. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The name of the management server to create. The name must be + * unique for the specified project and location. + * + * Generated from protobuf field string management_server_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getManagementServerId() + { + return $this->management_server_id; + } + + /** + * Required. The name of the management server to create. The name must be + * unique for the specified project and location. + * + * Generated from protobuf field string management_server_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setManagementServerId($var) + { + GPBUtil::checkString($var, True); + $this->management_server_id = $var; + + return $this; + } + + /** + * Required. A [management server + * resource][google.cloud.backupdr.v1.ManagementServer] + * + * Generated from protobuf field .google.cloud.backupdr.v1.ManagementServer management_server = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\BackupDR\V1\ManagementServer|null + */ + public function getManagementServer() + { + return $this->management_server; + } + + public function hasManagementServer() + { + return isset($this->management_server); + } + + public function clearManagementServer() + { + unset($this->management_server); + } + + /** + * Required. A [management server + * resource][google.cloud.backupdr.v1.ManagementServer] + * + * Generated from protobuf field .google.cloud.backupdr.v1.ManagementServer management_server = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\BackupDR\V1\ManagementServer $var + * @return $this + */ + public function setManagementServer($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\BackupDR\V1\ManagementServer::class); + $this->management_server = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/BackupDr/src/V1/DeleteManagementServerRequest.php b/BackupDr/src/V1/DeleteManagementServerRequest.php new file mode 100644 index 000000000000..c8bc344f88f3 --- /dev/null +++ b/BackupDr/src/V1/DeleteManagementServerRequest.php @@ -0,0 +1,155 @@ +google.cloud.backupdr.v1.DeleteManagementServerRequest + */ +class DeleteManagementServerRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the resource + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. Name of the resource + * Please see {@see BackupDRClient::managementServerName()} for help formatting this field. + * + * @return \Google\Cloud\BackupDR\V1\DeleteManagementServerRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the resource + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Backupdr\V1\Backupdr::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the resource + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the resource + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/BackupDr/src/V1/GetManagementServerRequest.php b/BackupDr/src/V1/GetManagementServerRequest.php new file mode 100644 index 000000000000..4787333aa02d --- /dev/null +++ b/BackupDr/src/V1/GetManagementServerRequest.php @@ -0,0 +1,86 @@ +google.cloud.backupdr.v1.GetManagementServerRequest + */ +class GetManagementServerRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the management server resource name, in the format + * `projects/{project_id}/locations/{location}/managementServers/{resource_name}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the management server resource name, in the format + * `projects/{project_id}/locations/{location}/managementServers/{resource_name}` + * Please see {@see BackupDRClient::managementServerName()} for help formatting this field. + * + * @return \Google\Cloud\BackupDR\V1\GetManagementServerRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the management server resource name, in the format + * `projects/{project_id}/locations/{location}/managementServers/{resource_name}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Backupdr\V1\Backupdr::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the management server resource name, in the format + * `projects/{project_id}/locations/{location}/managementServers/{resource_name}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the management server resource name, in the format + * `projects/{project_id}/locations/{location}/managementServers/{resource_name}` + * + * 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/BackupDr/src/V1/ListManagementServersRequest.php b/BackupDr/src/V1/ListManagementServersRequest.php new file mode 100644 index 000000000000..37886b801be4 --- /dev/null +++ b/BackupDr/src/V1/ListManagementServersRequest.php @@ -0,0 +1,261 @@ +google.cloud.backupdr.v1.ListManagementServersRequest + */ +class ListManagementServersRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location for which to retrieve management servers + * information, in the format `projects/{project_id}/locations/{location}`. In + * Cloud BackupDR, locations map to GCP regions, for example **us-central1**. + * To retrieve management servers for all locations, use "-" for the + * `{location}` value. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Filtering results. + * + * Generated from protobuf field optional string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = null; + /** + * Optional. Hint for how to order the results. + * + * Generated from protobuf field optional string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = null; + + /** + * @param string $parent Required. The project and location for which to retrieve management servers + * information, in the format `projects/{project_id}/locations/{location}`. In + * Cloud BackupDR, locations map to GCP regions, for example **us-central1**. + * To retrieve management servers for all locations, use "-" for the + * `{location}` value. Please see + * {@see BackupDRClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\BackupDR\V1\ListManagementServersRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location for which to retrieve management servers + * information, in the format `projects/{project_id}/locations/{location}`. In + * Cloud BackupDR, locations map to GCP regions, for example **us-central1**. + * To retrieve management servers for all locations, use "-" for the + * `{location}` value. + * @type int $page_size + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @type string $page_token + * Optional. A token identifying a page of results the server should return. + * @type string $filter + * Optional. Filtering results. + * @type string $order_by + * Optional. Hint for how to order the results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Backupdr\V1\Backupdr::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location for which to retrieve management servers + * information, in the format `projects/{project_id}/locations/{location}`. In + * Cloud BackupDR, locations map to GCP regions, for example **us-central1**. + * To retrieve management servers for all locations, use "-" for the + * `{location}` value. + * + * 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 project and location for which to retrieve management servers + * information, in the format `projects/{project_id}/locations/{location}`. In + * Cloud BackupDR, locations map to GCP regions, for example **us-central1**. + * To retrieve management servers for all locations, use "-" for the + * `{location}` value. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. Filtering results. + * + * Generated from protobuf field optional string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return isset($this->filter) ? $this->filter : ''; + } + + public function hasFilter() + { + return isset($this->filter); + } + + public function clearFilter() + { + unset($this->filter); + } + + /** + * Optional. Filtering results. + * + * Generated from protobuf field optional string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Hint for how to order the results. + * + * Generated from protobuf field optional string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return isset($this->order_by) ? $this->order_by : ''; + } + + public function hasOrderBy() + { + return isset($this->order_by); + } + + public function clearOrderBy() + { + unset($this->order_by); + } + + /** + * Optional. Hint for how to order the results. + * + * Generated from protobuf field optional 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/BackupDr/src/V1/ListManagementServersResponse.php b/BackupDr/src/V1/ListManagementServersResponse.php new file mode 100644 index 000000000000..fa2d796a5d0e --- /dev/null +++ b/BackupDr/src/V1/ListManagementServersResponse.php @@ -0,0 +1,159 @@ +google.cloud.backupdr.v1.ListManagementServersResponse + */ +class ListManagementServersResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of ManagementServer instances in the project for the specified + * location. + * If the `{location}` value in the request is "-", the response contains a + * list of instances from all locations. In case any location is unreachable, + * the response will only return management servers in reachable locations and + * the 'unreachable' field will be populated with a list of unreachable + * locations. + * + * Generated from protobuf field repeated .google.cloud.backupdr.v1.ManagementServer management_servers = 1; + */ + private $management_servers; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * 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\BackupDR\V1\ManagementServer>|\Google\Protobuf\Internal\RepeatedField $management_servers + * The list of ManagementServer instances in the project for the specified + * location. + * If the `{location}` value in the request is "-", the response contains a + * list of instances from all locations. In case any location is unreachable, + * the response will only return management servers in reachable locations and + * the 'unreachable' field will be populated with a list of unreachable + * locations. + * @type string $next_page_token + * A token identifying a page of results the server should return. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Backupdr\V1\Backupdr::initOnce(); + parent::__construct($data); + } + + /** + * The list of ManagementServer instances in the project for the specified + * location. + * If the `{location}` value in the request is "-", the response contains a + * list of instances from all locations. In case any location is unreachable, + * the response will only return management servers in reachable locations and + * the 'unreachable' field will be populated with a list of unreachable + * locations. + * + * Generated from protobuf field repeated .google.cloud.backupdr.v1.ManagementServer management_servers = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getManagementServers() + { + return $this->management_servers; + } + + /** + * The list of ManagementServer instances in the project for the specified + * location. + * If the `{location}` value in the request is "-", the response contains a + * list of instances from all locations. In case any location is unreachable, + * the response will only return management servers in reachable locations and + * the 'unreachable' field will be populated with a list of unreachable + * locations. + * + * Generated from protobuf field repeated .google.cloud.backupdr.v1.ManagementServer management_servers = 1; + * @param array<\Google\Cloud\BackupDR\V1\ManagementServer>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setManagementServers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\BackupDR\V1\ManagementServer::class); + $this->management_servers = $arr; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * 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; + } + + /** + * 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/BackupDr/src/V1/ManagementServer.php b/BackupDr/src/V1/ManagementServer.php new file mode 100644 index 000000000000..67a65fc301f5 --- /dev/null +++ b/BackupDr/src/V1/ManagementServer.php @@ -0,0 +1,611 @@ +google.cloud.backupdr.v1.ManagementServer + */ +class ManagementServer extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Identifier. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Optional. The description of the ManagementServer instance (2048 characters + * or less). + * + * Generated from protobuf field string description = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Optional. Resource labels to represent user provided metadata. + * Labels currently defined: + * 1. migrate_from_go= + * If set to true, the MS is created in migration ready mode. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + /** + * Output only. The time when the instance was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time when the instance was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Optional. The type of the ManagementServer resource. + * + * Generated from protobuf field .google.cloud.backupdr.v1.ManagementServer.InstanceType type = 14 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $type = 0; + /** + * Output only. The hostname or ip address of the exposed AGM endpoints, used + * by clients to connect to AGM/RD graphical user interface and APIs. + * + * Generated from protobuf field .google.cloud.backupdr.v1.ManagementURI management_uri = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $management_uri = null; + /** + * Output only. The hostnames of the exposed AGM endpoints for both types of + * user i.e. 1p and 3p, used to connect AGM/RM UI. + * + * Generated from protobuf field .google.cloud.backupdr.v1.WorkforceIdentityBasedManagementURI workforce_identity_based_management_uri = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $workforce_identity_based_management_uri = null; + /** + * Output only. The ManagementServer state. + * + * Generated from protobuf field .google.cloud.backupdr.v1.ManagementServer.InstanceState state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Required. VPC networks to which the ManagementServer instance is connected. + * For this version, only a single network is supported. + * + * Generated from protobuf field repeated .google.cloud.backupdr.v1.NetworkConfig networks = 8 [(.google.api.field_behavior) = REQUIRED]; + */ + private $networks; + /** + * Optional. Server specified ETag for the ManagementServer resource to + * prevent simultaneous updates from overwiting each other. + * + * Generated from protobuf field string etag = 13 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + /** + * Output only. The OAuth 2.0 client id is required to make API calls to the + * BackupDR instance API of this ManagementServer. This is the value that + * should be provided in the ‘aud’ field of the OIDC ID Token (see openid + * specification + * https://openid.net/specs/openid-connect-core-1_0.html#IDToken). + * + * Generated from protobuf field string oauth2_client_id = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $oauth2_client_id = ''; + /** + * Output only. The OAuth client IDs for both types of user i.e. 1p and 3p. + * + * Generated from protobuf field .google.cloud.backupdr.v1.WorkforceIdentityBasedOAuth2ClientID workforce_identity_based_oauth2_client_id = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $workforce_identity_based_oauth2_client_id = null; + /** + * Output only. The hostname or ip address of the exposed AGM endpoints, used + * by BAs to connect to BA proxy. + * + * Generated from protobuf field repeated string ba_proxy_uri = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $ba_proxy_uri; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. Identifier. The resource name. + * @type string $description + * Optional. The description of the ManagementServer instance (2048 characters + * or less). + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. Resource labels to represent user provided metadata. + * Labels currently defined: + * 1. migrate_from_go= + * If set to true, the MS is created in migration ready mode. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time when the instance was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time when the instance was updated. + * @type int $type + * Optional. The type of the ManagementServer resource. + * @type \Google\Cloud\BackupDR\V1\ManagementURI $management_uri + * Output only. The hostname or ip address of the exposed AGM endpoints, used + * by clients to connect to AGM/RD graphical user interface and APIs. + * @type \Google\Cloud\BackupDR\V1\WorkforceIdentityBasedManagementURI $workforce_identity_based_management_uri + * Output only. The hostnames of the exposed AGM endpoints for both types of + * user i.e. 1p and 3p, used to connect AGM/RM UI. + * @type int $state + * Output only. The ManagementServer state. + * @type array<\Google\Cloud\BackupDR\V1\NetworkConfig>|\Google\Protobuf\Internal\RepeatedField $networks + * Required. VPC networks to which the ManagementServer instance is connected. + * For this version, only a single network is supported. + * @type string $etag + * Optional. Server specified ETag for the ManagementServer resource to + * prevent simultaneous updates from overwiting each other. + * @type string $oauth2_client_id + * Output only. The OAuth 2.0 client id is required to make API calls to the + * BackupDR instance API of this ManagementServer. This is the value that + * should be provided in the ‘aud’ field of the OIDC ID Token (see openid + * specification + * https://openid.net/specs/openid-connect-core-1_0.html#IDToken). + * @type \Google\Cloud\BackupDR\V1\WorkforceIdentityBasedOAuth2ClientID $workforce_identity_based_oauth2_client_id + * Output only. The OAuth client IDs for both types of user i.e. 1p and 3p. + * @type array|\Google\Protobuf\Internal\RepeatedField $ba_proxy_uri + * Output only. The hostname or ip address of the exposed AGM endpoints, used + * by BAs to connect to BA proxy. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Backupdr\V1\Backupdr::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Identifier. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. Identifier. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. The description of the ManagementServer instance (2048 characters + * or less). + * + * Generated from protobuf field string description = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. The description of the ManagementServer instance (2048 characters + * or less). + * + * Generated from protobuf field string description = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Optional. Resource labels to represent user provided metadata. + * Labels currently defined: + * 1. migrate_from_go= + * If set to true, the MS is created in migration ready mode. + * + * 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. + * Labels currently defined: + * 1. migrate_from_go= + * If set to true, the MS is created in migration ready mode. + * + * 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; + } + + /** + * Output only. The time when the instance 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. The time when the instance 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. The time when the instance was updated. + * + * 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. The time when the instance was updated. + * + * 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. The type of the ManagementServer resource. + * + * Generated from protobuf field .google.cloud.backupdr.v1.ManagementServer.InstanceType type = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Optional. The type of the ManagementServer resource. + * + * Generated from protobuf field .google.cloud.backupdr.v1.ManagementServer.InstanceType type = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\BackupDR\V1\ManagementServer\InstanceType::class); + $this->type = $var; + + return $this; + } + + /** + * Output only. The hostname or ip address of the exposed AGM endpoints, used + * by clients to connect to AGM/RD graphical user interface and APIs. + * + * Generated from protobuf field .google.cloud.backupdr.v1.ManagementURI management_uri = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\BackupDR\V1\ManagementURI|null + */ + public function getManagementUri() + { + return $this->management_uri; + } + + public function hasManagementUri() + { + return isset($this->management_uri); + } + + public function clearManagementUri() + { + unset($this->management_uri); + } + + /** + * Output only. The hostname or ip address of the exposed AGM endpoints, used + * by clients to connect to AGM/RD graphical user interface and APIs. + * + * Generated from protobuf field .google.cloud.backupdr.v1.ManagementURI management_uri = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\BackupDR\V1\ManagementURI $var + * @return $this + */ + public function setManagementUri($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\BackupDR\V1\ManagementURI::class); + $this->management_uri = $var; + + return $this; + } + + /** + * Output only. The hostnames of the exposed AGM endpoints for both types of + * user i.e. 1p and 3p, used to connect AGM/RM UI. + * + * Generated from protobuf field .google.cloud.backupdr.v1.WorkforceIdentityBasedManagementURI workforce_identity_based_management_uri = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\BackupDR\V1\WorkforceIdentityBasedManagementURI|null + */ + public function getWorkforceIdentityBasedManagementUri() + { + return $this->workforce_identity_based_management_uri; + } + + public function hasWorkforceIdentityBasedManagementUri() + { + return isset($this->workforce_identity_based_management_uri); + } + + public function clearWorkforceIdentityBasedManagementUri() + { + unset($this->workforce_identity_based_management_uri); + } + + /** + * Output only. The hostnames of the exposed AGM endpoints for both types of + * user i.e. 1p and 3p, used to connect AGM/RM UI. + * + * Generated from protobuf field .google.cloud.backupdr.v1.WorkforceIdentityBasedManagementURI workforce_identity_based_management_uri = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\BackupDR\V1\WorkforceIdentityBasedManagementURI $var + * @return $this + */ + public function setWorkforceIdentityBasedManagementUri($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\BackupDR\V1\WorkforceIdentityBasedManagementURI::class); + $this->workforce_identity_based_management_uri = $var; + + return $this; + } + + /** + * Output only. The ManagementServer state. + * + * Generated from protobuf field .google.cloud.backupdr.v1.ManagementServer.InstanceState state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The ManagementServer state. + * + * Generated from protobuf field .google.cloud.backupdr.v1.ManagementServer.InstanceState state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\BackupDR\V1\ManagementServer\InstanceState::class); + $this->state = $var; + + return $this; + } + + /** + * Required. VPC networks to which the ManagementServer instance is connected. + * For this version, only a single network is supported. + * + * Generated from protobuf field repeated .google.cloud.backupdr.v1.NetworkConfig networks = 8 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNetworks() + { + return $this->networks; + } + + /** + * Required. VPC networks to which the ManagementServer instance is connected. + * For this version, only a single network is supported. + * + * Generated from protobuf field repeated .google.cloud.backupdr.v1.NetworkConfig networks = 8 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\BackupDR\V1\NetworkConfig>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNetworks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\BackupDR\V1\NetworkConfig::class); + $this->networks = $arr; + + return $this; + } + + /** + * Optional. Server specified ETag for the ManagementServer resource to + * prevent simultaneous updates from overwiting each other. + * + * Generated from protobuf field string etag = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. Server specified ETag for the ManagementServer resource to + * prevent simultaneous updates from overwiting each other. + * + * Generated from protobuf field string etag = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Output only. The OAuth 2.0 client id is required to make API calls to the + * BackupDR instance API of this ManagementServer. This is the value that + * should be provided in the ‘aud’ field of the OIDC ID Token (see openid + * specification + * https://openid.net/specs/openid-connect-core-1_0.html#IDToken). + * + * Generated from protobuf field string oauth2_client_id = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getOauth2ClientId() + { + return $this->oauth2_client_id; + } + + /** + * Output only. The OAuth 2.0 client id is required to make API calls to the + * BackupDR instance API of this ManagementServer. This is the value that + * should be provided in the ‘aud’ field of the OIDC ID Token (see openid + * specification + * https://openid.net/specs/openid-connect-core-1_0.html#IDToken). + * + * Generated from protobuf field string oauth2_client_id = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setOauth2ClientId($var) + { + GPBUtil::checkString($var, True); + $this->oauth2_client_id = $var; + + return $this; + } + + /** + * Output only. The OAuth client IDs for both types of user i.e. 1p and 3p. + * + * Generated from protobuf field .google.cloud.backupdr.v1.WorkforceIdentityBasedOAuth2ClientID workforce_identity_based_oauth2_client_id = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\BackupDR\V1\WorkforceIdentityBasedOAuth2ClientID|null + */ + public function getWorkforceIdentityBasedOauth2ClientId() + { + return $this->workforce_identity_based_oauth2_client_id; + } + + public function hasWorkforceIdentityBasedOauth2ClientId() + { + return isset($this->workforce_identity_based_oauth2_client_id); + } + + public function clearWorkforceIdentityBasedOauth2ClientId() + { + unset($this->workforce_identity_based_oauth2_client_id); + } + + /** + * Output only. The OAuth client IDs for both types of user i.e. 1p and 3p. + * + * Generated from protobuf field .google.cloud.backupdr.v1.WorkforceIdentityBasedOAuth2ClientID workforce_identity_based_oauth2_client_id = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\BackupDR\V1\WorkforceIdentityBasedOAuth2ClientID $var + * @return $this + */ + public function setWorkforceIdentityBasedOauth2ClientId($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\BackupDR\V1\WorkforceIdentityBasedOAuth2ClientID::class); + $this->workforce_identity_based_oauth2_client_id = $var; + + return $this; + } + + /** + * Output only. The hostname or ip address of the exposed AGM endpoints, used + * by BAs to connect to BA proxy. + * + * Generated from protobuf field repeated string ba_proxy_uri = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBaProxyUri() + { + return $this->ba_proxy_uri; + } + + /** + * Output only. The hostname or ip address of the exposed AGM endpoints, used + * by BAs to connect to BA proxy. + * + * Generated from protobuf field repeated string ba_proxy_uri = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBaProxyUri($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->ba_proxy_uri = $arr; + + return $this; + } + +} + diff --git a/BackupDr/src/V1/ManagementServer/InstanceState.php b/BackupDr/src/V1/ManagementServer/InstanceState.php new file mode 100644 index 000000000000..b898cc597a6c --- /dev/null +++ b/BackupDr/src/V1/ManagementServer/InstanceState.php @@ -0,0 +1,100 @@ +google.cloud.backupdr.v1.ManagementServer.InstanceState + */ +class InstanceState +{ + /** + * State not set. + * + * Generated from protobuf enum INSTANCE_STATE_UNSPECIFIED = 0; + */ + const INSTANCE_STATE_UNSPECIFIED = 0; + /** + * The instance is being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The instance has been created and is fully usable. + * + * Generated from protobuf enum READY = 2; + */ + const READY = 2; + /** + * The instance configuration is being updated. Certain kinds of updates + * may cause the instance to become unusable while the update is in + * progress. + * + * Generated from protobuf enum UPDATING = 3; + */ + const UPDATING = 3; + /** + * The instance is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + /** + * The instance is being repaired and may be unstable. + * + * Generated from protobuf enum REPAIRING = 5; + */ + const REPAIRING = 5; + /** + * Maintenance is being performed on this instance. + * + * Generated from protobuf enum MAINTENANCE = 6; + */ + const MAINTENANCE = 6; + /** + * The instance is experiencing an issue and might be unusable. You can get + * further details from the statusMessage field of Instance resource. + * + * Generated from protobuf enum ERROR = 7; + */ + const ERROR = 7; + + private static $valueToName = [ + self::INSTANCE_STATE_UNSPECIFIED => 'INSTANCE_STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::READY => 'READY', + self::UPDATING => 'UPDATING', + self::DELETING => 'DELETING', + self::REPAIRING => 'REPAIRING', + self::MAINTENANCE => 'MAINTENANCE', + self::ERROR => 'ERROR', + ]; + + 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/BackupDr/src/V1/ManagementServer/InstanceType.php b/BackupDr/src/V1/ManagementServer/InstanceType.php new file mode 100644 index 000000000000..8ab1d2429537 --- /dev/null +++ b/BackupDr/src/V1/ManagementServer/InstanceType.php @@ -0,0 +1,55 @@ +google.cloud.backupdr.v1.ManagementServer.InstanceType + */ +class InstanceType +{ + /** + * Instance type is not mentioned. + * + * Generated from protobuf enum INSTANCE_TYPE_UNSPECIFIED = 0; + */ + const INSTANCE_TYPE_UNSPECIFIED = 0; + /** + * Instance for backup and restore management (i.e., AGM). + * + * Generated from protobuf enum BACKUP_RESTORE = 1; + */ + const BACKUP_RESTORE = 1; + + private static $valueToName = [ + self::INSTANCE_TYPE_UNSPECIFIED => 'INSTANCE_TYPE_UNSPECIFIED', + self::BACKUP_RESTORE => 'BACKUP_RESTORE', + ]; + + 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/BackupDr/src/V1/ManagementURI.php b/BackupDr/src/V1/ManagementURI.php new file mode 100644 index 000000000000..5f9224ac9402 --- /dev/null +++ b/BackupDr/src/V1/ManagementURI.php @@ -0,0 +1,101 @@ +google.cloud.backupdr.v1.ManagementURI + */ +class ManagementURI extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The ManagementServer AGM/RD WebUI URL. + * + * Generated from protobuf field string web_ui = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $web_ui = ''; + /** + * Output only. The ManagementServer AGM/RD API URL. + * + * Generated from protobuf field string api = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $api = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $web_ui + * Output only. The ManagementServer AGM/RD WebUI URL. + * @type string $api + * Output only. The ManagementServer AGM/RD API URL. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Backupdr\V1\Backupdr::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The ManagementServer AGM/RD WebUI URL. + * + * Generated from protobuf field string web_ui = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getWebUi() + { + return $this->web_ui; + } + + /** + * Output only. The ManagementServer AGM/RD WebUI URL. + * + * Generated from protobuf field string web_ui = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setWebUi($var) + { + GPBUtil::checkString($var, True); + $this->web_ui = $var; + + return $this; + } + + /** + * Output only. The ManagementServer AGM/RD API URL. + * + * Generated from protobuf field string api = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApi() + { + return $this->api; + } + + /** + * Output only. The ManagementServer AGM/RD API URL. + * + * Generated from protobuf field string api = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApi($var) + { + GPBUtil::checkString($var, True); + $this->api = $var; + + return $this; + } + +} + diff --git a/BackupDr/src/V1/NetworkConfig.php b/BackupDr/src/V1/NetworkConfig.php new file mode 100644 index 000000000000..93a42fa20272 --- /dev/null +++ b/BackupDr/src/V1/NetworkConfig.php @@ -0,0 +1,109 @@ +google.cloud.backupdr.v1.NetworkConfig + */ +class NetworkConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The resource name of the Google Compute Engine VPC network to + * which the ManagementServer instance is connected. + * + * Generated from protobuf field string network = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $network = ''; + /** + * Optional. The network connect mode of the ManagementServer instance. For + * this version, only PRIVATE_SERVICE_ACCESS is supported. + * + * Generated from protobuf field .google.cloud.backupdr.v1.NetworkConfig.PeeringMode peering_mode = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $peering_mode = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $network + * Optional. The resource name of the Google Compute Engine VPC network to + * which the ManagementServer instance is connected. + * @type int $peering_mode + * Optional. The network connect mode of the ManagementServer instance. For + * this version, only PRIVATE_SERVICE_ACCESS is supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Backupdr\V1\Backupdr::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The resource name of the Google Compute Engine VPC network to + * which the ManagementServer instance is connected. + * + * Generated from protobuf field string network = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getNetwork() + { + return $this->network; + } + + /** + * Optional. The resource name of the Google Compute Engine VPC network to + * which the ManagementServer instance is connected. + * + * Generated from protobuf field string network = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setNetwork($var) + { + GPBUtil::checkString($var, True); + $this->network = $var; + + return $this; + } + + /** + * Optional. The network connect mode of the ManagementServer instance. For + * this version, only PRIVATE_SERVICE_ACCESS is supported. + * + * Generated from protobuf field .google.cloud.backupdr.v1.NetworkConfig.PeeringMode peering_mode = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPeeringMode() + { + return $this->peering_mode; + } + + /** + * Optional. The network connect mode of the ManagementServer instance. For + * this version, only PRIVATE_SERVICE_ACCESS is supported. + * + * Generated from protobuf field .google.cloud.backupdr.v1.NetworkConfig.PeeringMode peering_mode = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPeeringMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\BackupDR\V1\NetworkConfig\PeeringMode::class); + $this->peering_mode = $var; + + return $this; + } + +} + diff --git a/BackupDr/src/V1/NetworkConfig/PeeringMode.php b/BackupDr/src/V1/NetworkConfig/PeeringMode.php new file mode 100644 index 000000000000..1cd2cf87fa9a --- /dev/null +++ b/BackupDr/src/V1/NetworkConfig/PeeringMode.php @@ -0,0 +1,57 @@ +google.cloud.backupdr.v1.NetworkConfig.PeeringMode + */ +class PeeringMode +{ + /** + * Peering mode not set. + * + * Generated from protobuf enum PEERING_MODE_UNSPECIFIED = 0; + */ + const PEERING_MODE_UNSPECIFIED = 0; + /** + * Connect using Private Service Access to the Management Server. Private + * services access provides an IP address range for multiple Google Cloud + * services, including Cloud BackupDR. + * + * Generated from protobuf enum PRIVATE_SERVICE_ACCESS = 1; + */ + const PRIVATE_SERVICE_ACCESS = 1; + + private static $valueToName = [ + self::PEERING_MODE_UNSPECIFIED => 'PEERING_MODE_UNSPECIFIED', + self::PRIVATE_SERVICE_ACCESS => 'PRIVATE_SERVICE_ACCESS', + ]; + + 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/BackupDr/src/V1/OperationMetadata.php b/BackupDr/src/V1/OperationMetadata.php new file mode 100644 index 000000000000..822d7b9a09a9 --- /dev/null +++ b/BackupDr/src/V1/OperationMetadata.php @@ -0,0 +1,345 @@ +google.cloud.backupdr.v1.OperationMetadata + */ +class OperationMetadata 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]; + */ + protected $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]; + */ + protected $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]; + */ + protected $target = ''; + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $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]; + */ + protected $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]; + */ + protected $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]; + */ + protected $api_version = ''; + /** + * Output only. AdditionalInfo contains additional Info related to backup plan + * association resource. + * + * Generated from protobuf field map additional_info = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $additional_info; + + /** + * 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. + * @type array|\Google\Protobuf\Internal\MapField $additional_info + * Output only. AdditionalInfo contains additional Info related to backup plan + * association resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Backupdr\V1\Backupdr::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; + } + + /** + * Output only. AdditionalInfo contains additional Info related to backup plan + * association resource. + * + * Generated from protobuf field map additional_info = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAdditionalInfo() + { + return $this->additional_info; + } + + /** + * Output only. AdditionalInfo contains additional Info related to backup plan + * association resource. + * + * Generated from protobuf field map additional_info = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAdditionalInfo($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->additional_info = $arr; + + return $this; + } + +} + diff --git a/BackupDr/src/V1/WorkforceIdentityBasedManagementURI.php b/BackupDr/src/V1/WorkforceIdentityBasedManagementURI.php new file mode 100644 index 000000000000..d12b8eb71a64 --- /dev/null +++ b/BackupDr/src/V1/WorkforceIdentityBasedManagementURI.php @@ -0,0 +1,101 @@ +google.cloud.backupdr.v1.WorkforceIdentityBasedManagementURI + */ +class WorkforceIdentityBasedManagementURI extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. First party Management URI for Google Identities. + * + * Generated from protobuf field string first_party_management_uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $first_party_management_uri = ''; + /** + * Output only. Third party Management URI for External Identity Providers. + * + * Generated from protobuf field string third_party_management_uri = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $third_party_management_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $first_party_management_uri + * Output only. First party Management URI for Google Identities. + * @type string $third_party_management_uri + * Output only. Third party Management URI for External Identity Providers. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Backupdr\V1\Backupdr::initOnce(); + parent::__construct($data); + } + + /** + * Output only. First party Management URI for Google Identities. + * + * Generated from protobuf field string first_party_management_uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getFirstPartyManagementUri() + { + return $this->first_party_management_uri; + } + + /** + * Output only. First party Management URI for Google Identities. + * + * Generated from protobuf field string first_party_management_uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setFirstPartyManagementUri($var) + { + GPBUtil::checkString($var, True); + $this->first_party_management_uri = $var; + + return $this; + } + + /** + * Output only. Third party Management URI for External Identity Providers. + * + * Generated from protobuf field string third_party_management_uri = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getThirdPartyManagementUri() + { + return $this->third_party_management_uri; + } + + /** + * Output only. Third party Management URI for External Identity Providers. + * + * Generated from protobuf field string third_party_management_uri = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setThirdPartyManagementUri($var) + { + GPBUtil::checkString($var, True); + $this->third_party_management_uri = $var; + + return $this; + } + +} + diff --git a/BackupDr/src/V1/WorkforceIdentityBasedOAuth2ClientID.php b/BackupDr/src/V1/WorkforceIdentityBasedOAuth2ClientID.php new file mode 100644 index 000000000000..dd38518e5411 --- /dev/null +++ b/BackupDr/src/V1/WorkforceIdentityBasedOAuth2ClientID.php @@ -0,0 +1,101 @@ +google.cloud.backupdr.v1.WorkforceIdentityBasedOAuth2ClientID + */ +class WorkforceIdentityBasedOAuth2ClientID extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. First party OAuth Client ID for Google Identities. + * + * Generated from protobuf field string first_party_oauth2_client_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $first_party_oauth2_client_id = ''; + /** + * Output only. Third party OAuth Client ID for External Identity Providers. + * + * Generated from protobuf field string third_party_oauth2_client_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $third_party_oauth2_client_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $first_party_oauth2_client_id + * Output only. First party OAuth Client ID for Google Identities. + * @type string $third_party_oauth2_client_id + * Output only. Third party OAuth Client ID for External Identity Providers. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Backupdr\V1\Backupdr::initOnce(); + parent::__construct($data); + } + + /** + * Output only. First party OAuth Client ID for Google Identities. + * + * Generated from protobuf field string first_party_oauth2_client_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getFirstPartyOauth2ClientId() + { + return $this->first_party_oauth2_client_id; + } + + /** + * Output only. First party OAuth Client ID for Google Identities. + * + * Generated from protobuf field string first_party_oauth2_client_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setFirstPartyOauth2ClientId($var) + { + GPBUtil::checkString($var, True); + $this->first_party_oauth2_client_id = $var; + + return $this; + } + + /** + * Output only. Third party OAuth Client ID for External Identity Providers. + * + * Generated from protobuf field string third_party_oauth2_client_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getThirdPartyOauth2ClientId() + { + return $this->third_party_oauth2_client_id; + } + + /** + * Output only. Third party OAuth Client ID for External Identity Providers. + * + * Generated from protobuf field string third_party_oauth2_client_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setThirdPartyOauth2ClientId($var) + { + GPBUtil::checkString($var, True); + $this->third_party_oauth2_client_id = $var; + + return $this; + } + +} + diff --git a/BackupDr/src/V1/gapic_metadata.json b/BackupDr/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..37b3567fa87d --- /dev/null +++ b/BackupDr/src/V1/gapic_metadata.json @@ -0,0 +1,63 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.backupdr.v1", + "libraryPackage": "Google\\Cloud\\BackupDR\\V1", + "services": { + "BackupDR": { + "clients": { + "grpc": { + "libraryClient": "BackupDRGapicClient", + "rpcs": { + "CreateManagementServer": { + "methods": [ + "createManagementServer" + ] + }, + "DeleteManagementServer": { + "methods": [ + "deleteManagementServer" + ] + }, + "GetManagementServer": { + "methods": [ + "getManagementServer" + ] + }, + "ListManagementServers": { + "methods": [ + "listManagementServers" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/BackupDr/src/V1/resources/backup_dr_client_config.json b/BackupDr/src/V1/resources/backup_dr_client_config.json new file mode 100644 index 000000000000..5c162679d6d7 --- /dev/null +++ b/BackupDr/src/V1/resources/backup_dr_client_config.json @@ -0,0 +1,89 @@ +{ + "interfaces": { + "google.cloud.backupdr.v1.BackupDR": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "no_retry_1_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "CreateManagementServer": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteManagementServer": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetManagementServer": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListManagementServers": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "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/BackupDr/src/V1/resources/backup_dr_descriptor_config.php b/BackupDr/src/V1/resources/backup_dr_descriptor_config.php new file mode 100644 index 000000000000..44417b94b54a --- /dev/null +++ b/BackupDr/src/V1/resources/backup_dr_descriptor_config.php @@ -0,0 +1,175 @@ + [ + 'google.cloud.backupdr.v1.BackupDR' => [ + 'CreateManagementServer' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\BackupDR\V1\ManagementServer', + 'metadataReturnType' => '\Google\Cloud\BackupDR\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteManagementServer' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\BackupDR\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetManagementServer' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\BackupDR\V1\ManagementServer', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListManagementServers' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getManagementServers', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\BackupDR\V1\ListManagementServersResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetLocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Location\Location', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'GetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'SetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'TestIamPermissions' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'templateMap' => [ + 'location' => 'projects/{project}/locations/{location}', + 'managementServer' => 'projects/{project}/locations/{location}/managementServers/{managementserver}', + ], + ], + ], +]; diff --git a/BackupDr/src/V1/resources/backup_dr_rest_client_config.php b/BackupDr/src/V1/resources/backup_dr_rest_client_config.php new file mode 100644 index 000000000000..d222523ff2d5 --- /dev/null +++ b/BackupDr/src/V1/resources/backup_dr_rest_client_config.php @@ -0,0 +1,192 @@ + [ + 'google.cloud.backupdr.v1.BackupDR' => [ + 'CreateManagementServer' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/managementServers', + 'body' => 'management_server', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'management_server_id', + ], + ], + 'DeleteManagementServer' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/managementServers/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetManagementServer' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/managementServers/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListManagementServers' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/managementServers', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + '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/*/managementServers/*}:getIamPolicy', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/managementServers/*}:setIamPolicy', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/managementServers/*}:testIamPermissions', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/backupVaults/*}: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', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/BackupDr/tests/Unit/V1/Client/BackupDRClientTest.php b/BackupDr/tests/Unit/V1/Client/BackupDRClientTest.php new file mode 100644 index 000000000000..f54477fdb478 --- /dev/null +++ b/BackupDr/tests/Unit/V1/Client/BackupDRClientTest.php @@ -0,0 +1,909 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return BackupDRClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new BackupDRClient($options); + } + + /** @test */ + public function createManagementServerTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + '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/createManagementServerTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $etag = 'etag3123477'; + $oauth2ClientId = 'oauth2ClientId-1833466037'; + $expectedResponse = new ManagementServer(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setEtag($etag); + $expectedResponse->setOauth2ClientId($oauth2ClientId); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createManagementServerTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $managementServerId = 'managementServerId1884787355'; + $managementServer = new ManagementServer(); + $managementServerNetworks = []; + $managementServer->setNetworks($managementServerNetworks); + $request = (new CreateManagementServerRequest()) + ->setParent($formattedParent) + ->setManagementServerId($managementServerId) + ->setManagementServer($managementServer); + $response = $gapicClient->createManagementServer($request); + $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.backupdr.v1.BackupDR/CreateManagementServer', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getManagementServerId(); + $this->assertProtobufEquals($managementServerId, $actualValue); + $actualValue = $actualApiRequestObject->getManagementServer(); + $this->assertProtobufEquals($managementServer, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createManagementServerTest'); + $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 createManagementServerExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + '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/createManagementServerTest'); + $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]'); + $managementServerId = 'managementServerId1884787355'; + $managementServer = new ManagementServer(); + $managementServerNetworks = []; + $managementServer->setNetworks($managementServerNetworks); + $request = (new CreateManagementServerRequest()) + ->setParent($formattedParent) + ->setManagementServerId($managementServerId) + ->setManagementServer($managementServer); + $response = $gapicClient->createManagementServer($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createManagementServerTest'); + 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 deleteManagementServerTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + '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/deleteManagementServerTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteManagementServerTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->managementServerName('[PROJECT]', '[LOCATION]', '[MANAGEMENTSERVER]'); + $request = (new DeleteManagementServerRequest())->setName($formattedName); + $response = $gapicClient->deleteManagementServer($request); + $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.backupdr.v1.BackupDR/DeleteManagementServer', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteManagementServerTest'); + $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 deleteManagementServerExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + '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/deleteManagementServerTest'); + $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->managementServerName('[PROJECT]', '[LOCATION]', '[MANAGEMENTSERVER]'); + $request = (new DeleteManagementServerRequest())->setName($formattedName); + $response = $gapicClient->deleteManagementServer($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteManagementServerTest'); + 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 getManagementServerTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $etag = 'etag3123477'; + $oauth2ClientId = 'oauth2ClientId-1833466037'; + $expectedResponse = new ManagementServer(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setEtag($etag); + $expectedResponse->setOauth2ClientId($oauth2ClientId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->managementServerName('[PROJECT]', '[LOCATION]', '[MANAGEMENTSERVER]'); + $request = (new GetManagementServerRequest())->setName($formattedName); + $response = $gapicClient->getManagementServer($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.backupdr.v1.BackupDR/GetManagementServer', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getManagementServerExceptionTest() + { + $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->managementServerName('[PROJECT]', '[LOCATION]', '[MANAGEMENTSERVER]'); + $request = (new GetManagementServerRequest())->setName($formattedName); + try { + $gapicClient->getManagementServer($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listManagementServersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $managementServersElement = new ManagementServer(); + $managementServers = [$managementServersElement]; + $expectedResponse = new ListManagementServersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setManagementServers($managementServers); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListManagementServersRequest())->setParent($formattedParent); + $response = $gapicClient->listManagementServers($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getManagementServers()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.backupdr.v1.BackupDR/ListManagementServers', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listManagementServersExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListManagementServersRequest())->setParent($formattedParent); + try { + $gapicClient->listManagementServers($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $request = new GetLocationRequest(); + $response = $gapicClient->getLocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + $request = new GetLocationRequest(); + try { + $gapicClient->getLocation($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [$locationsElement]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function 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'; + $request = (new GetIamPolicyRequest())->setResource($resource); + $response = $gapicClient->getIamPolicy($request); + $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'; + $request = (new GetIamPolicyRequest())->setResource($resource); + try { + $gapicClient->getIamPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function 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(); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); + $response = $gapicClient->setIamPolicy($request); + $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(); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); + try { + $gapicClient->setIamPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function 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 = []; + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); + $response = $gapicClient->testIamPermissions($request); + $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 = []; + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); + try { + $gapicClient->testIamPermissions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createManagementServerAsyncTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + '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/createManagementServerTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $etag = 'etag3123477'; + $oauth2ClientId = 'oauth2ClientId-1833466037'; + $expectedResponse = new ManagementServer(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setEtag($etag); + $expectedResponse->setOauth2ClientId($oauth2ClientId); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createManagementServerTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $managementServerId = 'managementServerId1884787355'; + $managementServer = new ManagementServer(); + $managementServerNetworks = []; + $managementServer->setNetworks($managementServerNetworks); + $request = (new CreateManagementServerRequest()) + ->setParent($formattedParent) + ->setManagementServerId($managementServerId) + ->setManagementServer($managementServer); + $response = $gapicClient->createManagementServerAsync($request)->wait(); + $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.backupdr.v1.BackupDR/CreateManagementServer', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getManagementServerId(); + $this->assertProtobufEquals($managementServerId, $actualValue); + $actualValue = $actualApiRequestObject->getManagementServer(); + $this->assertProtobufEquals($managementServer, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createManagementServerTest'); + $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()); + } +} diff --git a/composer.json b/composer.json index dbb61c32dff7..b45b7aaa3bf0 100644 --- a/composer.json +++ b/composer.json @@ -91,6 +91,7 @@ "google/cloud-asset": "1.16.3", "google/cloud-assured-workloads": "0.11.5", "google/cloud-automl": "1.6.5", + "google/cloud-backupdr": "0.0.0", "google/cloud-bare-metal-solution": "0.6.5", "google/cloud-batch": "0.16.9", "google/cloud-beyondcorp-appconnections": "0.4.5", @@ -293,6 +294,7 @@ "GPBMetadata\\Google\\Cloud\\Assuredworkloads\\": "AssuredWorkloads/metadata", "GPBMetadata\\Google\\Cloud\\Audit\\": "CommonProtos/metadata/Audit", "GPBMetadata\\Google\\Cloud\\Automl\\": "AutoMl/metadata", + "GPBMetadata\\Google\\Cloud\\Backupdr\\": "BackupDr/metadata", "GPBMetadata\\Google\\Cloud\\Baremetalsolution\\": "BareMetalSolution/metadata", "GPBMetadata\\Google\\Cloud\\Batch\\": "Batch/metadata", "GPBMetadata\\Google\\Cloud\\Beyondcorp\\Appconnections\\": "BeyondCorpAppConnections/metadata", @@ -488,6 +490,7 @@ "Google\\Cloud\\Asset\\": "Asset/src", "Google\\Cloud\\AssuredWorkloads\\": "AssuredWorkloads/src", "Google\\Cloud\\AutoMl\\": "AutoMl/src", + "Google\\Cloud\\BackupDR\\": "BackupDr/src", "Google\\Cloud\\BareMetalSolution\\": "BareMetalSolution/src", "Google\\Cloud\\Batch\\": "Batch/src", "Google\\Cloud\\BeyondCorp\\AppConnections\\": "BeyondCorpAppConnections/src",