From 8698af504c17fce3929a7c6e98ec3ce7a4d91316 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Wed, 17 Apr 2024 21:48:10 +0000 Subject: [PATCH 1/3] feat: introduce StorageControl --- StorageControl/.OwlBot.yaml | 4 + StorageControl/.gitattributes | 8 + .../.github/pull_request_template.md | 24 + StorageControl/.repo-metadata.json | 8 + StorageControl/CONTRIBUTING.md | 10 + StorageControl/LICENSE | 202 ++++ StorageControl/README.md | 48 + StorageControl/VERSION | 1 + StorageControl/composer.json | 31 + StorageControl/metadata/V2/StorageControl.php | Bin 0 -> 7875 bytes StorageControl/owlbot.py | 62 ++ StorageControl/phpunit.xml.dist | 16 + .../V2/StorageControlClient/create_folder.php | 80 ++ .../create_managed_folder.php | 77 ++ .../V2/StorageControlClient/delete_folder.php | 70 ++ .../delete_managed_folder.php | 75 ++ .../V2/StorageControlClient/get_folder.php | 72 ++ .../get_managed_folder.php | 77 ++ .../get_storage_layout.php | 72 ++ .../V2/StorageControlClient/list_folders.php | 76 ++ .../list_managed_folders.php | 76 ++ .../V2/StorageControlClient/rename_folder.php | 89 ++ .../src/V2/Client/StorageControlClient.php | 589 ++++++++++++ .../V2/CommonLongRunningOperationMetadata.php | 273 ++++++ StorageControl/src/V2/CreateFolderRequest.php | 278 ++++++ .../src/V2/CreateManagedFolderRequest.php | 221 +++++ StorageControl/src/V2/DeleteFolderRequest.php | 224 +++++ .../src/V2/DeleteManagedFolderRequest.php | 271 ++++++ StorageControl/src/V2/Folder.php | 257 +++++ StorageControl/src/V2/GetFolderRequest.php | 220 +++++ .../src/V2/GetManagedFolderRequest.php | 225 +++++ .../src/V2/GetStorageLayoutRequest.php | 162 ++++ StorageControl/src/V2/ListFoldersRequest.php | 367 ++++++++ StorageControl/src/V2/ListFoldersResponse.php | 105 +++ .../src/V2/ListManagedFoldersRequest.php | 233 +++++ .../src/V2/ListManagedFoldersResponse.php | 105 +++ StorageControl/src/V2/ManagedFolder.php | 205 ++++ StorageControl/src/V2/PendingRenameInfo.php | 67 ++ .../src/V2/RenameFolderMetadata.php | 146 +++ StorageControl/src/V2/RenameFolderRequest.php | 260 ++++++ StorageControl/src/V2/StorageLayout.php | 239 +++++ .../StorageLayout/CustomPlacementConfig.php | 70 ++ .../StorageLayout/HierarchicalNamespace.php | 68 ++ StorageControl/src/V2/gapic_metadata.json | 68 ++ .../storage_control_client_config.json | 98 ++ .../storage_control_descriptor_config.php | 222 +++++ .../storage_control_rest_client_config.php | 25 + .../V2/Client/StorageControlClientTest.php | 882 ++++++++++++++++++ composer.json | 9 +- 49 files changed, 7064 insertions(+), 3 deletions(-) create mode 100644 StorageControl/.OwlBot.yaml create mode 100644 StorageControl/.gitattributes create mode 100644 StorageControl/.github/pull_request_template.md create mode 100644 StorageControl/.repo-metadata.json create mode 100644 StorageControl/CONTRIBUTING.md create mode 100644 StorageControl/LICENSE create mode 100644 StorageControl/README.md create mode 100644 StorageControl/VERSION create mode 100644 StorageControl/composer.json create mode 100644 StorageControl/metadata/V2/StorageControl.php create mode 100644 StorageControl/owlbot.py create mode 100644 StorageControl/phpunit.xml.dist create mode 100644 StorageControl/samples/V2/StorageControlClient/create_folder.php create mode 100644 StorageControl/samples/V2/StorageControlClient/create_managed_folder.php create mode 100644 StorageControl/samples/V2/StorageControlClient/delete_folder.php create mode 100644 StorageControl/samples/V2/StorageControlClient/delete_managed_folder.php create mode 100644 StorageControl/samples/V2/StorageControlClient/get_folder.php create mode 100644 StorageControl/samples/V2/StorageControlClient/get_managed_folder.php create mode 100644 StorageControl/samples/V2/StorageControlClient/get_storage_layout.php create mode 100644 StorageControl/samples/V2/StorageControlClient/list_folders.php create mode 100644 StorageControl/samples/V2/StorageControlClient/list_managed_folders.php create mode 100644 StorageControl/samples/V2/StorageControlClient/rename_folder.php create mode 100644 StorageControl/src/V2/Client/StorageControlClient.php create mode 100644 StorageControl/src/V2/CommonLongRunningOperationMetadata.php create mode 100644 StorageControl/src/V2/CreateFolderRequest.php create mode 100644 StorageControl/src/V2/CreateManagedFolderRequest.php create mode 100644 StorageControl/src/V2/DeleteFolderRequest.php create mode 100644 StorageControl/src/V2/DeleteManagedFolderRequest.php create mode 100644 StorageControl/src/V2/Folder.php create mode 100644 StorageControl/src/V2/GetFolderRequest.php create mode 100644 StorageControl/src/V2/GetManagedFolderRequest.php create mode 100644 StorageControl/src/V2/GetStorageLayoutRequest.php create mode 100644 StorageControl/src/V2/ListFoldersRequest.php create mode 100644 StorageControl/src/V2/ListFoldersResponse.php create mode 100644 StorageControl/src/V2/ListManagedFoldersRequest.php create mode 100644 StorageControl/src/V2/ListManagedFoldersResponse.php create mode 100644 StorageControl/src/V2/ManagedFolder.php create mode 100644 StorageControl/src/V2/PendingRenameInfo.php create mode 100644 StorageControl/src/V2/RenameFolderMetadata.php create mode 100644 StorageControl/src/V2/RenameFolderRequest.php create mode 100644 StorageControl/src/V2/StorageLayout.php create mode 100644 StorageControl/src/V2/StorageLayout/CustomPlacementConfig.php create mode 100644 StorageControl/src/V2/StorageLayout/HierarchicalNamespace.php create mode 100644 StorageControl/src/V2/gapic_metadata.json create mode 100644 StorageControl/src/V2/resources/storage_control_client_config.json create mode 100644 StorageControl/src/V2/resources/storage_control_descriptor_config.php create mode 100644 StorageControl/src/V2/resources/storage_control_rest_client_config.php create mode 100644 StorageControl/tests/Unit/V2/Client/StorageControlClientTest.php diff --git a/StorageControl/.OwlBot.yaml b/StorageControl/.OwlBot.yaml new file mode 100644 index 000000000000..db48c19e8d01 --- /dev/null +++ b/StorageControl/.OwlBot.yaml @@ -0,0 +1,4 @@ +deep-copy-regex: + - source: /google/storage/control/(v2)/.*-php/(.*) + dest: /owl-bot-staging/StorageControl/$1/$2 +api-name: StorageControl diff --git a/StorageControl/.gitattributes b/StorageControl/.gitattributes new file mode 100644 index 000000000000..8119e7fcc1b2 --- /dev/null +++ b/StorageControl/.gitattributes @@ -0,0 +1,8 @@ +/*.xml.dist export-ignore +/.OwlBot.yaml export-ignore +/.github export-ignore +/.repo-metadata.json export-ignore +/owlbot.py export-ignore +/src/**/gapic_metadata.json export-ignore +/samples export-ignore +/tests export-ignore diff --git a/StorageControl/.github/pull_request_template.md b/StorageControl/.github/pull_request_template.md new file mode 100644 index 000000000000..c747bcf4652b --- /dev/null +++ b/StorageControl/.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 `StorageControl/src`, and tests in `StorageControl/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/StorageControl/.repo-metadata.json b/StorageControl/.repo-metadata.json new file mode 100644 index 000000000000..74e764e608ed --- /dev/null +++ b/StorageControl/.repo-metadata.json @@ -0,0 +1,8 @@ +{ + "language": "php", + "distribution_name": "google/cloud-storage-control", + "release_level": "preview", + "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-storage-control/latest", + "library_type": "GAPIC_AUTO", + "api_shortname": "storage" +} diff --git a/StorageControl/CONTRIBUTING.md b/StorageControl/CONTRIBUTING.md new file mode 100644 index 000000000000..76ea811cacdb --- /dev/null +++ b/StorageControl/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/StorageControl/LICENSE b/StorageControl/LICENSE new file mode 100644 index 000000000000..8f71f43fee3f --- /dev/null +++ b/StorageControl/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/StorageControl/README.md b/StorageControl/README.md new file mode 100644 index 000000000000..e76583c9bb49 --- /dev/null +++ b/StorageControl/README.md @@ -0,0 +1,48 @@ +# Google Cloud Storage Control for PHP + +> Idiomatic PHP client for [Google Cloud Storage Control](https://cloud.google.com/storage). + +[![Latest Stable Version](https://poser.pugx.org/google/cloud-storage-control/v/stable)](https://packagist.org/packages/google/cloud-storage-control) [![Packagist](https://img.shields.io/packagist/dm/google/cloud-storage-control.svg)](https://packagist.org/packages/google/cloud-storage-control) + +* [API documentation](https://cloud.google.com/php/docs/reference/cloud-storage-control/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-storage-control +``` + +This component requires the gRPC extension. Please see our [gRPC installation guide](https://cloud.google.com/php/grpc) +for more information on how to configure the extension. + +> 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-storage-control/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/storage/docs/overview). diff --git a/StorageControl/VERSION b/StorageControl/VERSION new file mode 100644 index 000000000000..77d6f4ca2371 --- /dev/null +++ b/StorageControl/VERSION @@ -0,0 +1 @@ +0.0.0 diff --git a/StorageControl/composer.json b/StorageControl/composer.json new file mode 100644 index 000000000000..ca487cadc5b2 --- /dev/null +++ b/StorageControl/composer.json @@ -0,0 +1,31 @@ +{ + "name": "google/cloud-storage-control", + "description": "Google Cloud Storage Control Client for PHP", + "license": "Apache-2.0", + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "Google\\Cloud\\Storage\\Control\\": "src", + "GPBMetadata\\Google\\Storage\\Control\\": "metadata" + } + }, + "extra": { + "component": { + "id": "cloud-storage-control", + "path": "StorageControl", + "target": "googleapis/google-cloud-php-storage-control" + } + }, + "require": { + "php": "^8.0", + "ext-grpc": "*", + "google/gax": "^1.30.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/StorageControl/metadata/V2/StorageControl.php b/StorageControl/metadata/V2/StorageControl.php new file mode 100644 index 0000000000000000000000000000000000000000..6292a961c287f7376a684775318050b6606f1887 GIT binary patch literal 7875 zcmds6-EZ7j6~~_4Ho2imdqb1iDQ&$@*=DopjCOX*O73QnCu!44{fI(U2{e-Bc}YctB`X2_$%01dpuXj{qKcs-S5IGA;#HN|M##6j zBo1wdXq#J&dnB=2c49X-nVIIdxtZoVH`9Dnzk!hB*>S9iPvQ&u1ZnUW_I5ni(c;8T z;NKNDwp`y$T-$Sh0FzqN+O`)HFwrmD?)gsQ2EIlW9{3Jfep}-wS`zh0esoQX zNYab^8_aKN;4ph?4v3l=y3KXZC4OQUN7Fgd9;S24C0?sRcI`bkh)$q-$8QIdscjRH zHxv1}9rO~{?~Fgx-N5feJ>LhV=7W%?I3OL5ub;sU!M@oIlY2nKK+;Rpuh5su0<8@SJnwKmNHYe%F3 zU#67{eF83kEj|jvHL4v6M8&6aPA}rHi7!jyi+6-gEy%DrHZ0=`SZ_5#qc1+DPG=vJ zG{js$e+Ql0B7O@{-zJo1Xnx`aG@T7oRy1XKx>0&=mh=}YI&~}XS|q~f&}&ru=<5`| zfM&bEO&v~pq$f`JAkXO$r#U9h6Tq?bUS5eu%4mkzigJ-b>R(7gKreGT<0Pc64hZ9v?u2zek)T zu6-h&4r@C-=VLCj=CL34vRz7}^wu>FXSTMTFS0$c#$kvl zcpefbB5n6EBOCD&th9*dc3o&m%2O%43f9oPM;^OQ(24AD*L5r?Ls3%Z%Z&kj37wNA zfMFP=2+Q)~nC@E~`VN|xq7jEsUkR?GlmQ^YOF)XFGZinQIiEaEtlY$DmQU-yP|-Z+ z@xjSPDR6B1(9!u8aF6S=R=_%17Fpa>TtG3LIL4tE$|M6RhKK)^QOsv5($|A-H}Gk* zv(1~Gtk+5V>f@z~*1s`I)w^g4GJ;n(PC1iSH_A3+378B>+;MRXP_QwN%l*n%Fyp_EDk%+^s!|6D;|%co8jjz?$?>Kp`(RT8@M zU`#wyUn`*0F~VF%XL)0r%Pf|~;OUUWV|=Xty@bw)oy}eQ02-$LW~7AAqbV**xZWy_n7|1H?iIoX~U>{~w6GqzFYCGyzb<`p*{e^AgHwD*(3lQqQuT@t*SzF5Y% ze`}{dMwLM`5KXL!=HwLOb!DbLb}A0-Y3pCip;=K5#6c$hOhI4G?-g;iAmj6bA|)%M zdu;uKXXYZ`c&_r!SNwy;@#$aw@iTQ1S`4u>#WP}uPiYbV1f0un_zIoN3#QI3q>}-f zW+$jscAiE(VrMRF_!ZcRJ)zk~q&%{jF!Fz^fR)F95%MBV34IUNCj+Vmgo9v0XLW zX6XJ?^HO$W>#odxH@q6H8J|X;pa(GM}_ODkAssy5>Dq;w3a1>lV|GhvqK<> zD)IFKcZZkPN|DFX0Q%-Lvw2l4cbUmn<)0&$|1Y!i9%+QaDGV>3l~+y%A{}JsMx=uz zJWe`D3MWqo@Rgk)N#pUqFz-6RQP zqgLDB-xuCzC&+d$*{wNV&}&_Tjc3vhqVDQs;#D{|ZCwj|?_i{2i|nONwtJqJ-ZW04 zM+dVe9gHdMM{w@e__c~I!imCg5F7J?PDH)mqIGaf`R*DEQmO|g;Cd&$GR#7)|Dh8=Osy|I7ns7A;BF*e>HM?Ae+truq61QU* zOv*5XCHT!pH4Kn4H-;Y1H`u)ZUdjsg@GFBIIKza=zjrme+gjyUpShdTp|_+=l3!^a IqC + + + + src + + + src/V[!a-zA-Z]* + + + + + tests/Unit + + + diff --git a/StorageControl/samples/V2/StorageControlClient/create_folder.php b/StorageControl/samples/V2/StorageControlClient/create_folder.php new file mode 100644 index 000000000000..7a80bb4eeadb --- /dev/null +++ b/StorageControl/samples/V2/StorageControlClient/create_folder.php @@ -0,0 +1,80 @@ +setParent($formattedParent) + ->setFolder($folder) + ->setFolderId($folderId); + + // Call the API and handle any network failures. + try { + /** @var Folder $response */ + $response = $storageControlClient->createFolder($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = StorageControlClient::bucketName('[PROJECT]', '[BUCKET]'); + $folderId = '[FOLDER_ID]'; + + create_folder_sample($formattedParent, $folderId); +} +// [END storage_v2_generated_StorageControl_CreateFolder_sync] diff --git a/StorageControl/samples/V2/StorageControlClient/create_managed_folder.php b/StorageControl/samples/V2/StorageControlClient/create_managed_folder.php new file mode 100644 index 000000000000..367c733b53f7 --- /dev/null +++ b/StorageControl/samples/V2/StorageControlClient/create_managed_folder.php @@ -0,0 +1,77 @@ +setParent($formattedParent) + ->setManagedFolder($managedFolder) + ->setManagedFolderId($managedFolderId); + + // Call the API and handle any network failures. + try { + /** @var ManagedFolder $response */ + $response = $storageControlClient->createManagedFolder($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = StorageControlClient::bucketName('[PROJECT]', '[BUCKET]'); + $managedFolderId = '[MANAGED_FOLDER_ID]'; + + create_managed_folder_sample($formattedParent, $managedFolderId); +} +// [END storage_v2_generated_StorageControl_CreateManagedFolder_sync] diff --git a/StorageControl/samples/V2/StorageControlClient/delete_folder.php b/StorageControl/samples/V2/StorageControlClient/delete_folder.php new file mode 100644 index 000000000000..f84ac441c87b --- /dev/null +++ b/StorageControl/samples/V2/StorageControlClient/delete_folder.php @@ -0,0 +1,70 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $storageControlClient->deleteFolder($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = StorageControlClient::folderName('[PROJECT]', '[BUCKET]', '[FOLDER]'); + + delete_folder_sample($formattedName); +} +// [END storage_v2_generated_StorageControl_DeleteFolder_sync] diff --git a/StorageControl/samples/V2/StorageControlClient/delete_managed_folder.php b/StorageControl/samples/V2/StorageControlClient/delete_managed_folder.php new file mode 100644 index 000000000000..5fec0fb26789 --- /dev/null +++ b/StorageControl/samples/V2/StorageControlClient/delete_managed_folder.php @@ -0,0 +1,75 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $storageControlClient->deleteManagedFolder($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = StorageControlClient::managedFolderName( + '[PROJECT]', + '[BUCKET]', + '[MANAGEDFOLDER]' + ); + + delete_managed_folder_sample($formattedName); +} +// [END storage_v2_generated_StorageControl_DeleteManagedFolder_sync] diff --git a/StorageControl/samples/V2/StorageControlClient/get_folder.php b/StorageControl/samples/V2/StorageControlClient/get_folder.php new file mode 100644 index 000000000000..5adcf302597a --- /dev/null +++ b/StorageControl/samples/V2/StorageControlClient/get_folder.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Folder $response */ + $response = $storageControlClient->getFolder($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 = StorageControlClient::folderName('[PROJECT]', '[BUCKET]', '[FOLDER]'); + + get_folder_sample($formattedName); +} +// [END storage_v2_generated_StorageControl_GetFolder_sync] diff --git a/StorageControl/samples/V2/StorageControlClient/get_managed_folder.php b/StorageControl/samples/V2/StorageControlClient/get_managed_folder.php new file mode 100644 index 000000000000..1d48475f4ef5 --- /dev/null +++ b/StorageControl/samples/V2/StorageControlClient/get_managed_folder.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var ManagedFolder $response */ + $response = $storageControlClient->getManagedFolder($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 = StorageControlClient::managedFolderName( + '[PROJECT]', + '[BUCKET]', + '[MANAGEDFOLDER]' + ); + + get_managed_folder_sample($formattedName); +} +// [END storage_v2_generated_StorageControl_GetManagedFolder_sync] diff --git a/StorageControl/samples/V2/StorageControlClient/get_storage_layout.php b/StorageControl/samples/V2/StorageControlClient/get_storage_layout.php new file mode 100644 index 000000000000..3a8b9e36aeb6 --- /dev/null +++ b/StorageControl/samples/V2/StorageControlClient/get_storage_layout.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var StorageLayout $response */ + $response = $storageControlClient->getStorageLayout($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 = StorageControlClient::storageLayoutName('[PROJECT]', '[BUCKET]'); + + get_storage_layout_sample($formattedName); +} +// [END storage_v2_generated_StorageControl_GetStorageLayout_sync] diff --git a/StorageControl/samples/V2/StorageControlClient/list_folders.php b/StorageControl/samples/V2/StorageControlClient/list_folders.php new file mode 100644 index 000000000000..24e99e6c3924 --- /dev/null +++ b/StorageControl/samples/V2/StorageControlClient/list_folders.php @@ -0,0 +1,76 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $storageControlClient->listFolders($request); + + /** @var Folder $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 = StorageControlClient::bucketName('[PROJECT]', '[BUCKET]'); + + list_folders_sample($formattedParent); +} +// [END storage_v2_generated_StorageControl_ListFolders_sync] diff --git a/StorageControl/samples/V2/StorageControlClient/list_managed_folders.php b/StorageControl/samples/V2/StorageControlClient/list_managed_folders.php new file mode 100644 index 000000000000..7b9623d4f14a --- /dev/null +++ b/StorageControl/samples/V2/StorageControlClient/list_managed_folders.php @@ -0,0 +1,76 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $storageControlClient->listManagedFolders($request); + + /** @var ManagedFolder $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 = StorageControlClient::bucketName('[PROJECT]', '[BUCKET]'); + + list_managed_folders_sample($formattedParent); +} +// [END storage_v2_generated_StorageControl_ListManagedFolders_sync] diff --git a/StorageControl/samples/V2/StorageControlClient/rename_folder.php b/StorageControl/samples/V2/StorageControlClient/rename_folder.php new file mode 100644 index 000000000000..bdac215ed944 --- /dev/null +++ b/StorageControl/samples/V2/StorageControlClient/rename_folder.php @@ -0,0 +1,89 @@ +setName($formattedName) + ->setDestinationFolderId($destinationFolderId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $storageControlClient->renameFolder($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Folder $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 +{ + $formattedName = StorageControlClient::folderName('[PROJECT]', '[BUCKET]', '[FOLDER]'); + $destinationFolderId = '[DESTINATION_FOLDER_ID]'; + + rename_folder_sample($formattedName, $destinationFolderId); +} +// [END storage_v2_generated_StorageControl_RenameFolder_sync] diff --git a/StorageControl/src/V2/Client/StorageControlClient.php b/StorageControl/src/V2/Client/StorageControlClient.php new file mode 100644 index 000000000000..995e8888d5b8 --- /dev/null +++ b/StorageControl/src/V2/Client/StorageControlClient.php @@ -0,0 +1,589 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/storage_control_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/storage_control_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/storage_control_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/storage_control_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; + } + + /** + * Formats a string containing the fully-qualified path to represent a bucket + * resource. + * + * @param string $project + * @param string $bucket + * + * @return string The formatted bucket resource. + */ + public static function bucketName(string $project, string $bucket): string + { + return self::getPathTemplate('bucket')->render([ + 'project' => $project, + 'bucket' => $bucket, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a folder + * resource. + * + * @param string $project + * @param string $bucket + * @param string $folder + * + * @return string The formatted folder resource. + */ + public static function folderName(string $project, string $bucket, string $folder): string + { + return self::getPathTemplate('folder')->render([ + 'project' => $project, + 'bucket' => $bucket, + 'folder' => $folder, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * managed_folder resource. + * + * @param string $project + * @param string $bucket + * @param string $managedFolder + * + * @return string The formatted managed_folder resource. + */ + public static function managedFolderName(string $project, string $bucket, string $managedFolder): string + { + return self::getPathTemplate('managedFolder')->render([ + 'project' => $project, + 'bucket' => $bucket, + 'managedFolder' => $managedFolder, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * storage_layout resource. + * + * @param string $project + * @param string $bucket + * + * @return string The formatted storage_layout resource. + */ + public static function storageLayoutName(string $project, string $bucket): string + { + return self::getPathTemplate('storageLayout')->render([ + 'project' => $project, + 'bucket' => $bucket, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - bucket: projects/{project}/buckets/{bucket} + * - folder: projects/{project}/buckets/{bucket}/folders/{folder=**} + * - managedFolder: projects/{project}/buckets/{bucket}/managedFolders/{managedFolder=**} + * - storageLayout: projects/{project}/buckets/{bucket}/storageLayout + * + * 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 'storage.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 folder. + * + * The async variant is {@see StorageControlClient::createFolderAsync()} . + * + * @example samples/V2/StorageControlClient/create_folder.php + * + * @param CreateFolderRequest $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 Folder + * + * @throws ApiException Thrown if the API call fails. + */ + public function createFolder(CreateFolderRequest $request, array $callOptions = []): Folder + { + return $this->startApiCall('CreateFolder', $request, $callOptions)->wait(); + } + + /** + * Creates a new managed folder. + * + * The async variant is {@see StorageControlClient::createManagedFolderAsync()} . + * + * @example samples/V2/StorageControlClient/create_managed_folder.php + * + * @param CreateManagedFolderRequest $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 ManagedFolder + * + * @throws ApiException Thrown if the API call fails. + */ + public function createManagedFolder(CreateManagedFolderRequest $request, array $callOptions = []): ManagedFolder + { + return $this->startApiCall('CreateManagedFolder', $request, $callOptions)->wait(); + } + + /** + * Permanently deletes an empty folder. + * + * The async variant is {@see StorageControlClient::deleteFolderAsync()} . + * + * @example samples/V2/StorageControlClient/delete_folder.php + * + * @param DeleteFolderRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteFolder(DeleteFolderRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteFolder', $request, $callOptions)->wait(); + } + + /** + * Permanently deletes an empty managed folder. + * + * The async variant is {@see StorageControlClient::deleteManagedFolderAsync()} . + * + * @example samples/V2/StorageControlClient/delete_managed_folder.php + * + * @param DeleteManagedFolderRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteManagedFolder(DeleteManagedFolderRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteManagedFolder', $request, $callOptions)->wait(); + } + + /** + * Returns metadata for the specified folder. + * + * The async variant is {@see StorageControlClient::getFolderAsync()} . + * + * @example samples/V2/StorageControlClient/get_folder.php + * + * @param GetFolderRequest $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 Folder + * + * @throws ApiException Thrown if the API call fails. + */ + public function getFolder(GetFolderRequest $request, array $callOptions = []): Folder + { + return $this->startApiCall('GetFolder', $request, $callOptions)->wait(); + } + + /** + * Returns metadata for the specified managed folder. + * + * The async variant is {@see StorageControlClient::getManagedFolderAsync()} . + * + * @example samples/V2/StorageControlClient/get_managed_folder.php + * + * @param GetManagedFolderRequest $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 ManagedFolder + * + * @throws ApiException Thrown if the API call fails. + */ + public function getManagedFolder(GetManagedFolderRequest $request, array $callOptions = []): ManagedFolder + { + return $this->startApiCall('GetManagedFolder', $request, $callOptions)->wait(); + } + + /** + * Returns the storage layout configuration for a given bucket. + * + * The async variant is {@see StorageControlClient::getStorageLayoutAsync()} . + * + * @example samples/V2/StorageControlClient/get_storage_layout.php + * + * @param GetStorageLayoutRequest $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 StorageLayout + * + * @throws ApiException Thrown if the API call fails. + */ + public function getStorageLayout(GetStorageLayoutRequest $request, array $callOptions = []): StorageLayout + { + return $this->startApiCall('GetStorageLayout', $request, $callOptions)->wait(); + } + + /** + * Retrieves a list of folders for a given bucket. + * + * The async variant is {@see StorageControlClient::listFoldersAsync()} . + * + * @example samples/V2/StorageControlClient/list_folders.php + * + * @param ListFoldersRequest $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 listFolders(ListFoldersRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListFolders', $request, $callOptions); + } + + /** + * Retrieves a list of managed folders for a given bucket. + * + * The async variant is {@see StorageControlClient::listManagedFoldersAsync()} . + * + * @example samples/V2/StorageControlClient/list_managed_folders.php + * + * @param ListManagedFoldersRequest $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 listManagedFolders(ListManagedFoldersRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListManagedFolders', $request, $callOptions); + } + + /** + * Renames a source folder to a destination folder. During a rename, the + * source and destination folders are locked until the long running operation + * completes. + * + * The async variant is {@see StorageControlClient::renameFolderAsync()} . + * + * @example samples/V2/StorageControlClient/rename_folder.php + * + * @param RenameFolderRequest $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 renameFolder(RenameFolderRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('RenameFolder', $request, $callOptions)->wait(); + } +} diff --git a/StorageControl/src/V2/CommonLongRunningOperationMetadata.php b/StorageControl/src/V2/CommonLongRunningOperationMetadata.php new file mode 100644 index 000000000000..67e1c36d73d3 --- /dev/null +++ b/StorageControl/src/V2/CommonLongRunningOperationMetadata.php @@ -0,0 +1,273 @@ +google.storage.control.v2.CommonLongRunningOperationMetadata + */ +class CommonLongRunningOperationMetadata 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. The time the operation was last modified. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. The type of operation invoked. + * + * Generated from protobuf field string type = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $type = ''; + /** + * Output only. Identifies whether the user has requested cancellation. + * + * Generated from protobuf field bool requested_cancellation = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $requested_cancellation = false; + /** + * Output only. The estimated progress of the operation in percentage [0, + * 100]. The value -1 means the progress is unknown. + * + * Generated from protobuf field int32 progress_percent = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $progress_percent = 0; + + /** + * 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 \Google\Protobuf\Timestamp $update_time + * Output only. The time the operation was last modified. + * @type string $type + * Output only. The type of operation invoked. + * @type bool $requested_cancellation + * Output only. Identifies whether the user has requested cancellation. + * @type int $progress_percent + * Output only. The estimated progress of the operation in percentage [0, + * 100]. The value -1 means the progress is unknown. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::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. The time the operation was last modified. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The time the operation was last modified. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Output only. The type of operation invoked. + * + * Generated from protobuf field string type = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Output only. The type of operation invoked. + * + * Generated from protobuf field string type = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Output only. Identifies whether the user has requested cancellation. + * + * Generated from protobuf field bool requested_cancellation = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getRequestedCancellation() + { + return $this->requested_cancellation; + } + + /** + * Output only. Identifies whether the user has requested cancellation. + * + * Generated from protobuf field bool requested_cancellation = 5 [(.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. The estimated progress of the operation in percentage [0, + * 100]. The value -1 means the progress is unknown. + * + * Generated from protobuf field int32 progress_percent = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getProgressPercent() + { + return $this->progress_percent; + } + + /** + * Output only. The estimated progress of the operation in percentage [0, + * 100]. The value -1 means the progress is unknown. + * + * Generated from protobuf field int32 progress_percent = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setProgressPercent($var) + { + GPBUtil::checkInt32($var); + $this->progress_percent = $var; + + return $this; + } + +} + diff --git a/StorageControl/src/V2/CreateFolderRequest.php b/StorageControl/src/V2/CreateFolderRequest.php new file mode 100644 index 000000000000..c57a8e1f0b9f --- /dev/null +++ b/StorageControl/src/V2/CreateFolderRequest.php @@ -0,0 +1,278 @@ +google.storage.control.v2.CreateFolderRequest + */ +class CreateFolderRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the bucket in which the folder will reside. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Properties of the new folder being created. + * The bucket and name of the folder are specified in the parent and folder_id + * fields, respectively. Populating those fields in `folder` will result in an + * error. + * + * Generated from protobuf field .google.storage.control.v2.Folder folder = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $folder = null; + /** + * Required. The full name of a folder, including all its parent folders. + * Folders use single '/' characters as a delimiter. + * The folder_id must end with a slash. + * For example, the folder_id of "books/biographies/" would create a new + * "biographies/" folder under the "books/" folder. + * + * Generated from protobuf field string folder_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $folder_id = ''; + /** + * Optional. If true, parent folder doesn't have to be present and all missing + * ancestor folders will be created atomically. + * + * Generated from protobuf field bool recursive = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $recursive = false; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. This request is only + * idempotent if a `request_id` is provided. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $parent Required. Name of the bucket in which the folder will reside. Please see + * {@see StorageControlClient::bucketName()} for help formatting this field. + * @param \Google\Cloud\Storage\Control\V2\Folder $folder Required. Properties of the new folder being created. + * The bucket and name of the folder are specified in the parent and folder_id + * fields, respectively. Populating those fields in `folder` will result in an + * error. + * @param string $folderId Required. The full name of a folder, including all its parent folders. + * Folders use single '/' characters as a delimiter. + * The folder_id must end with a slash. + * For example, the folder_id of "books/biographies/" would create a new + * "biographies/" folder under the "books/" folder. + * + * @return \Google\Cloud\Storage\Control\V2\CreateFolderRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Storage\Control\V2\Folder $folder, string $folderId): self + { + return (new self()) + ->setParent($parent) + ->setFolder($folder) + ->setFolderId($folderId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Name of the bucket in which the folder will reside. + * @type \Google\Cloud\Storage\Control\V2\Folder $folder + * Required. Properties of the new folder being created. + * The bucket and name of the folder are specified in the parent and folder_id + * fields, respectively. Populating those fields in `folder` will result in an + * error. + * @type string $folder_id + * Required. The full name of a folder, including all its parent folders. + * Folders use single '/' characters as a delimiter. + * The folder_id must end with a slash. + * For example, the folder_id of "books/biographies/" would create a new + * "biographies/" folder under the "books/" folder. + * @type bool $recursive + * Optional. If true, parent folder doesn't have to be present and all missing + * ancestor folders will be created atomically. + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. This request is only + * idempotent if a `request_id` is provided. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the bucket in which the folder will reside. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Name of the bucket in which the folder will reside. + * + * 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. Properties of the new folder being created. + * The bucket and name of the folder are specified in the parent and folder_id + * fields, respectively. Populating those fields in `folder` will result in an + * error. + * + * Generated from protobuf field .google.storage.control.v2.Folder folder = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Storage\Control\V2\Folder|null + */ + public function getFolder() + { + return $this->folder; + } + + public function hasFolder() + { + return isset($this->folder); + } + + public function clearFolder() + { + unset($this->folder); + } + + /** + * Required. Properties of the new folder being created. + * The bucket and name of the folder are specified in the parent and folder_id + * fields, respectively. Populating those fields in `folder` will result in an + * error. + * + * Generated from protobuf field .google.storage.control.v2.Folder folder = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Storage\Control\V2\Folder $var + * @return $this + */ + public function setFolder($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Storage\Control\V2\Folder::class); + $this->folder = $var; + + return $this; + } + + /** + * Required. The full name of a folder, including all its parent folders. + * Folders use single '/' characters as a delimiter. + * The folder_id must end with a slash. + * For example, the folder_id of "books/biographies/" would create a new + * "biographies/" folder under the "books/" folder. + * + * Generated from protobuf field string folder_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFolderId() + { + return $this->folder_id; + } + + /** + * Required. The full name of a folder, including all its parent folders. + * Folders use single '/' characters as a delimiter. + * The folder_id must end with a slash. + * For example, the folder_id of "books/biographies/" would create a new + * "biographies/" folder under the "books/" folder. + * + * Generated from protobuf field string folder_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFolderId($var) + { + GPBUtil::checkString($var, True); + $this->folder_id = $var; + + return $this; + } + + /** + * Optional. If true, parent folder doesn't have to be present and all missing + * ancestor folders will be created atomically. + * + * Generated from protobuf field bool recursive = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getRecursive() + { + return $this->recursive; + } + + /** + * Optional. If true, parent folder doesn't have to be present and all missing + * ancestor folders will be created atomically. + * + * Generated from protobuf field bool recursive = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setRecursive($var) + { + GPBUtil::checkBool($var); + $this->recursive = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. This request is only + * idempotent if a `request_id` is provided. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. This request is only + * idempotent if a `request_id` is provided. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/StorageControl/src/V2/CreateManagedFolderRequest.php b/StorageControl/src/V2/CreateManagedFolderRequest.php new file mode 100644 index 000000000000..e5320e9019f0 --- /dev/null +++ b/StorageControl/src/V2/CreateManagedFolderRequest.php @@ -0,0 +1,221 @@ +google.storage.control.v2.CreateManagedFolderRequest + */ +class CreateManagedFolderRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the bucket this managed folder belongs to. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Properties of the managed folder being created. + * The bucket and managed folder names are specified in the `parent` and + * `managed_folder_id` fields. Populating these fields in `managed_folder` + * will result in an error. + * + * Generated from protobuf field .google.storage.control.v2.ManagedFolder managed_folder = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $managed_folder = null; + /** + * Required. The name of the managed folder. It uses a single `/` as delimiter + * and leading and trailing `/` are allowed. + * + * Generated from protobuf field string managed_folder_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $managed_folder_id = ''; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $parent Required. Name of the bucket this managed folder belongs to. Please see + * {@see StorageControlClient::bucketName()} for help formatting this field. + * @param \Google\Cloud\Storage\Control\V2\ManagedFolder $managedFolder Required. Properties of the managed folder being created. + * The bucket and managed folder names are specified in the `parent` and + * `managed_folder_id` fields. Populating these fields in `managed_folder` + * will result in an error. + * @param string $managedFolderId Required. The name of the managed folder. It uses a single `/` as delimiter + * and leading and trailing `/` are allowed. + * + * @return \Google\Cloud\Storage\Control\V2\CreateManagedFolderRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Storage\Control\V2\ManagedFolder $managedFolder, string $managedFolderId): self + { + return (new self()) + ->setParent($parent) + ->setManagedFolder($managedFolder) + ->setManagedFolderId($managedFolderId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Name of the bucket this managed folder belongs to. + * @type \Google\Cloud\Storage\Control\V2\ManagedFolder $managed_folder + * Required. Properties of the managed folder being created. + * The bucket and managed folder names are specified in the `parent` and + * `managed_folder_id` fields. Populating these fields in `managed_folder` + * will result in an error. + * @type string $managed_folder_id + * Required. The name of the managed folder. It uses a single `/` as delimiter + * and leading and trailing `/` are allowed. + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the bucket this managed folder belongs to. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Name of the bucket this managed folder belongs to. + * + * 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. Properties of the managed folder being created. + * The bucket and managed folder names are specified in the `parent` and + * `managed_folder_id` fields. Populating these fields in `managed_folder` + * will result in an error. + * + * Generated from protobuf field .google.storage.control.v2.ManagedFolder managed_folder = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Storage\Control\V2\ManagedFolder|null + */ + public function getManagedFolder() + { + return $this->managed_folder; + } + + public function hasManagedFolder() + { + return isset($this->managed_folder); + } + + public function clearManagedFolder() + { + unset($this->managed_folder); + } + + /** + * Required. Properties of the managed folder being created. + * The bucket and managed folder names are specified in the `parent` and + * `managed_folder_id` fields. Populating these fields in `managed_folder` + * will result in an error. + * + * Generated from protobuf field .google.storage.control.v2.ManagedFolder managed_folder = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Storage\Control\V2\ManagedFolder $var + * @return $this + */ + public function setManagedFolder($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Storage\Control\V2\ManagedFolder::class); + $this->managed_folder = $var; + + return $this; + } + + /** + * Required. The name of the managed folder. It uses a single `/` as delimiter + * and leading and trailing `/` are allowed. + * + * Generated from protobuf field string managed_folder_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getManagedFolderId() + { + return $this->managed_folder_id; + } + + /** + * Required. The name of the managed folder. It uses a single `/` as delimiter + * and leading and trailing `/` are allowed. + * + * Generated from protobuf field string managed_folder_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setManagedFolderId($var) + { + GPBUtil::checkString($var, True); + $this->managed_folder_id = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/StorageControl/src/V2/DeleteFolderRequest.php b/StorageControl/src/V2/DeleteFolderRequest.php new file mode 100644 index 000000000000..90928c981dfc --- /dev/null +++ b/StorageControl/src/V2/DeleteFolderRequest.php @@ -0,0 +1,224 @@ +google.storage.control.v2.DeleteFolderRequest + */ +class DeleteFolderRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration matches the given value. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + */ + protected $if_metageneration_match = null; + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration does not match the given value. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + */ + protected $if_metageneration_not_match = null; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. This request is only + * idempotent if a `request_id` is provided. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $name Required. Name of the folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * Please see {@see StorageControlClient::folderName()} for help formatting this field. + * + * @return \Google\Cloud\Storage\Control\V2\DeleteFolderRequest + * + * @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 folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * @type int|string $if_metageneration_match + * Makes the operation only succeed conditional on whether the folder's + * current metageneration matches the given value. + * @type int|string $if_metageneration_not_match + * Makes the operation only succeed conditional on whether the folder's + * current metageneration does not match the given value. + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. This request is only + * idempotent if a `request_id` is provided. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 6 [(.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; + } + + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration matches the given value. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + * @return int|string + */ + public function getIfMetagenerationMatch() + { + return isset($this->if_metageneration_match) ? $this->if_metageneration_match : 0; + } + + public function hasIfMetagenerationMatch() + { + return isset($this->if_metageneration_match); + } + + public function clearIfMetagenerationMatch() + { + unset($this->if_metageneration_match); + } + + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration matches the given value. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_match = $var; + + return $this; + } + + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration does not match the given value. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + * @return int|string + */ + public function getIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match) ? $this->if_metageneration_not_match : 0; + } + + public function hasIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match); + } + + public function clearIfMetagenerationNotMatch() + { + unset($this->if_metageneration_not_match); + } + + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration does not match the given value. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationNotMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_not_match = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. This request is only + * idempotent if a `request_id` is provided. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. This request is only + * idempotent if a `request_id` is provided. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/StorageControl/src/V2/DeleteManagedFolderRequest.php b/StorageControl/src/V2/DeleteManagedFolderRequest.php new file mode 100644 index 000000000000..957f9300a277 --- /dev/null +++ b/StorageControl/src/V2/DeleteManagedFolderRequest.php @@ -0,0 +1,271 @@ +google.storage.control.v2.DeleteManagedFolderRequest + */ +class DeleteManagedFolderRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * + * Generated from protobuf field string name = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The operation succeeds conditional on the managed folder's current + * metageneration matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + */ + protected $if_metageneration_match = null; + /** + * The operation succeeds conditional on the managed folder's current + * metageneration NOT matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + */ + protected $if_metageneration_not_match = null; + /** + * Allows deletion of a managed folder even if it is not empty. + * A managed folder is empty if it manages no child managed folders or + * objects. Caller must have permission for + * storage.managedFolders.setIamPolicy. + * + * Generated from protobuf field bool allow_non_empty = 5; + */ + protected $allow_non_empty = false; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $name Required. Name of the managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * Please see {@see StorageControlClient::managedFolderName()} for help formatting this field. + * + * @return \Google\Cloud\Storage\Control\V2\DeleteManagedFolderRequest + * + * @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 managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * @type int|string $if_metageneration_match + * The operation succeeds conditional on the managed folder's current + * metageneration matching the value here specified. + * @type int|string $if_metageneration_not_match + * The operation succeeds conditional on the managed folder's current + * metageneration NOT matching the value here specified. + * @type bool $allow_non_empty + * Allows deletion of a managed folder even if it is not empty. + * A managed folder is empty if it manages no child managed folders or + * objects. Caller must have permission for + * storage.managedFolders.setIamPolicy. + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * + * Generated from protobuf field string name = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * + * Generated from protobuf field string name = 7 [(.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; + } + + /** + * The operation succeeds conditional on the managed folder's current + * metageneration matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + * @return int|string + */ + public function getIfMetagenerationMatch() + { + return isset($this->if_metageneration_match) ? $this->if_metageneration_match : 0; + } + + public function hasIfMetagenerationMatch() + { + return isset($this->if_metageneration_match); + } + + public function clearIfMetagenerationMatch() + { + unset($this->if_metageneration_match); + } + + /** + * The operation succeeds conditional on the managed folder's current + * metageneration matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_match = $var; + + return $this; + } + + /** + * The operation succeeds conditional on the managed folder's current + * metageneration NOT matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + * @return int|string + */ + public function getIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match) ? $this->if_metageneration_not_match : 0; + } + + public function hasIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match); + } + + public function clearIfMetagenerationNotMatch() + { + unset($this->if_metageneration_not_match); + } + + /** + * The operation succeeds conditional on the managed folder's current + * metageneration NOT matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationNotMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_not_match = $var; + + return $this; + } + + /** + * Allows deletion of a managed folder even if it is not empty. + * A managed folder is empty if it manages no child managed folders or + * objects. Caller must have permission for + * storage.managedFolders.setIamPolicy. + * + * Generated from protobuf field bool allow_non_empty = 5; + * @return bool + */ + public function getAllowNonEmpty() + { + return $this->allow_non_empty; + } + + /** + * Allows deletion of a managed folder even if it is not empty. + * A managed folder is empty if it manages no child managed folders or + * objects. Caller must have permission for + * storage.managedFolders.setIamPolicy. + * + * Generated from protobuf field bool allow_non_empty = 5; + * @param bool $var + * @return $this + */ + public function setAllowNonEmpty($var) + { + GPBUtil::checkBool($var); + $this->allow_non_empty = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/StorageControl/src/V2/Folder.php b/StorageControl/src/V2/Folder.php new file mode 100644 index 000000000000..86e914127fc4 --- /dev/null +++ b/StorageControl/src/V2/Folder.php @@ -0,0 +1,257 @@ +google.storage.control.v2.Folder + */ +class Folder extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. The name of this folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Output only. The version of the metadata for this folder. Used for + * preconditions and for detecting changes in metadata. + * + * Generated from protobuf field int64 metageneration = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $metageneration = 0; + /** + * Output only. The creation time of the folder. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The modification time of the folder. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. Only present if the folder is part of an ongoing RenameFolder + * operation. Contains information which can be used to query the operation + * status. The presence of this field also indicates all write operations are + * blocked for this folder, including folder, managed folder, and object + * operations. + * + * Generated from protobuf field .google.storage.control.v2.PendingRenameInfo pending_rename_info = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $pending_rename_info = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. The name of this folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * @type int|string $metageneration + * Output only. The version of the metadata for this folder. Used for + * preconditions and for detecting changes in metadata. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The creation time of the folder. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The modification time of the folder. + * @type \Google\Cloud\Storage\Control\V2\PendingRenameInfo $pending_rename_info + * Output only. Only present if the folder is part of an ongoing RenameFolder + * operation. Contains information which can be used to query the operation + * status. The presence of this field also indicates all write operations are + * blocked for this folder, including folder, managed folder, and object + * operations. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. The name of this folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. The name of this folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The version of the metadata for this folder. Used for + * preconditions and for detecting changes in metadata. + * + * Generated from protobuf field int64 metageneration = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getMetageneration() + { + return $this->metageneration; + } + + /** + * Output only. The version of the metadata for this folder. Used for + * preconditions and for detecting changes in metadata. + * + * Generated from protobuf field int64 metageneration = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setMetageneration($var) + { + GPBUtil::checkInt64($var); + $this->metageneration = $var; + + return $this; + } + + /** + * Output only. The creation time of the folder. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.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 creation time of the folder. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.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 modification time of the folder. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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 modification time of the folder. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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; + } + + /** + * Output only. Only present if the folder is part of an ongoing RenameFolder + * operation. Contains information which can be used to query the operation + * status. The presence of this field also indicates all write operations are + * blocked for this folder, including folder, managed folder, and object + * operations. + * + * Generated from protobuf field .google.storage.control.v2.PendingRenameInfo pending_rename_info = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Storage\Control\V2\PendingRenameInfo|null + */ + public function getPendingRenameInfo() + { + return $this->pending_rename_info; + } + + public function hasPendingRenameInfo() + { + return isset($this->pending_rename_info); + } + + public function clearPendingRenameInfo() + { + unset($this->pending_rename_info); + } + + /** + * Output only. Only present if the folder is part of an ongoing RenameFolder + * operation. Contains information which can be used to query the operation + * status. The presence of this field also indicates all write operations are + * blocked for this folder, including folder, managed folder, and object + * operations. + * + * Generated from protobuf field .google.storage.control.v2.PendingRenameInfo pending_rename_info = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Storage\Control\V2\PendingRenameInfo $var + * @return $this + */ + public function setPendingRenameInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Storage\Control\V2\PendingRenameInfo::class); + $this->pending_rename_info = $var; + + return $this; + } + +} + diff --git a/StorageControl/src/V2/GetFolderRequest.php b/StorageControl/src/V2/GetFolderRequest.php new file mode 100644 index 000000000000..df4f91b5685f --- /dev/null +++ b/StorageControl/src/V2/GetFolderRequest.php @@ -0,0 +1,220 @@ +google.storage.control.v2.GetFolderRequest + */ +class GetFolderRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration matches the given value. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + */ + protected $if_metageneration_match = null; + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration does not match the given value. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + */ + protected $if_metageneration_not_match = null; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $name Required. Name of the folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * Please see {@see StorageControlClient::folderName()} for help formatting this field. + * + * @return \Google\Cloud\Storage\Control\V2\GetFolderRequest + * + * @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 folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * @type int|string $if_metageneration_match + * Makes the operation only succeed conditional on whether the folder's + * current metageneration matches the given value. + * @type int|string $if_metageneration_not_match + * Makes the operation only succeed conditional on whether the folder's + * current metageneration does not match the given value. + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 6 [(.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; + } + + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration matches the given value. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + * @return int|string + */ + public function getIfMetagenerationMatch() + { + return isset($this->if_metageneration_match) ? $this->if_metageneration_match : 0; + } + + public function hasIfMetagenerationMatch() + { + return isset($this->if_metageneration_match); + } + + public function clearIfMetagenerationMatch() + { + unset($this->if_metageneration_match); + } + + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration matches the given value. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_match = $var; + + return $this; + } + + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration does not match the given value. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + * @return int|string + */ + public function getIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match) ? $this->if_metageneration_not_match : 0; + } + + public function hasIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match); + } + + public function clearIfMetagenerationNotMatch() + { + unset($this->if_metageneration_not_match); + } + + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration does not match the given value. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationNotMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_not_match = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/StorageControl/src/V2/GetManagedFolderRequest.php b/StorageControl/src/V2/GetManagedFolderRequest.php new file mode 100644 index 000000000000..b4deee313827 --- /dev/null +++ b/StorageControl/src/V2/GetManagedFolderRequest.php @@ -0,0 +1,225 @@ +google.storage.control.v2.GetManagedFolderRequest + */ +class GetManagedFolderRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The operation succeeds conditional on the managed folder's current + * metageneration matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + */ + protected $if_metageneration_match = null; + /** + * The operation succeeds conditional on the managed folder's current + * metageneration NOT matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + */ + protected $if_metageneration_not_match = null; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $name Required. Name of the managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * Please see {@see StorageControlClient::managedFolderName()} for help formatting this field. + * + * @return \Google\Cloud\Storage\Control\V2\GetManagedFolderRequest + * + * @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 managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * @type int|string $if_metageneration_match + * The operation succeeds conditional on the managed folder's current + * metageneration matching the value here specified. + * @type int|string $if_metageneration_not_match + * The operation succeeds conditional on the managed folder's current + * metageneration NOT matching the value here specified. + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * + * Generated from protobuf field string name = 6 [(.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; + } + + /** + * The operation succeeds conditional on the managed folder's current + * metageneration matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + * @return int|string + */ + public function getIfMetagenerationMatch() + { + return isset($this->if_metageneration_match) ? $this->if_metageneration_match : 0; + } + + public function hasIfMetagenerationMatch() + { + return isset($this->if_metageneration_match); + } + + public function clearIfMetagenerationMatch() + { + unset($this->if_metageneration_match); + } + + /** + * The operation succeeds conditional on the managed folder's current + * metageneration matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_match = $var; + + return $this; + } + + /** + * The operation succeeds conditional on the managed folder's current + * metageneration NOT matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + * @return int|string + */ + public function getIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match) ? $this->if_metageneration_not_match : 0; + } + + public function hasIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match); + } + + public function clearIfMetagenerationNotMatch() + { + unset($this->if_metageneration_not_match); + } + + /** + * The operation succeeds conditional on the managed folder's current + * metageneration NOT matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationNotMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_not_match = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/StorageControl/src/V2/GetStorageLayoutRequest.php b/StorageControl/src/V2/GetStorageLayoutRequest.php new file mode 100644 index 000000000000..ca2429d9ac1f --- /dev/null +++ b/StorageControl/src/V2/GetStorageLayoutRequest.php @@ -0,0 +1,162 @@ +google.storage.control.v2.GetStorageLayoutRequest + */ +class GetStorageLayoutRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the StorageLayout resource. + * Format: `projects/{project}/buckets/{bucket}/storageLayout` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * An optional prefix used for permission check. It is useful when the caller + * only has limited permissions under a specific prefix. + * + * Generated from protobuf field string prefix = 2; + */ + protected $prefix = ''; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $name Required. The name of the StorageLayout resource. + * Format: `projects/{project}/buckets/{bucket}/storageLayout` + * Please see {@see StorageControlClient::storageLayoutName()} for help formatting this field. + * + * @return \Google\Cloud\Storage\Control\V2\GetStorageLayoutRequest + * + * @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. The name of the StorageLayout resource. + * Format: `projects/{project}/buckets/{bucket}/storageLayout` + * @type string $prefix + * An optional prefix used for permission check. It is useful when the caller + * only has limited permissions under a specific prefix. + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the StorageLayout resource. + * Format: `projects/{project}/buckets/{bucket}/storageLayout` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the StorageLayout resource. + * Format: `projects/{project}/buckets/{bucket}/storageLayout` + * + * 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; + } + + /** + * An optional prefix used for permission check. It is useful when the caller + * only has limited permissions under a specific prefix. + * + * Generated from protobuf field string prefix = 2; + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } + + /** + * An optional prefix used for permission check. It is useful when the caller + * only has limited permissions under a specific prefix. + * + * Generated from protobuf field string prefix = 2; + * @param string $var + * @return $this + */ + public function setPrefix($var) + { + GPBUtil::checkString($var, True); + $this->prefix = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/StorageControl/src/V2/ListFoldersRequest.php b/StorageControl/src/V2/ListFoldersRequest.php new file mode 100644 index 000000000000..1f57f1c9d342 --- /dev/null +++ b/StorageControl/src/V2/ListFoldersRequest.php @@ -0,0 +1,367 @@ +google.storage.control.v2.ListFoldersRequest + */ +class ListFoldersRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the bucket in which to look for folders. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Maximum number of folders to return in a single response. The + * service will use this parameter or 1,000 items, whichever is smaller. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A previously-returned page token representing part of the larger + * set of results to view. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Filter results to folders whose names begin with this prefix. + * If set, the value must either be an empty string or end with a '/'. + * + * Generated from protobuf field string prefix = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $prefix = ''; + /** + * Optional. If set, returns results in a directory-like mode. The results + * will only include folders that either exactly match the above prefix, or + * are one level below the prefix. The only supported value is '/'. + * + * Generated from protobuf field string delimiter = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $delimiter = ''; + /** + * Optional. Filter results to folders whose names are lexicographically equal + * to or after lexicographic_start. If lexicographic_end is also set, the + * folders listed have names between lexicographic_start (inclusive) and + * lexicographic_end (exclusive). + * + * Generated from protobuf field string lexicographic_start = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $lexicographic_start = ''; + /** + * Optional. Filter results to folders whose names are lexicographically + * before lexicographic_end. If lexicographic_start is also set, the folders + * listed have names between lexicographic_start (inclusive) and + * lexicographic_end (exclusive). + * + * Generated from protobuf field string lexicographic_end = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $lexicographic_end = ''; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $parent Required. Name of the bucket in which to look for folders. Please see + * {@see StorageControlClient::bucketName()} for help formatting this field. + * + * @return \Google\Cloud\Storage\Control\V2\ListFoldersRequest + * + * @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. Name of the bucket in which to look for folders. + * @type int $page_size + * Optional. Maximum number of folders to return in a single response. The + * service will use this parameter or 1,000 items, whichever is smaller. + * @type string $page_token + * Optional. A previously-returned page token representing part of the larger + * set of results to view. + * @type string $prefix + * Optional. Filter results to folders whose names begin with this prefix. + * If set, the value must either be an empty string or end with a '/'. + * @type string $delimiter + * Optional. If set, returns results in a directory-like mode. The results + * will only include folders that either exactly match the above prefix, or + * are one level below the prefix. The only supported value is '/'. + * @type string $lexicographic_start + * Optional. Filter results to folders whose names are lexicographically equal + * to or after lexicographic_start. If lexicographic_end is also set, the + * folders listed have names between lexicographic_start (inclusive) and + * lexicographic_end (exclusive). + * @type string $lexicographic_end + * Optional. Filter results to folders whose names are lexicographically + * before lexicographic_end. If lexicographic_start is also set, the folders + * listed have names between lexicographic_start (inclusive) and + * lexicographic_end (exclusive). + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the bucket in which to look for folders. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Name of the bucket in which to look for folders. + * + * 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. Maximum number of folders to return in a single response. The + * service will use this parameter or 1,000 items, whichever is smaller. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Maximum number of folders to return in a single response. The + * service will use this parameter or 1,000 items, whichever is smaller. + * + * 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 previously-returned page token representing part of the larger + * set of results to view. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A previously-returned page token representing part of the larger + * set of results to view. + * + * 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. Filter results to folders whose names begin with this prefix. + * If set, the value must either be an empty string or end with a '/'. + * + * Generated from protobuf field string prefix = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } + + /** + * Optional. Filter results to folders whose names begin with this prefix. + * If set, the value must either be an empty string or end with a '/'. + * + * Generated from protobuf field string prefix = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPrefix($var) + { + GPBUtil::checkString($var, True); + $this->prefix = $var; + + return $this; + } + + /** + * Optional. If set, returns results in a directory-like mode. The results + * will only include folders that either exactly match the above prefix, or + * are one level below the prefix. The only supported value is '/'. + * + * Generated from protobuf field string delimiter = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDelimiter() + { + return $this->delimiter; + } + + /** + * Optional. If set, returns results in a directory-like mode. The results + * will only include folders that either exactly match the above prefix, or + * are one level below the prefix. The only supported value is '/'. + * + * Generated from protobuf field string delimiter = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDelimiter($var) + { + GPBUtil::checkString($var, True); + $this->delimiter = $var; + + return $this; + } + + /** + * Optional. Filter results to folders whose names are lexicographically equal + * to or after lexicographic_start. If lexicographic_end is also set, the + * folders listed have names between lexicographic_start (inclusive) and + * lexicographic_end (exclusive). + * + * Generated from protobuf field string lexicographic_start = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getLexicographicStart() + { + return $this->lexicographic_start; + } + + /** + * Optional. Filter results to folders whose names are lexicographically equal + * to or after lexicographic_start. If lexicographic_end is also set, the + * folders listed have names between lexicographic_start (inclusive) and + * lexicographic_end (exclusive). + * + * Generated from protobuf field string lexicographic_start = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setLexicographicStart($var) + { + GPBUtil::checkString($var, True); + $this->lexicographic_start = $var; + + return $this; + } + + /** + * Optional. Filter results to folders whose names are lexicographically + * before lexicographic_end. If lexicographic_start is also set, the folders + * listed have names between lexicographic_start (inclusive) and + * lexicographic_end (exclusive). + * + * Generated from protobuf field string lexicographic_end = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getLexicographicEnd() + { + return $this->lexicographic_end; + } + + /** + * Optional. Filter results to folders whose names are lexicographically + * before lexicographic_end. If lexicographic_start is also set, the folders + * listed have names between lexicographic_start (inclusive) and + * lexicographic_end (exclusive). + * + * Generated from protobuf field string lexicographic_end = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setLexicographicEnd($var) + { + GPBUtil::checkString($var, True); + $this->lexicographic_end = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/StorageControl/src/V2/ListFoldersResponse.php b/StorageControl/src/V2/ListFoldersResponse.php new file mode 100644 index 000000000000..eb67af3ca9e8 --- /dev/null +++ b/StorageControl/src/V2/ListFoldersResponse.php @@ -0,0 +1,105 @@ +google.storage.control.v2.ListFoldersResponse + */ +class ListFoldersResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of child folders + * + * Generated from protobuf field repeated .google.storage.control.v2.Folder folders = 1; + */ + private $folders; + /** + * The continuation token, used to page through large result sets. Provide + * this value in a subsequent request to return the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Storage\Control\V2\Folder>|\Google\Protobuf\Internal\RepeatedField $folders + * The list of child folders + * @type string $next_page_token + * The continuation token, used to page through large result sets. Provide + * this value in a subsequent request to return the next page of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * The list of child folders + * + * Generated from protobuf field repeated .google.storage.control.v2.Folder folders = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFolders() + { + return $this->folders; + } + + /** + * The list of child folders + * + * Generated from protobuf field repeated .google.storage.control.v2.Folder folders = 1; + * @param array<\Google\Cloud\Storage\Control\V2\Folder>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFolders($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Storage\Control\V2\Folder::class); + $this->folders = $arr; + + return $this; + } + + /** + * The continuation token, used to page through large result sets. Provide + * this value in a subsequent request to return the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The continuation token, used to page through large result sets. Provide + * this value in a subsequent request to return the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/StorageControl/src/V2/ListManagedFoldersRequest.php b/StorageControl/src/V2/ListManagedFoldersRequest.php new file mode 100644 index 000000000000..4af92f638e5a --- /dev/null +++ b/StorageControl/src/V2/ListManagedFoldersRequest.php @@ -0,0 +1,233 @@ +google.storage.control.v2.ListManagedFoldersRequest + */ +class ListManagedFoldersRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the bucket this managed folder belongs to. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Maximum number of managed folders to return in a single response. + * The service will use this parameter or 1,000 items, whichever is smaller. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A previously-returned page token representing part of the larger + * set of results to view. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Filter results to match managed folders with name starting with + * this prefix. + * + * Generated from protobuf field string prefix = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $prefix = ''; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $parent Required. Name of the bucket this managed folder belongs to. Please see + * {@see StorageControlClient::bucketName()} for help formatting this field. + * + * @return \Google\Cloud\Storage\Control\V2\ListManagedFoldersRequest + * + * @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. Name of the bucket this managed folder belongs to. + * @type int $page_size + * Optional. Maximum number of managed folders to return in a single response. + * The service will use this parameter or 1,000 items, whichever is smaller. + * @type string $page_token + * Optional. A previously-returned page token representing part of the larger + * set of results to view. + * @type string $prefix + * Optional. Filter results to match managed folders with name starting with + * this prefix. + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the bucket this managed folder belongs to. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Name of the bucket this managed folder belongs to. + * + * 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. Maximum number of managed folders to return in a single response. + * The service will use this parameter or 1,000 items, whichever is smaller. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Maximum number of managed folders to return in a single response. + * The service will use this parameter or 1,000 items, whichever is smaller. + * + * 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 previously-returned page token representing part of the larger + * set of results to view. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A previously-returned page token representing part of the larger + * set of results to view. + * + * 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. Filter results to match managed folders with name starting with + * this prefix. + * + * Generated from protobuf field string prefix = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } + + /** + * Optional. Filter results to match managed folders with name starting with + * this prefix. + * + * Generated from protobuf field string prefix = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPrefix($var) + { + GPBUtil::checkString($var, True); + $this->prefix = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/StorageControl/src/V2/ListManagedFoldersResponse.php b/StorageControl/src/V2/ListManagedFoldersResponse.php new file mode 100644 index 000000000000..7ca7daea2e9c --- /dev/null +++ b/StorageControl/src/V2/ListManagedFoldersResponse.php @@ -0,0 +1,105 @@ +google.storage.control.v2.ListManagedFoldersResponse + */ +class ListManagedFoldersResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of matching managed folders + * + * Generated from protobuf field repeated .google.storage.control.v2.ManagedFolder managed_folders = 1; + */ + private $managed_folders; + /** + * The continuation token, used to page through large result sets. Provide + * this value in a subsequent request to return the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Storage\Control\V2\ManagedFolder>|\Google\Protobuf\Internal\RepeatedField $managed_folders + * The list of matching managed folders + * @type string $next_page_token + * The continuation token, used to page through large result sets. Provide + * this value in a subsequent request to return the next page of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * The list of matching managed folders + * + * Generated from protobuf field repeated .google.storage.control.v2.ManagedFolder managed_folders = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getManagedFolders() + { + return $this->managed_folders; + } + + /** + * The list of matching managed folders + * + * Generated from protobuf field repeated .google.storage.control.v2.ManagedFolder managed_folders = 1; + * @param array<\Google\Cloud\Storage\Control\V2\ManagedFolder>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setManagedFolders($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Storage\Control\V2\ManagedFolder::class); + $this->managed_folders = $arr; + + return $this; + } + + /** + * The continuation token, used to page through large result sets. Provide + * this value in a subsequent request to return the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The continuation token, used to page through large result sets. Provide + * this value in a subsequent request to return the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/StorageControl/src/V2/ManagedFolder.php b/StorageControl/src/V2/ManagedFolder.php new file mode 100644 index 000000000000..46a6d1984b82 --- /dev/null +++ b/StorageControl/src/V2/ManagedFolder.php @@ -0,0 +1,205 @@ +google.storage.control.v2.ManagedFolder + */ +class ManagedFolder extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. The name of this managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Output only. The metadata version of this managed folder. It increases + * whenever the metadata is updated. Used for preconditions and for detecting + * changes in metadata. Managed folders don't have a generation number. + * + * Generated from protobuf field int64 metageneration = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $metageneration = 0; + /** + * Output only. The creation time of the managed folder. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The modification time of the managed folder. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. The name of this managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * @type int|string $metageneration + * Output only. The metadata version of this managed folder. It increases + * whenever the metadata is updated. Used for preconditions and for detecting + * changes in metadata. Managed folders don't have a generation number. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The creation time of the managed folder. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The modification time of the managed folder. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. The name of this managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. The name of this managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The metadata version of this managed folder. It increases + * whenever the metadata is updated. Used for preconditions and for detecting + * changes in metadata. Managed folders don't have a generation number. + * + * Generated from protobuf field int64 metageneration = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getMetageneration() + { + return $this->metageneration; + } + + /** + * Output only. The metadata version of this managed folder. It increases + * whenever the metadata is updated. Used for preconditions and for detecting + * changes in metadata. Managed folders don't have a generation number. + * + * Generated from protobuf field int64 metageneration = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setMetageneration($var) + { + GPBUtil::checkInt64($var); + $this->metageneration = $var; + + return $this; + } + + /** + * Output only. The creation time of the managed folder. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.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 creation time of the managed folder. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.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 modification time of the managed folder. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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 modification time of the managed folder. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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; + } + +} + diff --git a/StorageControl/src/V2/PendingRenameInfo.php b/StorageControl/src/V2/PendingRenameInfo.php new file mode 100644 index 000000000000..52172ad37498 --- /dev/null +++ b/StorageControl/src/V2/PendingRenameInfo.php @@ -0,0 +1,67 @@ +google.storage.control.v2.PendingRenameInfo + */ +class PendingRenameInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the rename operation. + * + * Generated from protobuf field string operation = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $operation = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $operation + * Output only. The name of the rename operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the rename operation. + * + * Generated from protobuf field string operation = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getOperation() + { + return $this->operation; + } + + /** + * Output only. The name of the rename operation. + * + * Generated from protobuf field string operation = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setOperation($var) + { + GPBUtil::checkString($var, True); + $this->operation = $var; + + return $this; + } + +} + diff --git a/StorageControl/src/V2/RenameFolderMetadata.php b/StorageControl/src/V2/RenameFolderMetadata.php new file mode 100644 index 000000000000..d9d0313fd1a7 --- /dev/null +++ b/StorageControl/src/V2/RenameFolderMetadata.php @@ -0,0 +1,146 @@ +google.storage.control.v2.RenameFolderMetadata + */ +class RenameFolderMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Generic metadata for the long running operation. + * + * Generated from protobuf field .google.storage.control.v2.CommonLongRunningOperationMetadata common_metadata = 1; + */ + protected $common_metadata = null; + /** + * The path of the source folder. + * + * Generated from protobuf field string source_folder_id = 2; + */ + protected $source_folder_id = ''; + /** + * The path of the destination folder. + * + * Generated from protobuf field string destination_folder_id = 3; + */ + protected $destination_folder_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Storage\Control\V2\CommonLongRunningOperationMetadata $common_metadata + * Generic metadata for the long running operation. + * @type string $source_folder_id + * The path of the source folder. + * @type string $destination_folder_id + * The path of the destination folder. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Generic metadata for the long running operation. + * + * Generated from protobuf field .google.storage.control.v2.CommonLongRunningOperationMetadata common_metadata = 1; + * @return \Google\Cloud\Storage\Control\V2\CommonLongRunningOperationMetadata|null + */ + public function getCommonMetadata() + { + return $this->common_metadata; + } + + public function hasCommonMetadata() + { + return isset($this->common_metadata); + } + + public function clearCommonMetadata() + { + unset($this->common_metadata); + } + + /** + * Generic metadata for the long running operation. + * + * Generated from protobuf field .google.storage.control.v2.CommonLongRunningOperationMetadata common_metadata = 1; + * @param \Google\Cloud\Storage\Control\V2\CommonLongRunningOperationMetadata $var + * @return $this + */ + public function setCommonMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Storage\Control\V2\CommonLongRunningOperationMetadata::class); + $this->common_metadata = $var; + + return $this; + } + + /** + * The path of the source folder. + * + * Generated from protobuf field string source_folder_id = 2; + * @return string + */ + public function getSourceFolderId() + { + return $this->source_folder_id; + } + + /** + * The path of the source folder. + * + * Generated from protobuf field string source_folder_id = 2; + * @param string $var + * @return $this + */ + public function setSourceFolderId($var) + { + GPBUtil::checkString($var, True); + $this->source_folder_id = $var; + + return $this; + } + + /** + * The path of the destination folder. + * + * Generated from protobuf field string destination_folder_id = 3; + * @return string + */ + public function getDestinationFolderId() + { + return $this->destination_folder_id; + } + + /** + * The path of the destination folder. + * + * Generated from protobuf field string destination_folder_id = 3; + * @param string $var + * @return $this + */ + public function setDestinationFolderId($var) + { + GPBUtil::checkString($var, True); + $this->destination_folder_id = $var; + + return $this; + } + +} + diff --git a/StorageControl/src/V2/RenameFolderRequest.php b/StorageControl/src/V2/RenameFolderRequest.php new file mode 100644 index 000000000000..77df9a3e1702 --- /dev/null +++ b/StorageControl/src/V2/RenameFolderRequest.php @@ -0,0 +1,260 @@ +google.storage.control.v2.RenameFolderRequest + */ +class RenameFolderRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the source folder being renamed. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. The destination folder ID, e.g. `foo/bar/`. + * + * Generated from protobuf field string destination_folder_id = 8 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $destination_folder_id = ''; + /** + * Makes the operation only succeed conditional on whether the source + * folder's current metageneration matches the given value. + * + * Generated from protobuf field optional int64 if_metageneration_match = 4; + */ + protected $if_metageneration_match = null; + /** + * Makes the operation only succeed conditional on whether the source + * folder's current metageneration does not match the given value. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 5; + */ + protected $if_metageneration_not_match = null; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. This request is only + * idempotent if a `request_id` is provided. + * + * Generated from protobuf field string request_id = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $name Required. Name of the source folder being renamed. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * Please see {@see StorageControlClient::folderName()} for help formatting this field. + * @param string $destinationFolderId Required. The destination folder ID, e.g. `foo/bar/`. + * + * @return \Google\Cloud\Storage\Control\V2\RenameFolderRequest + * + * @experimental + */ + public static function build(string $name, string $destinationFolderId): self + { + return (new self()) + ->setName($name) + ->setDestinationFolderId($destinationFolderId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the source folder being renamed. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * @type string $destination_folder_id + * Required. The destination folder ID, e.g. `foo/bar/`. + * @type int|string $if_metageneration_match + * Makes the operation only succeed conditional on whether the source + * folder's current metageneration matches the given value. + * @type int|string $if_metageneration_not_match + * Makes the operation only succeed conditional on whether the source + * folder's current metageneration does not match the given value. + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. This request is only + * idempotent if a `request_id` is provided. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the source folder being renamed. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the source folder being renamed. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The destination folder ID, e.g. `foo/bar/`. + * + * Generated from protobuf field string destination_folder_id = 8 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDestinationFolderId() + { + return $this->destination_folder_id; + } + + /** + * Required. The destination folder ID, e.g. `foo/bar/`. + * + * Generated from protobuf field string destination_folder_id = 8 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDestinationFolderId($var) + { + GPBUtil::checkString($var, True); + $this->destination_folder_id = $var; + + return $this; + } + + /** + * Makes the operation only succeed conditional on whether the source + * folder's current metageneration matches the given value. + * + * Generated from protobuf field optional int64 if_metageneration_match = 4; + * @return int|string + */ + public function getIfMetagenerationMatch() + { + return isset($this->if_metageneration_match) ? $this->if_metageneration_match : 0; + } + + public function hasIfMetagenerationMatch() + { + return isset($this->if_metageneration_match); + } + + public function clearIfMetagenerationMatch() + { + unset($this->if_metageneration_match); + } + + /** + * Makes the operation only succeed conditional on whether the source + * folder's current metageneration matches the given value. + * + * Generated from protobuf field optional int64 if_metageneration_match = 4; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_match = $var; + + return $this; + } + + /** + * Makes the operation only succeed conditional on whether the source + * folder's current metageneration does not match the given value. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 5; + * @return int|string + */ + public function getIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match) ? $this->if_metageneration_not_match : 0; + } + + public function hasIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match); + } + + public function clearIfMetagenerationNotMatch() + { + unset($this->if_metageneration_not_match); + } + + /** + * Makes the operation only succeed conditional on whether the source + * folder's current metageneration does not match the given value. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 5; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationNotMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_not_match = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. This request is only + * idempotent if a `request_id` is provided. + * + * Generated from protobuf field string request_id = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. This request is only + * idempotent if a `request_id` is provided. + * + * Generated from protobuf field string request_id = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/StorageControl/src/V2/StorageLayout.php b/StorageControl/src/V2/StorageLayout.php new file mode 100644 index 000000000000..a48fbe8ef2ee --- /dev/null +++ b/StorageControl/src/V2/StorageLayout.php @@ -0,0 +1,239 @@ +google.storage.control.v2.StorageLayout + */ +class StorageLayout extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the StorageLayout resource. + * Format: `projects/{project}/buckets/{bucket}/storageLayout` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. The location of the bucket. + * + * Generated from protobuf field string location = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $location = ''; + /** + * Output only. The location type of the bucket (region, dual-region, + * multi-region, etc). + * + * Generated from protobuf field string location_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $location_type = ''; + /** + * Output only. The data placement configuration for custom dual region. If + * there is no configuration, this is not a custom dual region bucket. + * + * Generated from protobuf field .google.storage.control.v2.StorageLayout.CustomPlacementConfig custom_placement_config = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $custom_placement_config = null; + /** + * Output only. The bucket's hierarchical namespace configuration. If there is + * no configuration, the hierarchical namespace is disabled. + * + * Generated from protobuf field .google.storage.control.v2.StorageLayout.HierarchicalNamespace hierarchical_namespace = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $hierarchical_namespace = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The name of the StorageLayout resource. + * Format: `projects/{project}/buckets/{bucket}/storageLayout` + * @type string $location + * Output only. The location of the bucket. + * @type string $location_type + * Output only. The location type of the bucket (region, dual-region, + * multi-region, etc). + * @type \Google\Cloud\Storage\Control\V2\StorageLayout\CustomPlacementConfig $custom_placement_config + * Output only. The data placement configuration for custom dual region. If + * there is no configuration, this is not a custom dual region bucket. + * @type \Google\Cloud\Storage\Control\V2\StorageLayout\HierarchicalNamespace $hierarchical_namespace + * Output only. The bucket's hierarchical namespace configuration. If there is + * no configuration, the hierarchical namespace is disabled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the StorageLayout resource. + * Format: `projects/{project}/buckets/{bucket}/storageLayout` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The name of the StorageLayout resource. + * Format: `projects/{project}/buckets/{bucket}/storageLayout` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The location of the bucket. + * + * Generated from protobuf field string location = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * Output only. The location of the bucket. + * + * Generated from protobuf field string location = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * Output only. The location type of the bucket (region, dual-region, + * multi-region, etc). + * + * Generated from protobuf field string location_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getLocationType() + { + return $this->location_type; + } + + /** + * Output only. The location type of the bucket (region, dual-region, + * multi-region, etc). + * + * Generated from protobuf field string location_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setLocationType($var) + { + GPBUtil::checkString($var, True); + $this->location_type = $var; + + return $this; + } + + /** + * Output only. The data placement configuration for custom dual region. If + * there is no configuration, this is not a custom dual region bucket. + * + * Generated from protobuf field .google.storage.control.v2.StorageLayout.CustomPlacementConfig custom_placement_config = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Storage\Control\V2\StorageLayout\CustomPlacementConfig|null + */ + public function getCustomPlacementConfig() + { + return $this->custom_placement_config; + } + + public function hasCustomPlacementConfig() + { + return isset($this->custom_placement_config); + } + + public function clearCustomPlacementConfig() + { + unset($this->custom_placement_config); + } + + /** + * Output only. The data placement configuration for custom dual region. If + * there is no configuration, this is not a custom dual region bucket. + * + * Generated from protobuf field .google.storage.control.v2.StorageLayout.CustomPlacementConfig custom_placement_config = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Storage\Control\V2\StorageLayout\CustomPlacementConfig $var + * @return $this + */ + public function setCustomPlacementConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Storage\Control\V2\StorageLayout\CustomPlacementConfig::class); + $this->custom_placement_config = $var; + + return $this; + } + + /** + * Output only. The bucket's hierarchical namespace configuration. If there is + * no configuration, the hierarchical namespace is disabled. + * + * Generated from protobuf field .google.storage.control.v2.StorageLayout.HierarchicalNamespace hierarchical_namespace = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Storage\Control\V2\StorageLayout\HierarchicalNamespace|null + */ + public function getHierarchicalNamespace() + { + return $this->hierarchical_namespace; + } + + public function hasHierarchicalNamespace() + { + return isset($this->hierarchical_namespace); + } + + public function clearHierarchicalNamespace() + { + unset($this->hierarchical_namespace); + } + + /** + * Output only. The bucket's hierarchical namespace configuration. If there is + * no configuration, the hierarchical namespace is disabled. + * + * Generated from protobuf field .google.storage.control.v2.StorageLayout.HierarchicalNamespace hierarchical_namespace = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Storage\Control\V2\StorageLayout\HierarchicalNamespace $var + * @return $this + */ + public function setHierarchicalNamespace($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Storage\Control\V2\StorageLayout\HierarchicalNamespace::class); + $this->hierarchical_namespace = $var; + + return $this; + } + +} + diff --git a/StorageControl/src/V2/StorageLayout/CustomPlacementConfig.php b/StorageControl/src/V2/StorageLayout/CustomPlacementConfig.php new file mode 100644 index 000000000000..97704ea47229 --- /dev/null +++ b/StorageControl/src/V2/StorageLayout/CustomPlacementConfig.php @@ -0,0 +1,70 @@ +google.storage.control.v2.StorageLayout.CustomPlacementConfig + */ +class CustomPlacementConfig extends \Google\Protobuf\Internal\Message +{ + /** + * List of locations to use for data placement. + * + * Generated from protobuf field repeated string data_locations = 1; + */ + private $data_locations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $data_locations + * List of locations to use for data placement. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * List of locations to use for data placement. + * + * Generated from protobuf field repeated string data_locations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDataLocations() + { + return $this->data_locations; + } + + /** + * List of locations to use for data placement. + * + * Generated from protobuf field repeated string data_locations = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDataLocations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->data_locations = $arr; + + return $this; + } + +} + + diff --git a/StorageControl/src/V2/StorageLayout/HierarchicalNamespace.php b/StorageControl/src/V2/StorageLayout/HierarchicalNamespace.php new file mode 100644 index 000000000000..6ee8111687cf --- /dev/null +++ b/StorageControl/src/V2/StorageLayout/HierarchicalNamespace.php @@ -0,0 +1,68 @@ +google.storage.control.v2.StorageLayout.HierarchicalNamespace + */ +class HierarchicalNamespace extends \Google\Protobuf\Internal\Message +{ + /** + * Enables the hierarchical namespace feature. + * + * Generated from protobuf field bool enabled = 1; + */ + protected $enabled = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enabled + * Enables the hierarchical namespace feature. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Enables the hierarchical namespace feature. + * + * Generated from protobuf field bool enabled = 1; + * @return bool + */ + public function getEnabled() + { + return $this->enabled; + } + + /** + * Enables the hierarchical namespace feature. + * + * Generated from protobuf field bool enabled = 1; + * @param bool $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkBool($var); + $this->enabled = $var; + + return $this; + } + +} + + diff --git a/StorageControl/src/V2/gapic_metadata.json b/StorageControl/src/V2/gapic_metadata.json new file mode 100644 index 000000000000..61ee835d8977 --- /dev/null +++ b/StorageControl/src/V2/gapic_metadata.json @@ -0,0 +1,68 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.storage.control.v2", + "libraryPackage": "Google\\Cloud\\Storage\\Control\\V2", + "services": { + "StorageControl": { + "clients": { + "grpc": { + "libraryClient": "StorageControlGapicClient", + "rpcs": { + "CreateFolder": { + "methods": [ + "createFolder" + ] + }, + "CreateManagedFolder": { + "methods": [ + "createManagedFolder" + ] + }, + "DeleteFolder": { + "methods": [ + "deleteFolder" + ] + }, + "DeleteManagedFolder": { + "methods": [ + "deleteManagedFolder" + ] + }, + "GetFolder": { + "methods": [ + "getFolder" + ] + }, + "GetManagedFolder": { + "methods": [ + "getManagedFolder" + ] + }, + "GetStorageLayout": { + "methods": [ + "getStorageLayout" + ] + }, + "ListFolders": { + "methods": [ + "listFolders" + ] + }, + "ListManagedFolders": { + "methods": [ + "listManagedFolders" + ] + }, + "RenameFolder": { + "methods": [ + "renameFolder" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/StorageControl/src/V2/resources/storage_control_client_config.json b/StorageControl/src/V2/resources/storage_control_client_config.json new file mode 100644 index 000000000000..b6522d27f8ab --- /dev/null +++ b/StorageControl/src/V2/resources/storage_control_client_config.json @@ -0,0 +1,98 @@ +{ + "interfaces": { + "google.storage.control.v2.StorageControl": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "RESOURCE_EXHAUSTED", + "UNAVAILABLE", + "DEADLINE_EXCEEDED", + "INTERNAL", + "UNKNOWN" + ], + "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": 2.0, + "max_retry_delay_millis": 60000, + "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": { + "CreateFolder": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateManagedFolder": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteFolder": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteManagedFolder": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetFolder": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetManagedFolder": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetStorageLayout": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListFolders": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListManagedFolders": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "RenameFolder": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/StorageControl/src/V2/resources/storage_control_descriptor_config.php b/StorageControl/src/V2/resources/storage_control_descriptor_config.php new file mode 100644 index 000000000000..351dee8ec73e --- /dev/null +++ b/StorageControl/src/V2/resources/storage_control_descriptor_config.php @@ -0,0 +1,222 @@ + [ + 'google.storage.control.v2.StorageControl' => [ + 'RenameFolder' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Storage\Control\V2\Folder', + 'metadataReturnType' => '\Google\Cloud\Storage\Control\V2\RenameFolderMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/buckets\/[^\/]+)(?:\/.*)?$/', + ], + ], + ], + 'autoPopulatedFields' => [ + 'requestId' => \Google\Api\FieldInfo\Format::UUID4, + ], + ], + 'CreateFolder' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Storage\Control\V2\Folder', + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + 'autoPopulatedFields' => [ + 'requestId' => \Google\Api\FieldInfo\Format::UUID4, + ], + ], + 'CreateManagedFolder' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Storage\Control\V2\ManagedFolder', + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + 'autoPopulatedFields' => [ + 'requestId' => \Google\Api\FieldInfo\Format::UUID4, + ], + ], + 'DeleteFolder' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/buckets\/[^\/]+)(?:\/.*)?$/', + ], + ], + ], + 'autoPopulatedFields' => [ + 'requestId' => \Google\Api\FieldInfo\Format::UUID4, + ], + ], + 'DeleteManagedFolder' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/buckets\/[^\/]+)(?:\/.*)?$/', + ], + ], + ], + 'autoPopulatedFields' => [ + 'requestId' => \Google\Api\FieldInfo\Format::UUID4, + ], + ], + 'GetFolder' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Storage\Control\V2\Folder', + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/buckets\/[^\/]+)(?:\/.*)?$/', + ], + ], + ], + 'autoPopulatedFields' => [ + 'requestId' => \Google\Api\FieldInfo\Format::UUID4, + ], + ], + 'GetManagedFolder' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Storage\Control\V2\ManagedFolder', + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/buckets\/[^\/]+)(?:\/.*)?$/', + ], + ], + ], + 'autoPopulatedFields' => [ + 'requestId' => \Google\Api\FieldInfo\Format::UUID4, + ], + ], + 'GetStorageLayout' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Storage\Control\V2\StorageLayout', + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/buckets\/[^\/]+)(?:\/.*)?$/', + ], + ], + ], + 'autoPopulatedFields' => [ + 'requestId' => \Google\Api\FieldInfo\Format::UUID4, + ], + ], + 'ListFolders' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getFolders', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Storage\Control\V2\ListFoldersResponse', + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListManagedFolders' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getManagedFolders', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Storage\Control\V2\ListManagedFoldersResponse', + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + 'autoPopulatedFields' => [ + 'requestId' => \Google\Api\FieldInfo\Format::UUID4, + ], + ], + 'templateMap' => [ + 'bucket' => 'projects/{project}/buckets/{bucket}', + 'folder' => 'projects/{project}/buckets/{bucket}/folders/{folder=**}', + 'managedFolder' => 'projects/{project}/buckets/{bucket}/managedFolders/{managedFolder=**}', + 'storageLayout' => 'projects/{project}/buckets/{bucket}/storageLayout', + ], + ], + ], +]; diff --git a/StorageControl/src/V2/resources/storage_control_rest_client_config.php b/StorageControl/src/V2/resources/storage_control_rest_client_config.php new file mode 100644 index 000000000000..64cb7f58c392 --- /dev/null +++ b/StorageControl/src/V2/resources/storage_control_rest_client_config.php @@ -0,0 +1,25 @@ + [], +]; diff --git a/StorageControl/tests/Unit/V2/Client/StorageControlClientTest.php b/StorageControl/tests/Unit/V2/Client/StorageControlClientTest.php new file mode 100644 index 000000000000..9d0b66f96030 --- /dev/null +++ b/StorageControl/tests/Unit/V2/Client/StorageControlClientTest.php @@ -0,0 +1,882 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return StorageControlClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new StorageControlClient($options); + } + + /** @test */ + public function createFolderTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $metageneration = 1048558813; + $expectedResponse = new Folder(); + $expectedResponse->setName($name); + $expectedResponse->setMetageneration($metageneration); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->bucketName('[PROJECT]', '[BUCKET]'); + $folder = new Folder(); + $folderId = 'folderId527488652'; + $request = (new CreateFolderRequest()) + ->setParent($formattedParent) + ->setFolder($folder) + ->setFolderId($folderId); + $response = $gapicClient->createFolder($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/CreateFolder', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getFolder(); + $this->assertProtobufEquals($folder, $actualValue); + $actualValue = $actualRequestObject->getFolderId(); + $this->assertProtobufEquals($folderId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createFolderExceptionTest() + { + $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->bucketName('[PROJECT]', '[BUCKET]'); + $folder = new Folder(); + $folderId = 'folderId527488652'; + $request = (new CreateFolderRequest()) + ->setParent($formattedParent) + ->setFolder($folder) + ->setFolderId($folderId); + try { + $gapicClient->createFolder($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 createManagedFolderTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $metageneration = 1048558813; + $expectedResponse = new ManagedFolder(); + $expectedResponse->setName($name); + $expectedResponse->setMetageneration($metageneration); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->bucketName('[PROJECT]', '[BUCKET]'); + $managedFolder = new ManagedFolder(); + $managedFolderId = 'managedFolderId-239131156'; + $request = (new CreateManagedFolderRequest()) + ->setParent($formattedParent) + ->setManagedFolder($managedFolder) + ->setManagedFolderId($managedFolderId); + $response = $gapicClient->createManagedFolder($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/CreateManagedFolder', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getManagedFolder(); + $this->assertProtobufEquals($managedFolder, $actualValue); + $actualValue = $actualRequestObject->getManagedFolderId(); + $this->assertProtobufEquals($managedFolderId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createManagedFolderExceptionTest() + { + $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->bucketName('[PROJECT]', '[BUCKET]'); + $managedFolder = new ManagedFolder(); + $managedFolderId = 'managedFolderId-239131156'; + $request = (new CreateManagedFolderRequest()) + ->setParent($formattedParent) + ->setManagedFolder($managedFolder) + ->setManagedFolderId($managedFolderId); + try { + $gapicClient->createManagedFolder($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 deleteFolderTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->folderName('[PROJECT]', '[BUCKET]', '[FOLDER]'); + $request = (new DeleteFolderRequest())->setName($formattedName); + $gapicClient->deleteFolder($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/DeleteFolder', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteFolderExceptionTest() + { + $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->folderName('[PROJECT]', '[BUCKET]', '[FOLDER]'); + $request = (new DeleteFolderRequest())->setName($formattedName); + try { + $gapicClient->deleteFolder($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 deleteManagedFolderTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->managedFolderName('[PROJECT]', '[BUCKET]', '[MANAGEDFOLDER]'); + $request = (new DeleteManagedFolderRequest())->setName($formattedName); + $gapicClient->deleteManagedFolder($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/DeleteManagedFolder', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteManagedFolderExceptionTest() + { + $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->managedFolderName('[PROJECT]', '[BUCKET]', '[MANAGEDFOLDER]'); + $request = (new DeleteManagedFolderRequest())->setName($formattedName); + try { + $gapicClient->deleteManagedFolder($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 getFolderTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $metageneration = 1048558813; + $expectedResponse = new Folder(); + $expectedResponse->setName($name2); + $expectedResponse->setMetageneration($metageneration); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->folderName('[PROJECT]', '[BUCKET]', '[FOLDER]'); + $request = (new GetFolderRequest())->setName($formattedName); + $response = $gapicClient->getFolder($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/GetFolder', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFolderExceptionTest() + { + $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->folderName('[PROJECT]', '[BUCKET]', '[FOLDER]'); + $request = (new GetFolderRequest())->setName($formattedName); + try { + $gapicClient->getFolder($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 getManagedFolderTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $metageneration = 1048558813; + $expectedResponse = new ManagedFolder(); + $expectedResponse->setName($name2); + $expectedResponse->setMetageneration($metageneration); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->managedFolderName('[PROJECT]', '[BUCKET]', '[MANAGEDFOLDER]'); + $request = (new GetManagedFolderRequest())->setName($formattedName); + $response = $gapicClient->getManagedFolder($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/GetManagedFolder', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getManagedFolderExceptionTest() + { + $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->managedFolderName('[PROJECT]', '[BUCKET]', '[MANAGEDFOLDER]'); + $request = (new GetManagedFolderRequest())->setName($formattedName); + try { + $gapicClient->getManagedFolder($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 getStorageLayoutTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $location = 'location1901043637'; + $locationType = 'locationType-1796591228'; + $expectedResponse = new StorageLayout(); + $expectedResponse->setName($name2); + $expectedResponse->setLocation($location); + $expectedResponse->setLocationType($locationType); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->storageLayoutName('[PROJECT]', '[BUCKET]'); + $request = (new GetStorageLayoutRequest())->setName($formattedName); + $response = $gapicClient->getStorageLayout($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/GetStorageLayout', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getStorageLayoutExceptionTest() + { + $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->storageLayoutName('[PROJECT]', '[BUCKET]'); + $request = (new GetStorageLayoutRequest())->setName($formattedName); + try { + $gapicClient->getStorageLayout($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 listFoldersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $foldersElement = new Folder(); + $folders = [$foldersElement]; + $expectedResponse = new ListFoldersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setFolders($folders); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->bucketName('[PROJECT]', '[BUCKET]'); + $request = (new ListFoldersRequest())->setParent($formattedParent); + $response = $gapicClient->listFolders($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getFolders()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/ListFolders', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFoldersExceptionTest() + { + $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->bucketName('[PROJECT]', '[BUCKET]'); + $request = (new ListFoldersRequest())->setParent($formattedParent); + try { + $gapicClient->listFolders($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 listManagedFoldersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $managedFoldersElement = new ManagedFolder(); + $managedFolders = [$managedFoldersElement]; + $expectedResponse = new ListManagedFoldersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setManagedFolders($managedFolders); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->bucketName('[PROJECT]', '[BUCKET]'); + $request = (new ListManagedFoldersRequest())->setParent($formattedParent); + $response = $gapicClient->listManagedFolders($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getManagedFolders()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/ListManagedFolders', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listManagedFoldersExceptionTest() + { + $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->bucketName('[PROJECT]', '[BUCKET]'); + $request = (new ListManagedFoldersRequest())->setParent($formattedParent); + try { + $gapicClient->listManagedFolders($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 renameFolderTest() + { + $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/renameFolderTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $metageneration = 1048558813; + $expectedResponse = new Folder(); + $expectedResponse->setName($name2); + $expectedResponse->setMetageneration($metageneration); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/renameFolderTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->folderName('[PROJECT]', '[BUCKET]', '[FOLDER]'); + $destinationFolderId = 'destinationFolderId368368539'; + $request = (new RenameFolderRequest())->setName($formattedName)->setDestinationFolderId($destinationFolderId); + $response = $gapicClient->renameFolder($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.storage.control.v2.StorageControl/RenameFolder', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualApiRequestObject->getDestinationFolderId(); + $this->assertProtobufEquals($destinationFolderId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/renameFolderTest'); + $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 renameFolderExceptionTest() + { + $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/renameFolderTest'); + $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->folderName('[PROJECT]', '[BUCKET]', '[FOLDER]'); + $destinationFolderId = 'destinationFolderId368368539'; + $request = (new RenameFolderRequest())->setName($formattedName)->setDestinationFolderId($destinationFolderId); + $response = $gapicClient->renameFolder($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/renameFolderTest'); + 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 createFolderAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $metageneration = 1048558813; + $expectedResponse = new Folder(); + $expectedResponse->setName($name); + $expectedResponse->setMetageneration($metageneration); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->bucketName('[PROJECT]', '[BUCKET]'); + $folder = new Folder(); + $folderId = 'folderId527488652'; + $request = (new CreateFolderRequest()) + ->setParent($formattedParent) + ->setFolder($folder) + ->setFolderId($folderId); + $response = $gapicClient->createFolderAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/CreateFolder', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getFolder(); + $this->assertProtobufEquals($folder, $actualValue); + $actualValue = $actualRequestObject->getFolderId(); + $this->assertProtobufEquals($folderId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/composer.json b/composer.json index ea6d094edf64..b18c5d876806 100644 --- a/composer.json +++ b/composer.json @@ -73,8 +73,8 @@ "google/access-context-manager": "0.5.2", "google/analytics-admin": "0.22.2", "google/analytics-data": "0.16.2", - "google/apps-events-subscriptions": "0.1.0", "google/apps-chat": "0.0.0", + "google/apps-events-subscriptions": "0.1.0", "google/apps-meet": "0.2.0", "google/cloud-access-approval": "1.2.2", "google/cloud-advisorynotifications": "0.8.0", @@ -218,6 +218,7 @@ "google/cloud-speech": "1.18.0", "google/cloud-sql-admin": "0.16.0", "google/cloud-storage": "1.41.2", + "google/cloud-storage-control": "0.0.0", "google/cloud-storage-transfer": "1.4.2", "google/cloud-storageinsights": "0.3.2", "google/cloud-support": "0.2.2", @@ -261,12 +262,12 @@ "GPBMetadata\\Google\\Api\\Servicemanagement\\": "ServiceManagement/metadata", "GPBMetadata\\Google\\Api\\Serviceusage\\": "ServiceUsage/metadata", "GPBMetadata\\Google\\Appengine\\": "AppEngineAdmin/metadata", + "GPBMetadata\\Google\\Apps\\Card\\": "AppsChat/metadata/Card", "GPBMetadata\\Google\\Apps\\Events\\Subscriptions\\": "AppsEventsSubscriptions/metadata", "GPBMetadata\\Google\\Apps\\Meet\\": "AppsMeet/metadata", "GPBMetadata\\Google\\Apps\\Script\\Type\\": "GSuiteAddOns/external/metadata", "GPBMetadata\\Google\\Bigtable\\": "Bigtable/metadata", "GPBMetadata\\Google\\Chat\\": "AppsChat/metadata/Chat", - "GPBMetadata\\Google\\Apps\\Card\\": "AppsChat/metadata/Card", "GPBMetadata\\Google\\Cloud\\Accessapproval\\": "AccessApproval/metadata", "GPBMetadata\\Google\\Cloud\\Advisorynotifications\\": "AdvisoryNotifications/metadata", "GPBMetadata\\Google\\Cloud\\Aiplatform\\": "AiPlatform/metadata", @@ -434,13 +435,14 @@ "GPBMetadata\\Google\\Shopping\\Merchant\\Reports\\": "ShoppingMerchantReports/metadata", "GPBMetadata\\Google\\Shopping\\Type\\": "ShoppingCommonProtos/metadata/Type", "GPBMetadata\\Google\\Spanner\\": "Spanner/metadata", + "GPBMetadata\\Google\\Storage\\Control\\": "StorageControl/metadata", "GPBMetadata\\Google\\Storagetransfer\\": "StorageTransfer/metadata", "GPBMetadata\\Grafeas\\": "Grafeas/metadata", "Google\\Analytics\\Admin\\": "AnalyticsAdmin/src", "Google\\Analytics\\Data\\": "AnalyticsData/src", "Google\\ApiCore\\LongRunning\\": "LongRunning/src/ApiCore/LongRunning", - "Google\\Apps\\Chat\\": "AppsChat/src/Chat", "Google\\Apps\\Card\\": "AppsChat/src/Card", + "Google\\Apps\\Chat\\": "AppsChat/src/Chat", "Google\\Apps\\Events\\Subscriptions\\": "AppsEventsSubscriptions/src", "Google\\Apps\\Meet\\": "AppsMeet/src", "Google\\Apps\\Script\\Type\\": "GSuiteAddOns/external/protos", @@ -593,6 +595,7 @@ "Google\\Cloud\\StorageInsights\\": "StorageInsights/src", "Google\\Cloud\\StorageTransfer\\": "StorageTransfer/src", "Google\\Cloud\\Storage\\": "Storage/src", + "Google\\Cloud\\Storage\\Control\\": "StorageControl/src", "Google\\Cloud\\Support\\": "Support/src", "Google\\Cloud\\Talent\\": "Talent/src", "Google\\Cloud\\Tasks\\": "Tasks/src", From 1e6b6b62c9a42807f56e0887bd571044386f095a Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 19 Apr 2024 12:03:58 -0700 Subject: [PATCH 2/3] remove REST from README --- StorageControl/README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/StorageControl/README.md b/StorageControl/README.md index e76583c9bb49..026d2255300f 100644 --- a/StorageControl/README.md +++ b/StorageControl/README.md @@ -20,15 +20,11 @@ Now, install this component: $ composer require google/cloud-storage-control ``` -This component requires the gRPC extension. Please see our [gRPC installation guide](https://cloud.google.com/php/grpc) -for more information on how to configure the extension. - > 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). +This component requires the gRPC extension. Please see our [gRPC installation guide](https://cloud.google.com/php/grpc) +for more information on how to configure the extension. ### Authentication From c17dce0a31b5e13c4a48ad59205a463c4167bd6b Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 26 Apr 2024 00:01:46 +0000 Subject: [PATCH 3/3] updates from gapic-generator-php v1.13.0 --- .../V2/StorageControlClient/create_folder.php | 7 +++- .../V2/StorageControlClient/delete_folder.php | 4 +- .../V2/StorageControlClient/get_folder.php | 4 +- .../V2/StorageControlClient/list_folders.php | 7 +++- .../V2/StorageControlClient/rename_folder.php | 4 +- .../src/V2/Client/StorageControlClient.php | 40 +++++++++++-------- StorageControl/src/V2/CreateFolderRequest.php | 31 +++++++------- StorageControl/src/V2/DeleteFolderRequest.php | 16 ++++---- StorageControl/src/V2/Folder.php | 4 +- StorageControl/src/V2/GetFolderRequest.php | 4 +- StorageControl/src/V2/ListFoldersRequest.php | 19 ++++++--- StorageControl/src/V2/RenameFolderRequest.php | 4 +- .../storage_control_rest_client_config.php | 25 ------------ 13 files changed, 89 insertions(+), 80 deletions(-) delete mode 100644 StorageControl/src/V2/resources/storage_control_rest_client_config.php diff --git a/StorageControl/samples/V2/StorageControlClient/create_folder.php b/StorageControl/samples/V2/StorageControlClient/create_folder.php index 7a80bb4eeadb..14d0a5f64d18 100644 --- a/StorageControl/samples/V2/StorageControlClient/create_folder.php +++ b/StorageControl/samples/V2/StorageControlClient/create_folder.php @@ -29,9 +29,12 @@ use Google\Cloud\Storage\Control\V2\Folder; /** - * Creates a new folder. + * Creates a new folder. This operation is only applicable to a hierarchical + * namespace enabled bucket. + * Hierarchical namespace buckets are in allowlist preview. * - * @param string $formattedParent Name of the bucket in which the folder will reside. Please see + * @param string $formattedParent Name of the bucket in which the folder will reside. The bucket + * must be a hierarchical namespace enabled bucket. Please see * {@see StorageControlClient::bucketName()} for help formatting this field. * @param string $folderId The full name of a folder, including all its parent folders. * Folders use single '/' characters as a delimiter. diff --git a/StorageControl/samples/V2/StorageControlClient/delete_folder.php b/StorageControl/samples/V2/StorageControlClient/delete_folder.php index f84ac441c87b..ca3512485a12 100644 --- a/StorageControl/samples/V2/StorageControlClient/delete_folder.php +++ b/StorageControl/samples/V2/StorageControlClient/delete_folder.php @@ -28,7 +28,9 @@ use Google\Cloud\Storage\Control\V2\DeleteFolderRequest; /** - * Permanently deletes an empty folder. + * Permanently deletes an empty folder. This operation is only applicable to a + * hierarchical namespace enabled bucket. + * Hierarchical namespace buckets are in allowlist preview. * * @param string $formattedName Name of the folder. * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` diff --git a/StorageControl/samples/V2/StorageControlClient/get_folder.php b/StorageControl/samples/V2/StorageControlClient/get_folder.php index 5adcf302597a..bf29421ecfd1 100644 --- a/StorageControl/samples/V2/StorageControlClient/get_folder.php +++ b/StorageControl/samples/V2/StorageControlClient/get_folder.php @@ -29,7 +29,9 @@ use Google\Cloud\Storage\Control\V2\GetFolderRequest; /** - * Returns metadata for the specified folder. + * Returns metadata for the specified folder. This operation is only + * applicable to a hierarchical namespace enabled bucket. + * Hierarchical namespace buckets are in allowlist preview. * * @param string $formattedName Name of the folder. * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` diff --git a/StorageControl/samples/V2/StorageControlClient/list_folders.php b/StorageControl/samples/V2/StorageControlClient/list_folders.php index 24e99e6c3924..f85807165986 100644 --- a/StorageControl/samples/V2/StorageControlClient/list_folders.php +++ b/StorageControl/samples/V2/StorageControlClient/list_folders.php @@ -30,9 +30,12 @@ use Google\Cloud\Storage\Control\V2\ListFoldersRequest; /** - * Retrieves a list of folders for a given bucket. + * Retrieves a list of folders. This operation is only applicable to a + * hierarchical namespace enabled bucket. + * Hierarchical namespace buckets are in allowlist preview. * - * @param string $formattedParent Name of the bucket in which to look for folders. Please see + * @param string $formattedParent Name of the bucket in which to look for folders. The bucket must + * be a hierarchical namespace enabled bucket. Please see * {@see StorageControlClient::bucketName()} for help formatting this field. */ function list_folders_sample(string $formattedParent): void diff --git a/StorageControl/samples/V2/StorageControlClient/rename_folder.php b/StorageControl/samples/V2/StorageControlClient/rename_folder.php index bdac215ed944..cf5a4e3e05fc 100644 --- a/StorageControl/samples/V2/StorageControlClient/rename_folder.php +++ b/StorageControl/samples/V2/StorageControlClient/rename_folder.php @@ -31,9 +31,11 @@ use Google\Rpc\Status; /** - * Renames a source folder to a destination folder. During a rename, the + * Renames a source folder to a destination folder. This operation is only + * applicable to a hierarchical namespace enabled bucket. During a rename, the * source and destination folders are locked until the long running operation * completes. + * Hierarchical namespace buckets are in allowlist preview. * * @param string $formattedName Name of the source folder being renamed. * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` diff --git a/StorageControl/src/V2/Client/StorageControlClient.php b/StorageControl/src/V2/Client/StorageControlClient.php index 995e8888d5b8..9a766ef1fb6d 100644 --- a/StorageControl/src/V2/Client/StorageControlClient.php +++ b/StorageControl/src/V2/Client/StorageControlClient.php @@ -119,14 +119,15 @@ private static function getClientDefaults() 'credentialsConfig' => [ 'defaultScopes' => self::$serviceScopes, ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/storage_control_rest_client_config.php', - ], - ], ]; } + /** Implements ClientOptionsTrait::supportedTransports. */ + private static function supportedTransports() + { + return ['grpc', 'grpc-fallback']; + } + /** * Return an OperationsClient object with the same endpoint as $this. * @@ -287,9 +288,8 @@ public static function parseName(string $formattedName, string $template = null) * 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 + * The transport used for executing network requests. At the moment, supports only + * `grpc`. *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. @@ -299,10 +299,8 @@ public static function parseName(string $formattedName, string $template = null) * example: * $transportConfig = [ * 'grpc' => [...], - * 'rest' => [...], * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} method for the * supported options. * @type callable $clientCertSource * A callable which returns the client cert as a string. This can be used to @@ -330,7 +328,9 @@ public function __call($method, $args) } /** - * Creates a new folder. + * Creates a new folder. This operation is only applicable to a hierarchical + * namespace enabled bucket. + * Hierarchical namespace buckets are in allowlist preview. * * The async variant is {@see StorageControlClient::createFolderAsync()} . * @@ -382,7 +382,9 @@ public function createManagedFolder(CreateManagedFolderRequest $request, array $ } /** - * Permanently deletes an empty folder. + * Permanently deletes an empty folder. This operation is only applicable to a + * hierarchical namespace enabled bucket. + * Hierarchical namespace buckets are in allowlist preview. * * The async variant is {@see StorageControlClient::deleteFolderAsync()} . * @@ -430,7 +432,9 @@ public function deleteManagedFolder(DeleteManagedFolderRequest $request, array $ } /** - * Returns metadata for the specified folder. + * Returns metadata for the specified folder. This operation is only + * applicable to a hierarchical namespace enabled bucket. + * Hierarchical namespace buckets are in allowlist preview. * * The async variant is {@see StorageControlClient::getFolderAsync()} . * @@ -508,7 +512,9 @@ public function getStorageLayout(GetStorageLayoutRequest $request, array $callOp } /** - * Retrieves a list of folders for a given bucket. + * Retrieves a list of folders. This operation is only applicable to a + * hierarchical namespace enabled bucket. + * Hierarchical namespace buckets are in allowlist preview. * * The async variant is {@see StorageControlClient::listFoldersAsync()} . * @@ -560,9 +566,11 @@ public function listManagedFolders(ListManagedFoldersRequest $request, array $ca } /** - * Renames a source folder to a destination folder. During a rename, the + * Renames a source folder to a destination folder. This operation is only + * applicable to a hierarchical namespace enabled bucket. During a rename, the * source and destination folders are locked until the long running operation * completes. + * Hierarchical namespace buckets are in allowlist preview. * * The async variant is {@see StorageControlClient::renameFolderAsync()} . * diff --git a/StorageControl/src/V2/CreateFolderRequest.php b/StorageControl/src/V2/CreateFolderRequest.php index c57a8e1f0b9f..805011c9fe0c 100644 --- a/StorageControl/src/V2/CreateFolderRequest.php +++ b/StorageControl/src/V2/CreateFolderRequest.php @@ -9,14 +9,17 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Request message for CreateFolder. + * Request message for CreateFolder. This operation is only applicable to a + * hierarchical namespace enabled bucket. + * Hierarchical namespace buckets are in allowlist preview. * * Generated from protobuf message google.storage.control.v2.CreateFolderRequest */ class CreateFolderRequest extends \Google\Protobuf\Internal\Message { /** - * Required. Name of the bucket in which the folder will reside. + * Required. Name of the bucket in which the folder will reside. The bucket + * must be a hierarchical namespace enabled bucket. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -49,15 +52,15 @@ class CreateFolderRequest extends \Google\Protobuf\Internal\Message protected $recursive = false; /** * Optional. A unique identifier for this request. UUID is the recommended - * format, but other formats are still accepted. This request is only - * idempotent if a `request_id` is provided. + * format, but other formats are still accepted. * * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { */ protected $request_id = ''; /** - * @param string $parent Required. Name of the bucket in which the folder will reside. Please see + * @param string $parent Required. Name of the bucket in which the folder will reside. The bucket + * must be a hierarchical namespace enabled bucket. Please see * {@see StorageControlClient::bucketName()} for help formatting this field. * @param \Google\Cloud\Storage\Control\V2\Folder $folder Required. Properties of the new folder being created. * The bucket and name of the folder are specified in the parent and folder_id @@ -88,7 +91,8 @@ public static function build(string $parent, \Google\Cloud\Storage\Control\V2\Fo * Optional. Data for populating the Message object. * * @type string $parent - * Required. Name of the bucket in which the folder will reside. + * Required. Name of the bucket in which the folder will reside. The bucket + * must be a hierarchical namespace enabled bucket. * @type \Google\Cloud\Storage\Control\V2\Folder $folder * Required. Properties of the new folder being created. * The bucket and name of the folder are specified in the parent and folder_id @@ -105,8 +109,7 @@ public static function build(string $parent, \Google\Cloud\Storage\Control\V2\Fo * ancestor folders will be created atomically. * @type string $request_id * Optional. A unique identifier for this request. UUID is the recommended - * format, but other formats are still accepted. This request is only - * idempotent if a `request_id` is provided. + * format, but other formats are still accepted. * } */ public function __construct($data = NULL) { @@ -115,7 +118,8 @@ public function __construct($data = NULL) { } /** - * Required. Name of the bucket in which the folder will reside. + * Required. Name of the bucket in which the folder will reside. The bucket + * must be a hierarchical namespace enabled bucket. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -126,7 +130,8 @@ public function getParent() } /** - * Required. Name of the bucket in which the folder will reside. + * Required. Name of the bucket in which the folder will reside. The bucket + * must be a hierarchical namespace enabled bucket. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var @@ -246,8 +251,7 @@ public function setRecursive($var) /** * Optional. A unique identifier for this request. UUID is the recommended - * format, but other formats are still accepted. This request is only - * idempotent if a `request_id` is provided. + * format, but other formats are still accepted. * * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { * @return string @@ -259,8 +263,7 @@ public function getRequestId() /** * Optional. A unique identifier for this request. UUID is the recommended - * format, but other formats are still accepted. This request is only - * idempotent if a `request_id` is provided. + * format, but other formats are still accepted. * * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { * @param string $var diff --git a/StorageControl/src/V2/DeleteFolderRequest.php b/StorageControl/src/V2/DeleteFolderRequest.php index 90928c981dfc..6958ada830b8 100644 --- a/StorageControl/src/V2/DeleteFolderRequest.php +++ b/StorageControl/src/V2/DeleteFolderRequest.php @@ -9,7 +9,9 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Request message for DeleteFolder. + * Request message for DeleteFolder. This operation is only applicable to a + * hierarchical namespace enabled bucket. + * Hierarchical namespace buckets are in allowlist preview. * * Generated from protobuf message google.storage.control.v2.DeleteFolderRequest */ @@ -38,8 +40,7 @@ class DeleteFolderRequest extends \Google\Protobuf\Internal\Message protected $if_metageneration_not_match = null; /** * Optional. A unique identifier for this request. UUID is the recommended - * format, but other formats are still accepted. This request is only - * idempotent if a `request_id` is provided. + * format, but other formats are still accepted. * * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { */ @@ -77,8 +78,7 @@ public static function build(string $name): self * current metageneration does not match the given value. * @type string $request_id * Optional. A unique identifier for this request. UUID is the recommended - * format, but other formats are still accepted. This request is only - * idempotent if a `request_id` is provided. + * format, but other formats are still accepted. * } */ public function __construct($data = NULL) { @@ -192,8 +192,7 @@ public function setIfMetagenerationNotMatch($var) /** * Optional. A unique identifier for this request. UUID is the recommended - * format, but other formats are still accepted. This request is only - * idempotent if a `request_id` is provided. + * format, but other formats are still accepted. * * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { * @return string @@ -205,8 +204,7 @@ public function getRequestId() /** * Optional. A unique identifier for this request. UUID is the recommended - * format, but other formats are still accepted. This request is only - * idempotent if a `request_id` is provided. + * format, but other formats are still accepted. * * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { * @param string $var diff --git a/StorageControl/src/V2/Folder.php b/StorageControl/src/V2/Folder.php index 86e914127fc4..8c1eba3f85dd 100644 --- a/StorageControl/src/V2/Folder.php +++ b/StorageControl/src/V2/Folder.php @@ -9,7 +9,9 @@ use Google\Protobuf\Internal\GPBUtil; /** - * A folder. + * A folder resource. This resource can only exist in a hierarchical namespace + * enabled bucket. + * Hierarchical namespace buckets are in allowlist preview. * * Generated from protobuf message google.storage.control.v2.Folder */ diff --git a/StorageControl/src/V2/GetFolderRequest.php b/StorageControl/src/V2/GetFolderRequest.php index df4f91b5685f..2319f89f3424 100644 --- a/StorageControl/src/V2/GetFolderRequest.php +++ b/StorageControl/src/V2/GetFolderRequest.php @@ -9,7 +9,9 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Request message for GetFolder. + * Request message for GetFolder. This operation is only applicable to a + * hierarchical namespace enabled bucket. + * Hierarchical namespace buckets are in allowlist preview. * * Generated from protobuf message google.storage.control.v2.GetFolderRequest */ diff --git a/StorageControl/src/V2/ListFoldersRequest.php b/StorageControl/src/V2/ListFoldersRequest.php index 1f57f1c9d342..58c36f44ffeb 100644 --- a/StorageControl/src/V2/ListFoldersRequest.php +++ b/StorageControl/src/V2/ListFoldersRequest.php @@ -9,14 +9,17 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Request message for ListFolders. + * Request message for ListFolders. This operation is only applicable to a + * hierarchical namespace enabled bucket. + * Hierarchical namespace buckets are in allowlist preview. * * Generated from protobuf message google.storage.control.v2.ListFoldersRequest */ class ListFoldersRequest extends \Google\Protobuf\Internal\Message { /** - * Required. Name of the bucket in which to look for folders. + * Required. Name of the bucket in which to look for folders. The bucket must + * be a hierarchical namespace enabled bucket. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -77,7 +80,8 @@ class ListFoldersRequest extends \Google\Protobuf\Internal\Message protected $request_id = ''; /** - * @param string $parent Required. Name of the bucket in which to look for folders. Please see + * @param string $parent Required. Name of the bucket in which to look for folders. The bucket must + * be a hierarchical namespace enabled bucket. Please see * {@see StorageControlClient::bucketName()} for help formatting this field. * * @return \Google\Cloud\Storage\Control\V2\ListFoldersRequest @@ -97,7 +101,8 @@ public static function build(string $parent): self * Optional. Data for populating the Message object. * * @type string $parent - * Required. Name of the bucket in which to look for folders. + * Required. Name of the bucket in which to look for folders. The bucket must + * be a hierarchical namespace enabled bucket. * @type int $page_size * Optional. Maximum number of folders to return in a single response. The * service will use this parameter or 1,000 items, whichever is smaller. @@ -132,7 +137,8 @@ public function __construct($data = NULL) { } /** - * Required. Name of the bucket in which to look for folders. + * Required. Name of the bucket in which to look for folders. The bucket must + * be a hierarchical namespace enabled bucket. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -143,7 +149,8 @@ public function getParent() } /** - * Required. Name of the bucket in which to look for folders. + * Required. Name of the bucket in which to look for folders. The bucket must + * be a hierarchical namespace enabled bucket. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var diff --git a/StorageControl/src/V2/RenameFolderRequest.php b/StorageControl/src/V2/RenameFolderRequest.php index 77df9a3e1702..fd0605ae9953 100644 --- a/StorageControl/src/V2/RenameFolderRequest.php +++ b/StorageControl/src/V2/RenameFolderRequest.php @@ -9,7 +9,9 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Request message for RenameFolder. + * Request message for RenameFolder. This operation is only applicable to a + * hierarchical namespace enabled bucket. + * Hierarchical namespace buckets are in allowlist preview. * * Generated from protobuf message google.storage.control.v2.RenameFolderRequest */ diff --git a/StorageControl/src/V2/resources/storage_control_rest_client_config.php b/StorageControl/src/V2/resources/storage_control_rest_client_config.php deleted file mode 100644 index 64cb7f58c392..000000000000 --- a/StorageControl/src/V2/resources/storage_control_rest_client_config.php +++ /dev/null @@ -1,25 +0,0 @@ - [], -];