.gitattributes000064400000000236151742725260007453 0ustar00/*.xml.dist export-ignore /tests export-ignore /.github export-ignore /.repo-metadata.json export-ignore /.OwlBot.yaml export-ignore /owlbot.py export-ignore CODE_OF_CONDUCT.md000064400000003674151742725260007370 0ustar00# Contributor Code of Conduct As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery * Personal attacks * Trolling or insulting/derogatory comments * Public or private harassment * Publishing other's private information, such as physical or electronic addresses, without explicit permission * Other unethical or unprofessional conduct. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)CONTRIBUTING.md000064400000001000151742725260006777 0ustar00# 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. LICENSE000064400000026136151742725260005574 0ustar00 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. README.md000064400000003457151742725260006047 0ustar00# Google LongRunning API for PHP > Idiomatic PHP client for [Google LongRunning API](https://cloud.google.com/service-infrastructure/docs/service-management/reference/rpc/google.longrunning). [![Latest Stable Version](https://poser.pugx.org/google/longrunning/v/stable)](https://packagist.org/packages/google/longrunning) [![Packagist](https://img.shields.io/packagist/dm/google/longrunning.svg)](https://packagist.org/packages/google/longrunning) * [API documentation](https://cloud.google.com/service-infrastructure/docs/service-management/reference/rpc/google.longrunning) **NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any support requests, bug reports, or development contributions should be directed to that project. ### Installation To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/). Now to install just this component: ```sh $ composer require google/longrunning ``` This component supports both REST over HTTP/1.1 and gRPC. In order to take advantage of the benefits offered by gRPC (such as streaming methods) please see our [gRPC installation guide](https://cloud.google.com/php/grpc). ### Authentication Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information on authenticating your client. Once authenticated, you'll be ready to start making requests. ### Version This component is considered beta. As such, it should be expected to be mostly stable and we're working towards a release candidate. We will address issues and requests with a higher priority. ### Next Steps 1. Understand the [official documentation](https://cloud.google.com/service-infrastructure/docs/service-management/reference/rpc/google.longrunning/docs). SECURITY.md000064400000000511151742725260006345 0ustar00# Security Policy To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). The Google Security Team will respond within 5 working days of your report on g.co/vulnz. We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. VERSION000064400000000006151742725260005623 0ustar000.1.0 composer.json000064400000001315151742725260007301 0ustar00{ "name": "google/longrunning", "description": "Google LongRunning Client for PHP", "license": "Apache-2.0", "minimum-stability": "stable", "autoload": { "psr-4": { "Google\\ApiCore\\LongRunning\\": "src/ApiCore/LongRunning", "Google\\LongRunning\\": "src/LongRunning", "GPBMetadata\\Google\\Longrunning\\": "metadata/Longrunning" } }, "extra": { "component": { "id": "longrunning", "path": "LongRunning", "entry": null, "target": "googleapis/php-longrunning" } }, "require-dev": { "google/gax": "^1.13.0", "phpunit/phpunit": "^4.8|^5.0|^8.0" } } metadata/Longrunning/Operations.php000064400000010414151742725260013473 0ustar00internalAddGeneratedFile(hex2bin( "0afd0a0a23676f6f676c652f6c6f6e6772756e6e696e672f6f7065726174" . "696f6e732e70726f746f1212676f6f676c652e6c6f6e6772756e6e696e67" . "1a19676f6f676c652f70726f746f6275662f616e792e70726f746f1a2067" . "6f6f676c652f70726f746f6275662f64657363726970746f722e70726f74" . "6f1a1b676f6f676c652f70726f746f6275662f656d7074792e70726f746f" . "1a17676f6f676c652f7270632f7374617475732e70726f746f22a8010a09" . "4f7065726174696f6e120c0a046e616d6518012001280912260a086d6574" . "616461746118022001280b32142e676f6f676c652e70726f746f6275662e" . "416e79120c0a04646f6e6518032001280812230a056572726f7218042001" . "280b32122e676f6f676c652e7270632e537461747573480012280a087265" . "73706f6e736518052001280b32142e676f6f676c652e70726f746f627566" . "2e416e79480042080a06726573756c7422230a134765744f706572617469" . "6f6e52657175657374120c0a046e616d65180120012809225c0a154c6973" . "744f7065726174696f6e7352657175657374120c0a046e616d6518042001" . "2809120e0a0666696c74657218012001280912110a09706167655f73697a" . "6518022001280512120a0a706167655f746f6b656e18032001280922640a" . "164c6973744f7065726174696f6e73526573706f6e736512310a0a6f7065" . "726174696f6e7318012003280b321d2e676f6f676c652e6c6f6e6772756e" . "6e696e672e4f7065726174696f6e12170a0f6e6578745f706167655f746f" . "6b656e18022001280922260a1643616e63656c4f7065726174696f6e5265" . "7175657374120c0a046e616d6518012001280922260a1644656c6574654f" . "7065726174696f6e52657175657374120c0a046e616d6518012001280922" . "3d0a0d4f7065726174696f6e496e666f12150a0d726573706f6e73655f74" . "79706518012001280912150a0d6d657461646174615f7479706518022001" . "2809328c040a0a4f7065726174696f6e731286010a0e4c6973744f706572" . "6174696f6e7312292e676f6f676c652e6c6f6e6772756e6e696e672e4c69" . "73744f7065726174696f6e73526571756573741a2a2e676f6f676c652e6c" . "6f6e6772756e6e696e672e4c6973744f7065726174696f6e73526573706f" . "6e7365221d82d3e493021712152f76312f7b6e616d653d6f706572617469" . "6f6e737d12780a0c4765744f7065726174696f6e12272e676f6f676c652e" . "6c6f6e6772756e6e696e672e4765744f7065726174696f6e526571756573" . "741a1d2e676f6f676c652e6c6f6e6772756e6e696e672e4f706572617469" . "6f6e222082d3e493021a12182f76312f7b6e616d653d6f7065726174696f" . "6e732f2a2a7d12770a0f44656c6574654f7065726174696f6e122a2e676f" . "6f676c652e6c6f6e6772756e6e696e672e44656c6574654f706572617469" . "6f6e526571756573741a162e676f6f676c652e70726f746f6275662e456d" . "707479222082d3e493021a2a182f76312f7b6e616d653d6f706572617469" . "6f6e732f2a2a7d1281010a0f43616e63656c4f7065726174696f6e122a2e" . "676f6f676c652e6c6f6e6772756e6e696e672e43616e63656c4f70657261" . "74696f6e526571756573741a162e676f6f676c652e70726f746f6275662e" . "456d707479222a82d3e4930224221f2f76312f7b6e616d653d6f70657261" . "74696f6e732f2a2a7d3a63616e63656c3a012a4294010a16636f6d2e676f" . "6f676c652e6c6f6e6772756e6e696e67420f4f7065726174696f6e735072" . "6f746f50015a3d676f6f676c652e676f6c616e672e6f72672f67656e7072" . "6f746f2f676f6f676c65617069732f6c6f6e6772756e6e696e673b6c6f6e" . "6772756e6e696e67aa0212476f6f676c652e4c6f6e6752756e6e696e67ca" . "0212476f6f676c655c4c6f6e6752756e6e696e67620670726f746f33" ), true); static::$is_initialized = true; } } metadata/README.md000064400000000243151742725260007615 0ustar00# Google Protobuf Metadata Classes ## WARNING! These classes are not intended for direct use - they exist only to support the generated protobuf classes in src/ src/ApiCore/LongRunning/Gapic/OperationsGapicClient.php000064400000041167151742725260017123 0ustar00 'my-service-address', * 'scopes' => ['my-service-scope'], * ]; * $operationsClient = new OperationsClient($options); * try { * $name = ''; * $response = $operationsClient->getOperation($name); * } finally { * if (isset($operationsClient)) { * $operationsClient->close(); * } * } * ``` * * @experimental */ class OperationsGapicClient { use GapicClientTrait; /** * The name of the service. */ const SERVICE_NAME = 'google.longrunning.Operations'; /** * The default port of the service. */ const DEFAULT_SERVICE_PORT = 443; /** * The name of the code generator, to be included in the agent header. */ const CODEGEN_NAME = 'gapic'; private static function getClientDefaults() { return [ 'serviceName' => self::SERVICE_NAME, 'clientConfig' => __DIR__.'/../resources/operations_client_config.json', 'descriptorsConfigPath' => __DIR__.'/../resources/operations_descriptor_config.php', 'credentialsConfig' => [ ], 'transportConfig' => [ 'rest' => [ 'restClientConfigPath' => __DIR__.'/../resources/operations_rest_client_config.php' ], ], ]; } /** * Constructor. * * @param array $options { * Required. Options for configuring the service API wrapper. Those options * that must be provided are marked as Required. * * @type string $apiEndpoint * Required. The address of the API remote host. May optionally include the port, * formatted as ":". * @type string|array $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 * \Google\Auth\FetchAuthTokenInterface object or \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 * \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 $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 * TransportInterface object. Note that when this objects 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 GrpcTransport::build and RestTransport::build methods for the supported * options. * } * @experimental */ public function __construct($options = []) { $clientOptions = $this->buildClientOptions($options); $this->setClientOptions($clientOptions); } /** * Gets the latest state of a long-running operation. Clients can use this * method to poll the operation result at intervals as recommended by the API * service. * * Sample code: * ``` * $options = [ * 'apiEndpoint' => 'my-service-address', * 'scopes' => ['my-service-scope'], * ]; * $operationsClient = new OperationsClient($options); * try { * $name = ''; * $response = $operationsClient->getOperation($name); * } finally { * if (isset($operationsClient)) { * $operationsClient->close(); * } * } * ``` * * @param string $name The name of the operation resource. * @param array $optionalArgs { * Optional. * * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a * {@see Google\ApiCore\RetrySettings} object, or an associative array * of retry settings parameters. See the documentation on * {@see Google\ApiCore\RetrySettings} for example usage. * } * * @return \Google\LongRunning\Operation * * @throws ApiException if the remote call fails * @experimental */ public function getOperation($name, $optionalArgs = []) { $request = new GetOperationRequest(); $request->setName($name); $requestParams = new RequestParamsHeaderDescriptor([ 'name' => $request->getName(), ]); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall( 'GetOperation', Operation::class, $optionalArgs, $request )->wait(); } /** * Lists operations that match the specified filter in the request. If the * server doesn't support this method, it returns `UNIMPLEMENTED`. * * NOTE: the `name` binding below allows API services to override the binding * to use different resource name schemes, such as `users/*/operations`. * * Sample code: * ``` * $options = [ * 'apiEndpoint' => 'my-service-address', * 'scopes' => ['my-service-scope'], * ]; * $operationsClient = new OperationsClient($options); * try { * $name = ''; * $filter = ''; * // Iterate through all elements * $pagedResponse = $operationsClient->listOperations($name, $filter); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * * // OR iterate over pages of elements * $pagedResponse = $operationsClient->listOperations($name, $filter); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); * } * } * } finally { * if (isset($operationsClient)) { * $operationsClient->close(); * } * } * ``` * * @param string $name The name of the operation collection. * @param string $filter The standard list filter. * @param array $optionalArgs { * Optional. * * @type int $pageSize * The maximum number of resources contained in the underlying API * response. The API may return fewer values in a page, even if * there are additional values to be retrieved. * @type string $pageToken * A page token is used to specify a page of values to be returned. * If no page token is specified (the default), the first page * of values will be returned. Any page token used here must have * been generated by a previous call to the API. * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a * {@see Google\ApiCore\RetrySettings} object, or an associative array * of retry settings parameters. See the documentation on * {@see Google\ApiCore\RetrySettings} for example usage. * } * * @return \Google\ApiCore\PagedListResponse * * @throws ApiException if the remote call fails * @experimental */ public function listOperations($name, $filter, $optionalArgs = []) { $request = new ListOperationsRequest(); $request->setName($name); $request->setFilter($filter); if (isset($optionalArgs['pageSize'])) { $request->setPageSize($optionalArgs['pageSize']); } if (isset($optionalArgs['pageToken'])) { $request->setPageToken($optionalArgs['pageToken']); } $requestParams = new RequestParamsHeaderDescriptor([ 'name' => $request->getName(), ]); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->getPagedListResponse( 'ListOperations', $optionalArgs, ListOperationsResponse::class, $request ); } /** * Starts asynchronous cancellation on a long-running operation. The server * makes a best effort to cancel the operation, but success is not * guaranteed. If the server doesn't support this method, it returns * `google.rpc.Code.UNIMPLEMENTED`. Clients can use * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or * other methods to check whether the cancellation succeeded or whether the * operation completed despite cancellation. On successful cancellation, * the operation is not deleted; instead, it becomes an operation with * an [Operation.error][google.longrunning.Operation.error] value with a * [google.rpc.Status.code][google.rpc.Status.code] of 1, * corresponding to `Code.CANCELLED`. * * Sample code: * ``` * $options = [ * 'apiEndpoint' => 'my-service-address', * 'scopes' => ['my-service-scope'], * ]; * $operationsClient = new OperationsClient($options); * try { * $name = ''; * $operationsClient->cancelOperation($name); * } finally { * if (isset($operationsClient)) { * $operationsClient->close(); * } * } * ``` * * @param string $name The name of the operation resource to be cancelled. * @param array $optionalArgs { * Optional. * * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a * {@see Google\ApiCore\RetrySettings} object, or an associative array * of retry settings parameters. See the documentation on * {@see Google\ApiCore\RetrySettings} for example usage. * } * * @throws ApiException if the remote call fails * @experimental */ public function cancelOperation($name, $optionalArgs = []) { $request = new CancelOperationRequest(); $request->setName($name); $requestParams = new RequestParamsHeaderDescriptor([ 'name' => $request->getName(), ]); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall( 'CancelOperation', GPBEmpty::class, $optionalArgs, $request )->wait(); } /** * Deletes a long-running operation. This method indicates that the client is * no longer interested in the operation result. It does not cancel the * operation. If the server doesn't support this method, it returns * `google.rpc.Code.UNIMPLEMENTED`. * * Sample code: * ``` * $options = [ * 'apiEndpoint' => 'my-service-address', * 'scopes' => ['my-service-scope'], * ]; * $operationsClient = new OperationsClient($options); * try { * $name = ''; * $operationsClient->deleteOperation($name); * } finally { * if (isset($operationsClient)) { * $operationsClient->close(); * } * } * ``` * * @param string $name The name of the operation resource to be deleted. * @param array $optionalArgs { * Optional. * * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a * {@see Google\ApiCore\RetrySettings} object, or an associative array * of retry settings parameters. See the documentation on * {@see Google\ApiCore\RetrySettings} for example usage. * } * * @throws ApiException if the remote call fails * @experimental */ public function deleteOperation($name, $optionalArgs = []) { $request = new DeleteOperationRequest(); $request->setName($name); $requestParams = new RequestParamsHeaderDescriptor([ 'name' => $request->getName(), ]); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall( 'DeleteOperation', GPBEmpty::class, $optionalArgs, $request )->wait(); } } src/ApiCore/LongRunning/OperationsClient.php000064400000002561151742725260015127 0ustar00 [ 'google.longrunning.Operations' => [ 'ListOperations' => [ 'pageStreaming' => [ 'requestPageTokenGetMethod' => 'getPageToken', 'requestPageTokenSetMethod' => 'setPageToken', 'requestPageSizeGetMethod' => 'getPageSize', 'requestPageSizeSetMethod' => 'setPageSize', 'responsePageTokenGetMethod' => 'getNextPageToken', 'resourcesGetMethod' => 'getOperations', ], ], ], ], ]; src/ApiCore/LongRunning/resources/operations_rest_client_config.php000064400000003057151742725260021763 0ustar00 [ 'google.longrunning.Operations' => [ 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=operations/**}', 'placeholders' => [ 'name' => [ 'getters' => [ 'getName', ], ], ], ], 'ListOperations' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=operations}', 'placeholders' => [ 'name' => [ 'getters' => [ 'getName', ], ], ], ], 'CancelOperation' => [ 'method' => 'post', 'uriTemplate' => '/v1/{name=operations/**}:cancel', 'body' => '*', 'placeholders' => [ 'name' => [ 'getters' => [ 'getName', ], ], ], ], 'DeleteOperation' => [ 'method' => 'delete', 'uriTemplate' => '/v1/{name=operations/**}', 'placeholders' => [ 'name' => [ 'getters' => [ 'getName', ], ], ], ], ], ], ]; src/LongRunning/CancelOperationRequest.php000064400000003243151742725260014740 0ustar00google.longrunning.CancelOperationRequest */ class CancelOperationRequest extends \Google\Protobuf\Internal\Message { /** * The name of the operation resource to be cancelled. * * Generated from protobuf field string name = 1; */ private $name = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $name * The name of the operation resource to be cancelled. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Longrunning\Operations::initOnce(); parent::__construct($data); } /** * The name of the operation resource to be cancelled. * * Generated from protobuf field string name = 1; * @return string */ public function getName() { return $this->name; } /** * The name of the operation resource to be cancelled. * * Generated from protobuf field string name = 1; * @param string $var * @return $this */ public function setName($var) { GPBUtil::checkString($var, True); $this->name = $var; return $this; } } src/LongRunning/DeleteOperationRequest.php000064400000003233151742725260014754 0ustar00google.longrunning.DeleteOperationRequest */ class DeleteOperationRequest extends \Google\Protobuf\Internal\Message { /** * The name of the operation resource to be deleted. * * Generated from protobuf field string name = 1; */ private $name = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $name * The name of the operation resource to be deleted. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Longrunning\Operations::initOnce(); parent::__construct($data); } /** * The name of the operation resource to be deleted. * * Generated from protobuf field string name = 1; * @return string */ public function getName() { return $this->name; } /** * The name of the operation resource to be deleted. * * Generated from protobuf field string name = 1; * @param string $var * @return $this */ public function setName($var) { GPBUtil::checkString($var, True); $this->name = $var; return $this; } } src/LongRunning/GetOperationRequest.php000064400000003127151742725260014273 0ustar00google.longrunning.GetOperationRequest */ class GetOperationRequest extends \Google\Protobuf\Internal\Message { /** * The name of the operation resource. * * Generated from protobuf field string name = 1; */ private $name = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $name * The name of the operation resource. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Longrunning\Operations::initOnce(); parent::__construct($data); } /** * The name of the operation resource. * * Generated from protobuf field string name = 1; * @return string */ public function getName() { return $this->name; } /** * The name of the operation resource. * * Generated from protobuf field string name = 1; * @param string $var * @return $this */ public function setName($var) { GPBUtil::checkString($var, True); $this->name = $var; return $this; } } src/LongRunning/ListOperationsRequest.php000064400000007636151742725260014663 0ustar00google.longrunning.ListOperationsRequest */ class ListOperationsRequest extends \Google\Protobuf\Internal\Message { /** * The name of the operation collection. * * Generated from protobuf field string name = 4; */ private $name = ''; /** * The standard list filter. * * Generated from protobuf field string filter = 1; */ private $filter = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 2; */ private $page_size = 0; /** * The standard list page token. * * Generated from protobuf field string page_token = 3; */ private $page_token = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $name * The name of the operation collection. * @type string $filter * The standard list filter. * @type int $page_size * The standard list page size. * @type string $page_token * The standard list page token. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Longrunning\Operations::initOnce(); parent::__construct($data); } /** * The name of the operation collection. * * Generated from protobuf field string name = 4; * @return string */ public function getName() { return $this->name; } /** * The name of the operation collection. * * Generated from protobuf field string name = 4; * @param string $var * @return $this */ public function setName($var) { GPBUtil::checkString($var, True); $this->name = $var; return $this; } /** * The standard list filter. * * Generated from protobuf field string filter = 1; * @return string */ public function getFilter() { return $this->filter; } /** * The standard list filter. * * Generated from protobuf field string filter = 1; * @param string $var * @return $this */ public function setFilter($var) { GPBUtil::checkString($var, True); $this->filter = $var; return $this; } /** * The standard list page size. * * Generated from protobuf field int32 page_size = 2; * @return int */ public function getPageSize() { return $this->page_size; } /** * The standard list page size. * * Generated from protobuf field int32 page_size = 2; * @param int $var * @return $this */ public function setPageSize($var) { GPBUtil::checkInt32($var); $this->page_size = $var; return $this; } /** * The standard list page token. * * Generated from protobuf field string page_token = 3; * @return string */ public function getPageToken() { return $this->page_token; } /** * The standard list page token. * * Generated from protobuf field string page_token = 3; * @param string $var * @return $this */ public function setPageToken($var) { GPBUtil::checkString($var, True); $this->page_token = $var; return $this; } } src/LongRunning/ListOperationsResponse.php000064400000005751151742725260015025 0ustar00google.longrunning.ListOperationsResponse */ class ListOperationsResponse extends \Google\Protobuf\Internal\Message { /** * A list of operations that matches the specified filter in the request. * * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; */ private $operations; /** * The standard List next-page token. * * Generated from protobuf field string next_page_token = 2; */ private $next_page_token = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\LongRunning\Operation[]|\Google\Protobuf\Internal\RepeatedField $operations * A list of operations that matches the specified filter in the request. * @type string $next_page_token * The standard List next-page token. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Longrunning\Operations::initOnce(); parent::__construct($data); } /** * A list of operations that matches the specified filter in the request. * * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getOperations() { return $this->operations; } /** * A list of operations that matches the specified filter in the request. * * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; * @param \Google\LongRunning\Operation[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setOperations($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\LongRunning\Operation::class); $this->operations = $arr; return $this; } /** * The standard List next-page token. * * Generated from protobuf field string next_page_token = 2; * @return string */ public function getNextPageToken() { return $this->next_page_token; } /** * The standard List next-page token. * * 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; } } src/LongRunning/Operation.php000064400000021505151742725260012262 0ustar00google.longrunning.Operation */ class Operation extends \Google\Protobuf\Internal\Message { /** * The server-assigned name, which is only unique within the same service that * originally returns it. If you use the default HTTP mapping, the * `name` should have the format of `operations/some/unique/name`. * * Generated from protobuf field string name = 1; */ private $name = ''; /** * Service-specific metadata associated with the operation. It typically * contains progress information and common metadata such as create time. * Some services might not provide such metadata. Any method that returns a * long-running operation should document the metadata type, if any. * * Generated from protobuf field .google.protobuf.Any metadata = 2; */ private $metadata = null; /** * If the value is `false`, it means the operation is still in progress. * If true, the operation is completed, and either `error` or `response` is * available. * * Generated from protobuf field bool done = 3; */ private $done = false; protected $result; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $name * The server-assigned name, which is only unique within the same service that * originally returns it. If you use the default HTTP mapping, the * `name` should have the format of `operations/some/unique/name`. * @type \Google\Protobuf\Any $metadata * Service-specific metadata associated with the operation. It typically * contains progress information and common metadata such as create time. * Some services might not provide such metadata. Any method that returns a * long-running operation should document the metadata type, if any. * @type bool $done * If the value is `false`, it means the operation is still in progress. * If true, the operation is completed, and either `error` or `response` is * available. * @type \Google\Rpc\Status $error * The error result of the operation in case of failure or cancellation. * @type \Google\Protobuf\Any $response * The normal response of the operation in case of success. If the original * method returns no data on success, such as `Delete`, the response is * `google.protobuf.Empty`. If the original method is standard * `Get`/`Create`/`Update`, the response should be the resource. For other * methods, the response should have the type `XxxResponse`, where `Xxx` * is the original method name. For example, if the original method name * is `TakeSnapshot()`, the inferred response type is * `TakeSnapshotResponse`. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Longrunning\Operations::initOnce(); parent::__construct($data); } /** * The server-assigned name, which is only unique within the same service that * originally returns it. If you use the default HTTP mapping, the * `name` should have the format of `operations/some/unique/name`. * * Generated from protobuf field string name = 1; * @return string */ public function getName() { return $this->name; } /** * The server-assigned name, which is only unique within the same service that * originally returns it. If you use the default HTTP mapping, the * `name` should have the format of `operations/some/unique/name`. * * Generated from protobuf field string name = 1; * @param string $var * @return $this */ public function setName($var) { GPBUtil::checkString($var, True); $this->name = $var; return $this; } /** * Service-specific metadata associated with the operation. It typically * contains progress information and common metadata such as create time. * Some services might not provide such metadata. Any method that returns a * long-running operation should document the metadata type, if any. * * Generated from protobuf field .google.protobuf.Any metadata = 2; * @return \Google\Protobuf\Any */ public function getMetadata() { return $this->metadata; } /** * Service-specific metadata associated with the operation. It typically * contains progress information and common metadata such as create time. * Some services might not provide such metadata. Any method that returns a * long-running operation should document the metadata type, if any. * * Generated from protobuf field .google.protobuf.Any metadata = 2; * @param \Google\Protobuf\Any $var * @return $this */ public function setMetadata($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); $this->metadata = $var; return $this; } /** * If the value is `false`, it means the operation is still in progress. * If true, the operation is completed, and either `error` or `response` is * available. * * Generated from protobuf field bool done = 3; * @return bool */ public function getDone() { return $this->done; } /** * If the value is `false`, it means the operation is still in progress. * If true, the operation is completed, and either `error` or `response` is * available. * * Generated from protobuf field bool done = 3; * @param bool $var * @return $this */ public function setDone($var) { GPBUtil::checkBool($var); $this->done = $var; return $this; } /** * The error result of the operation in case of failure or cancellation. * * Generated from protobuf field .google.rpc.Status error = 4; * @return \Google\Rpc\Status */ public function getError() { return $this->readOneof(4); } /** * The error result of the operation in case of failure or cancellation. * * Generated from protobuf field .google.rpc.Status error = 4; * @param \Google\Rpc\Status $var * @return $this */ public function setError($var) { GPBUtil::checkMessage($var, \Google\Rpc\Status::class); $this->writeOneof(4, $var); return $this; } /** * The normal response of the operation in case of success. If the original * method returns no data on success, such as `Delete`, the response is * `google.protobuf.Empty`. If the original method is standard * `Get`/`Create`/`Update`, the response should be the resource. For other * methods, the response should have the type `XxxResponse`, where `Xxx` * is the original method name. For example, if the original method name * is `TakeSnapshot()`, the inferred response type is * `TakeSnapshotResponse`. * * Generated from protobuf field .google.protobuf.Any response = 5; * @return \Google\Protobuf\Any */ public function getResponse() { return $this->readOneof(5); } /** * The normal response of the operation in case of success. If the original * method returns no data on success, such as `Delete`, the response is * `google.protobuf.Empty`. If the original method is standard * `Get`/`Create`/`Update`, the response should be the resource. For other * methods, the response should have the type `XxxResponse`, where `Xxx` * is the original method name. For example, if the original method name * is `TakeSnapshot()`, the inferred response type is * `TakeSnapshotResponse`. * * Generated from protobuf field .google.protobuf.Any response = 5; * @param \Google\Protobuf\Any $var * @return $this */ public function setResponse($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); $this->writeOneof(5, $var); return $this; } /** * @return string */ public function getResult() { return $this->whichOneof("result"); } } src/LongRunning/OperationInfo.php000064400000012303151742725260013072 0ustar00google.longrunning.OperationInfo */ class OperationInfo extends \Google\Protobuf\Internal\Message { /** * Required. The message name of the primary return type for this * long-running operation. * This type will be used to deserialize the LRO's response. * If the response is in a different package from the rpc, a fully-qualified * message name must be used (e.g. `google.protobuf.Struct`). * Note: Altering this value constitutes a breaking change. * * Generated from protobuf field string response_type = 1; */ private $response_type = ''; /** * Required. The message name of the metadata type for this long-running * operation. * If the response is in a different package from the rpc, a fully-qualified * message name must be used (e.g. `google.protobuf.Struct`). * Note: Altering this value constitutes a breaking change. * * Generated from protobuf field string metadata_type = 2; */ private $metadata_type = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $response_type * Required. The message name of the primary return type for this * long-running operation. * This type will be used to deserialize the LRO's response. * If the response is in a different package from the rpc, a fully-qualified * message name must be used (e.g. `google.protobuf.Struct`). * Note: Altering this value constitutes a breaking change. * @type string $metadata_type * Required. The message name of the metadata type for this long-running * operation. * If the response is in a different package from the rpc, a fully-qualified * message name must be used (e.g. `google.protobuf.Struct`). * Note: Altering this value constitutes a breaking change. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Longrunning\Operations::initOnce(); parent::__construct($data); } /** * Required. The message name of the primary return type for this * long-running operation. * This type will be used to deserialize the LRO's response. * If the response is in a different package from the rpc, a fully-qualified * message name must be used (e.g. `google.protobuf.Struct`). * Note: Altering this value constitutes a breaking change. * * Generated from protobuf field string response_type = 1; * @return string */ public function getResponseType() { return $this->response_type; } /** * Required. The message name of the primary return type for this * long-running operation. * This type will be used to deserialize the LRO's response. * If the response is in a different package from the rpc, a fully-qualified * message name must be used (e.g. `google.protobuf.Struct`). * Note: Altering this value constitutes a breaking change. * * Generated from protobuf field string response_type = 1; * @param string $var * @return $this */ public function setResponseType($var) { GPBUtil::checkString($var, True); $this->response_type = $var; return $this; } /** * Required. The message name of the metadata type for this long-running * operation. * If the response is in a different package from the rpc, a fully-qualified * message name must be used (e.g. `google.protobuf.Struct`). * Note: Altering this value constitutes a breaking change. * * Generated from protobuf field string metadata_type = 2; * @return string */ public function getMetadataType() { return $this->metadata_type; } /** * Required. The message name of the metadata type for this long-running * operation. * If the response is in a different package from the rpc, a fully-qualified * message name must be used (e.g. `google.protobuf.Struct`). * Note: Altering this value constitutes a breaking change. * * Generated from protobuf field string metadata_type = 2; * @param string $var * @return $this */ public function setMetadataType($var) { GPBUtil::checkString($var, True); $this->metadata_type = $var; return $this; } }